summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-02-22 13:50:58 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2015-02-22 13:50:58 +0100
commita1beb8f3ee7a6e41dbe4bfd336b8bf5eecb46d01 (patch)
tree07e3269bb4fa1bb649af14e0aaf931003777e601 /proto/bgp/bgp.c
parent86c3eea0f3ec74ac1024d4aba4e98c962126f387 (diff)
Relax BGP neighbor parameter
Permit specifying neighbor address, AS number and port independently. Add 'interface' parameter for specifying interface for link-local sessions independently. Thanks to Alexander V. Chernikov for the original patch.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 016d3e60..07fd8478 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1196,9 +1196,18 @@ bgp_check_config(struct bgp_config *c)
if (!c->local_as)
cf_error("Local AS number must be set");
- if (!c->remote_as)
+ if (ipa_zero(c->remote_ip))
cf_error("Neighbor must be configured");
+ if (!c->remote_as)
+ cf_error("Remote AS number must be set");
+
+ // if (ipa_is_link_local(c->remote_ip) && !c->iface)
+ // cf_error("Link-local neighbor address requires specified interface");
+
+ if (!ipa_is_link_local(c->remote_ip) != !c->iface)
+ cf_error("Link-local address and interface scope must be used together");
+
if (!(c->capabilities && c->enable_as4) && (c->remote_as > 0xFFFF))
cf_error("Neighbor AS number out of range (AS4 not available)");