]> git.puffer.fish Git - mirror/frr.git/commitdiff
BGP: Check in multipath comparison before invoking sockunion_cmp
authorvivek <vivek@cumulusnetworks.com>
Sun, 13 Mar 2016 06:03:10 +0000 (06:03 +0000)
committervivek <vivek@cumulusnetworks.com>
Sun, 13 Mar 2016 06:03:10 +0000 (06:03 +0000)
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)

bgpd/bgp_mpath.c

index 50813df0346ed851827d4cc17ed77871ab577f25..852d863296445ecaa928a723d3ac30cb2bdfc59c 100644 (file)
@@ -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;
 }