summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-03-29 01:31:40 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-04-18 00:40:17 +0200
commitebee2bc4c5e948f4b6525e0b767679b7b62b7a2f (patch)
tree94cb77d25150932674aac7c0250d14d38e861b51 /lib
parentlib, pbrd: Do not allow v6 LL nexthops to be specified without an interface. (diff)
downloadfrr-ebee2bc4c5e948f4b6525e0b767679b7b62b7a2f.tar.xz
frr-ebee2bc4c5e948f4b6525e0b767679b7b62b7a2f.zip
lib: Clean up delete of a nexthop from a nexthop group
The delete was not properly deleting the nexthop from the nexthop group and it was not properly setting the nexthop's pointers to NULL. Ticket: CM-20261 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/nexthop_group.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index a527d011a..b991ed094 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -112,6 +112,9 @@ void nexthop_del(struct nexthop_group *nhg, struct nexthop *nh)
if (nexthop->next)
nexthop->next->prev = nexthop->prev;
+
+ nh->prev = NULL;
+ nh->next = NULL;
}
void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
@@ -151,6 +154,7 @@ static void nhgc_delete_nexthops(struct nexthop_group_cmd *nhgc)
while (nexthop) {
struct nexthop *next = nexthop_next(nexthop);
+ nexthop_del(&nhgc->nhg, nexthop);
if (nhg_hooks.del_nexthop)
nhg_hooks.del_nexthop(nhgc, nexthop);