From: Donald Sharp Date: Wed, 26 Aug 2015 16:03:30 +0000 (-0700) Subject: Fix dynamic sessions with multiple bgp instances X-Git-Tag: frr-2.0-rc1~1276^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2aab8d2b2cd88163d48317224635c90f0dd3a50d;p=matthieu%2Ffrr.git Fix dynamic sessions with multiple bgp instances Ticket:CM-6534 Reviewed by:CCR-3239 Testing: See Bug Dynamic neighbors did not work properly with multiple bgp instances. This was caused by the lookup for the dynamic range attempting to break out of two for loops at the same time. The break only stopped the innermost for loop, causing it to only ever find the listen-range for the last instance in the bm->bgp list. Additional bug fix for dynamic listen for peer groups that are configured with internal or external key word. --- diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 976e614daa..abd8c03cd9 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2306,7 +2306,7 @@ peer_group_listen_range_add (struct peer_group *group, struct prefix *range) afi = family2afi(range->family); /* Group needs remote AS configured. */ - if (! group->conf->as) + if (group->conf->as_type == AS_UNSPECIFIED) return BGP_ERR_PEER_GROUP_NO_REMOTE_AS; /* Ensure no duplicates. Currently we don't care about overlaps. */ @@ -3035,9 +3035,10 @@ peer_group_lookup_dynamic_neighbor (struct bgp *bgp, struct prefix *prefix, for (ALL_LIST_ELEMENTS (bm->bgp, bgpnode, nbgpnode, bgp)) for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) if ((range = peer_group_lookup_dynamic_neighbor_range(group, prefix))) - break; + goto found_range; } + found_range: *listen_range = range; return (group && range) ? group : NULL; }