From: vivek Date: Sun, 13 Mar 2016 06:03:10 +0000 (+0000) Subject: BGP: Check in multipath comparison before invoking sockunion_cmp X-Git-Tag: frr-2.0-rc1~1062 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a3cb01d89c5c741b4fa3a0f4f46264eafa0184cf;p=mirror%2Ffrr.git BGP: Check in multipath comparison before invoking sockunion_cmp During route selection for Multipath routes, when multiple peers are flapping, it is possible that the old (former) multipath list of routes for a destination may include routes from peers which are no longer in Established state. When the new multipath list is compared against the old list to identify changes, additional checks are needed to avoid comparing connection addresses if the peer is not in Established state. This patch introduces those checks. Signed-off-by: Vivek Venkatraman Reviewed-by: Daniel Walton Reviewed-by: Don Slice Ticket: CM-9671 Reviewed By: CCR-4277 Testing Done: Manual (problem could not be replicated to verify) --- diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 50813df034..852d863296 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -188,7 +188,16 @@ bgp_info_mpath_cmp (void *val1, void *val2) compare = bgp_info_nexthop_cmp (bi1, bi2); if (!compare) - compare = sockunion_cmp (bi1->peer->su_remote, bi2->peer->su_remote); + { + if (!bi1->peer->su_remote && !bi2->peer->su_remote) + compare = 0; + else if (!bi1->peer->su_remote) + compare = 1; + else if (!bi2->peer->su_remote) + compare = -1; + else + compare = sockunion_cmp (bi1->peer->su_remote, bi2->peer->su_remote); + } return compare; }