summaryrefslogtreecommitdiffstats
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-04-28 18:11:56 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-04-28 18:11:56 +0200
commitad440a570b37e8674ef35f3a18df48f0eb2579eb (patch)
treef3d0f586a5d9fa21fd1a64e8a5a96c9ca2b58771 /proto/bgp/bgp.c
parenta6ee026693a9c24c71dcf846abd32508782e0249 (diff)
downloadbird-ad440a570b37e8674ef35f3a18df48f0eb2579eb.tar
bird-ad440a570b37e8674ef35f3a18df48f0eb2579eb.zip
Fixes handling of 'next hop self' and 'source address' configuration
options.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 41c8d53..a0bc892 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -500,10 +500,7 @@ 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;
- if (ipa_nonzero(p->cf->source_addr))
- s->saddr = p->cf->source_addr;
- else
- s->saddr = p->local_addr;
+ s->saddr = p->source_addr;
s->daddr = p->cf->remote_ip;
s->dport = BGP_PORT;
s->ttl = p->cf->multihop ? : 1;
@@ -609,7 +606,9 @@ static void
bgp_start_neighbor(struct bgp_proto *p)
{
p->local_addr = p->neigh->iface->addr->ip;
- DBG("BGP: local=%I remote=%I\n", p->local_addr, p->next_hop);
+ p->source_addr = ipa_nonzero(p->cf->source_addr) ? p->cf->source_addr : p->local_addr;
+
+ DBG("BGP: local=%I remote=%I\n", p->source_addr, p->next_hop);
#ifdef IPV6
{
struct ifa *a;