From ad440a570b37e8674ef35f3a18df48f0eb2579eb Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 28 Apr 2009 18:11:56 +0200 Subject: Fixes handling of 'next hop self' and 'source address' configuration options. --- proto/bgp/attrs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'proto/bgp/attrs.c') diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index a015c2b..9a247de 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -790,12 +790,7 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p if (p->cf->next_hop_self || !p->is_internal || rta->dest != RTD_ROUTER) - { - if (ipa_nonzero(p->cf->source_addr)) - *(ip_addr *)z = p->cf->source_addr; - else - *(ip_addr *)z = p->local_addr; - } + *(ip_addr *)z = p->source_addr; else *(ip_addr *)z = e->attrs->gw; @@ -860,14 +855,14 @@ bgp_update_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p } a = ea_find(e->attrs->eattrs, EA_CODE(EAP_BGP, BA_NEXT_HOP)); - if (a && (p->is_internal || (!p->is_internal && e->attrs->iface == p->neigh->iface))) + if (a && !p->cf->next_hop_self && (p->is_internal || (!p->is_internal && e->attrs->iface == p->neigh->iface))) { /* Leave the original next hop attribute, will check later where does it point */ } else { /* Need to create new one */ - bgp_attach_attr_ip(attrs, pool, BA_NEXT_HOP, p->local_addr); + bgp_attach_attr_ip(attrs, pool, BA_NEXT_HOP, p->source_addr); } if (rr) -- cgit v1.2.3