bgpd: Make bgp_info_cmp robust to paths that do not have su_remote info
My original su_remote == NULL check is not correct. It seems that
* bgp_route.c: (bgp_info_cmp) Some bgp_info is compared with su_remote=NULL
and it's supposed to be perfectly legal. E.g. configured subnet announces
("network a.b.c.d/n"). Ensure bgp_info_cmp is robust if such a path gets
as far as the neighbour address comparison step.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f401271..40012ac 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -564,7 +564,12 @@
return 1;
if (CHECK_FLAG (new->flags, BGP_INFO_STALE))
return 0;
-
+ /* locally configured routes to advertise do not have su_remote */
+ if (new->peer->su_remote == NULL)
+ return 0;
+ if (exist->peer->su_remote == NULL)
+ return 1;
+
ret = sockunion_cmp (new->peer->su_remote, exist->peer->su_remote);
if (ret == 1)