summaryrefslogtreecommitdiff
path: root/bgpd/bgp_mpath.c
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2016-03-13 06:03:10 +0000
committervivek <vivek@cumulusnetworks.com>2016-03-13 06:03:10 +0000
commita3cb01d89c5c741b4fa3a0f4f46264eafa0184cf (patch)
tree23d2ffdb29e306105773c56638dd7482be1160ed /bgpd/bgp_mpath.c
parente99789d89d018d59ffd1029a2f32dd49c129859c (diff)
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 <vivek@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-9671 Reviewed By: CCR-4277 Testing Done: Manual (problem could not be replicated to verify)
Diffstat (limited to 'bgpd/bgp_mpath.c')
-rw-r--r--bgpd/bgp_mpath.c11
1 files changed, 10 insertions, 1 deletions
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;
}