summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-06-24 15:27:21 +0300
committerPaul Jakma <paul@quagga.net>2015-09-24 15:26:42 +0100
commit2820a01eed1c616d490ddbfd17793c19597459d1 (patch)
tree6a0e418ca25166bd2edcc23a070b4c23d6f99a81 /bgpd
parent782fb0770080d0e2970fc63af8645e82543aa4d0 (diff)
downloadquagga-2820a01eed1c616d490ddbfd17793c19597459d1.tar.bz2
quagga-2820a01eed1c616d490ddbfd17793c19597459d1.tar.xz
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.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f4012719..40012ac2 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -564,7 +564,12 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
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)