From 2a3fa5d7c4cc59be995c1767870ac70403730da2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 19 May 2015 18:29:18 -0700 Subject: [PATCH] AS_PATH comparison is broken if CONFED_AS_SEQ are present --- bgpd/bgp_aspath.c | 8 ++++---- tests/test-segv.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index e46857c321..8829cf0ceb 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1567,13 +1567,13 @@ aspath_cmp_left (const struct aspath *aspath1, const struct aspath *aspath2) if (!(aspath1 && aspath2)) return 0; - /* If both paths are originated in this AS then we do want to compare MED */ - if (!aspath_count_hops(aspath1) && !aspath_count_hops(aspath2)) - return 1; - seg1 = aspath1->segments; seg2 = aspath2->segments; + /* If both paths are originated in this AS then we do want to compare MED */ + if (!seg1 && !seg2) + return 1; + /* find first non-confed segments for each */ while (seg1 && ((seg1->type == AS_CONFED_SEQUENCE) || (seg1->type == AS_CONFED_SET))) diff --git a/tests/test-segv.c b/tests/test-segv.c index 55bd25a59d..87692e7b6e 100644 --- a/tests/test-segv.c +++ b/tests/test-segv.c @@ -49,7 +49,7 @@ main (void) master = thread_master_create (); signal_init (master, array_size(sigs), sigs); - zlog_default = openzlog("testsegv", ZLOG_NONE, + zlog_default = openzlog("testsegv", ZLOG_NONE, 0, LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON); zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED); zlog_set_level (NULL, ZLOG_DEST_STDOUT, LOG_DEBUG); -- 2.39.5