summaryrefslogtreecommitdiff
path: root/lib/nexthop_group.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2023-11-30 13:57:57 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2023-11-30 14:25:08 +0100
commit0c34fa2cc6354633dfb64275d1e37c273f3b95d0 (patch)
treeffdd52533ba735cd32cc80cbe22b2c744b74870d /lib/nexthop_group.c
parent2ff41dd690eab66d7ca12d28cecaab1d5f7b4dc9 (diff)
lib: fix nexthop node entry from nhg_list
When stopping a VRF, the linked list entries must be removed too. Fixes: 98cbbaea91f6 ("lib: Handle if up/down and vrf enable/disable events") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/nexthop_group.c')
-rw-r--r--lib/nexthop_group.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index e5c2258191..9abd3139fd 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -1234,9 +1234,9 @@ void nexthop_group_disable_vrf(struct vrf *vrf)
struct nexthop_hold *nhh;
RB_FOREACH (nhgc, nhgc_entry_head, &nhgc_entries) {
- struct listnode *node;
+ struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS_RO(nhgc->nhg_list, node, nhh)) {
+ for (ALL_LIST_ELEMENTS(nhgc->nhg_list, node, nnode, nhh)) {
struct nexthop nhop;
struct nexthop *nh;
@@ -1257,6 +1257,8 @@ void nexthop_group_disable_vrf(struct vrf *vrf)
nhg_hooks.del_nexthop(nhgc, nh);
nexthop_free(nh);
+
+ list_delete_node(nhgc->nhg_list, node);
}
}
}