lib: fix nexthop node entry from nhg_list

When stopping a VRF, the linked list entries must be
removed too.

Fixes: 98cbbaea91 ("lib: Handle if up/down and vrf enable/disable events")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2023-11-30 13:57:57 +01:00
parent 2ff41dd690
commit 0c34fa2cc6

View file

@ -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);
}
}
}