summaryrefslogtreecommitdiffstats
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 327292a..84c353e 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -574,6 +574,7 @@ bgp_connect(struct bgp_proto *p) /* Enter Connect state and start establishing c
s->saddr = p->source_addr;
s->daddr = p->cf->remote_ip;
s->dport = BGP_PORT;
+ s->iface = p->neigh->iface;
s->ttl = p->cf->multihop ? : 1;
s->rbsize = BGP_RX_BUFFER_SIZE;
s->tbsize = BGP_TX_BUFFER_SIZE;
@@ -743,6 +744,7 @@ bgp_start_locked(struct object_lock *lock)
{
struct bgp_proto *p = lock->data;
struct bgp_config *cf = p->cf;
+ struct iface *interface = NULL;
if (p->p.proto_state != PS_START)
{
@@ -759,7 +761,16 @@ bgp_start_locked(struct object_lock *lock)
return;
}
- p->neigh = neigh_find(&p->p, &cf->remote_ip, NEF_STICKY);
+ if (*cf->interface) {
+ interface = if_find_by_name(cf->interface);
+
+ if (!interface) {
+ BGP_TRACE(D_EVENTS, "Waiting for interface %s", cf->interface);
+ return;
+ }
+ }
+
+ p->neigh = neigh_find2(&p->p, &cf->remote_ip, interface, NEF_STICKY);
if (!p->neigh || (p->neigh->scope == SCOPE_HOST))
{
log(L_ERR "%s: Invalid remote address %I", p->p.name, cf->remote_ip);