summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-03-14 12:56:47 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-03-14 12:56:47 +0100
commit33b6c292c3e3a8972d0b9f43d156aae50db65720 (patch)
tree1484a1fa45be8e0474415646c3022303c74f0e53 /proto
parent27f6ba651ebb07201f7964c8f14a254267f0f26a (diff)
BGP: Allow to specify interface for regular sessions
This may be useful if multple interfaces share the same network range. Thanks to Fritz Grimpen for the original patch.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 0f1c9446..f706e76e 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -790,7 +790,7 @@ bgp_find_proto(sock *sk)
{
struct bgp_proto *p = (struct bgp_proto *) pc->proto;
if (ipa_equal(p->cf->remote_ip, sk->daddr) &&
- (!ipa_is_link_local(sk->daddr) || (p->cf->iface == sk->iface)))
+ (!p->cf->iface || (p->cf->iface == sk->iface)))
return p;
}
@@ -1324,11 +1324,8 @@ bgp_check_config(struct bgp_config *c)
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 (ipa_is_link_local(c->remote_ip) && !c->iface)
+ cf_error("Link-local neighbor address requires specified interface");
if (!(c->capabilities && c->enable_as4) && (c->remote_as > 0xFFFF))
cf_error("Neighbor AS number out of range (AS4 not available)");
@@ -1346,6 +1343,9 @@ bgp_check_config(struct bgp_config *c)
ipa_is_link_local(c->source_addr)))
cf_error("Multihop BGP cannot be used with link-local addresses");
+ if (c->multihop && c->iface)
+ cf_error("Multihop BGP cannot be bound to interface");
+
if (c->multihop && c->check_link)
cf_error("Multihop BGP cannot depend on link state");