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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 933ced8..27ade8e 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -210,7 +210,10 @@ bgp_connect(struct bgp_proto *p) /* Enter Connect state and start establishing c
DBG("BGP: Connecting\n");
s = sk_new(p->p.pool);
s->type = SK_TCP_ACTIVE;
- s->saddr = p->local_addr;
+ if (ipa_nonzero(p->cf->source_addr))
+ s->saddr = p->cf->source_addr;
+ else
+ s->saddr = p->local_addr;
s->daddr = p->cf->remote_ip;
s->dport = BGP_PORT;
bgp_setup_sk(p, conn, s);