From 3ffe142a3ad4fb0f5cc02b88a563dab45295b52a Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Fri, 11 Dec 2015 21:12:56 +0000 Subject: [PATCH] Quagga: make check is broken with addpath changes Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-8472 The first as-path is what the original as-path for the test, the second is what the as-path should look like once all confed SETs and SEQs have been removed. At the time the test was written quagga did not correctly remove confed SETs and SEQs but whoever wrote the test didn't notice this and assumed that the behavior they were seeing was correct so used that output to populate the second as-path. Now that we do correctly remove the confed parts these tests fail. So the fix is to update the second as-path for these two tests so that they no longer contain any confed SETs/SEQs. --- bgpd/bgp_updgrp.c | 7 +++++-- bgpd/bgpd.c | 8 ++++++-- tests/aspath_test.c | 10 +++++----- tests/bgp_mpath_test.c | 3 --- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 3ba476d086..cd7710b501 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1577,8 +1577,11 @@ update_bgp_group_free (struct bgp *bgp) AF_FOREACH (afid) { - hash_free(bgp->update_groups[afid]); - bgp->update_groups[afid] = NULL; + if (bgp->update_groups[afid]) + { + hash_free(bgp->update_groups[afid]); + bgp->update_groups[afid] = NULL; + } } } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 9514f4de18..d821dc6d1b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2977,8 +2977,12 @@ bgp_free (struct bgp *bgp) list_delete (bgp->group); list_delete (bgp->peer); - hash_free(bgp->peerhash); - bgp->peerhash = NULL; + + if (bgp->peerhash) + { + hash_free(bgp->peerhash); + bgp->peerhash = NULL; + } if (bgp->name) XFREE(MTYPE_BGP, bgp->name); diff --git a/tests/aspath_test.c b/tests/aspath_test.c index 8ba77b122b..10a1517b4d 100644 --- a/tests/aspath_test.c +++ b/tests/aspath_test.c @@ -134,7 +134,7 @@ static struct test_segment { { 0x4,0x3, 0x01,0xc8, 0x00,0x7b, 0x03,0x15 }, 8, { "[123,456,789]", - "[123,456,789]", + "", 0, 1, NOT_ALL_PRIVATE, 123, 1, NULL_ASN }, }, { /* 9 */ @@ -672,12 +672,12 @@ static struct tests { }, { &test_segments[8], &test_segments[9], { "[123,456,789] (123 456 789) [111,222] 8722 {4196,48658}", - "[123,456,789] (123 456 789) [111,222] 8722 {4196,48658}", + "8722 {4196,48658}", 2, 5, NOT_ALL_PRIVATE, 456, 1, NULL_ASN }, }, { &test_segments[9], &test_segments[8], { "(123 456 789) [111,222] 8722 {4196,48658} [123,456,789]", - "8722 {4196,48658} [123,456,789]", + "8722 {4196,48658}", 2, 5, NOT_ALL_PRIVATE, 48658, 1, NULL_ASN }, }, { &test_segments[14], &test_segments[11], @@ -969,8 +969,8 @@ validate (struct aspath *as, const struct test_spec *sp) { failed++; fails++; - printf ("confed_del: %s\n", aspath_print (asconfeddel)); - printf ("should be: %s\n", sp->shouldbe_delete_confed); + printf ("as-path minus confeds is: %s\n", aspath_print (asconfeddel)); + printf ("as-path minus confeds should be: %s\n", sp->shouldbe_delete_confed); } /* aspath_str2aspath test */ if ((aspath_print (asstr) == NULL && sp->shouldbe != NULL) diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c index e937784aae..3b0a3de052 100644 --- a/tests/bgp_mpath_test.c +++ b/tests/bgp_mpath_test.c @@ -104,9 +104,6 @@ bgp_create_fake (as_t *as, const char *name) bgp->group = list_new (); //bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp; - bgp->rsclient = list_new (); - //bgp->rsclient->cmp = (int (*)(void*, void*)) peer_cmp; - for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { -- 2.39.5