Skip to content

Commit

Permalink
lib: fix nexthop node entry from nhg_list
Browse files Browse the repository at this point in the history
When stopping a VRF, the linked list entries must be
removed too.

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

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Nov 30, 2023
1 parent 16a28b7 commit dd15b0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/nexthop_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

0 comments on commit dd15b0a

Please sign in to comment.