Skip to content

Commit

Permalink
sharpd: fix avoid twice sending NHG_DEL for a nexthop-group
Browse files Browse the repository at this point in the history
After removing the nexthop of a nexthop group, when the nexthop group
is removed, a nhg removal failure happens:

> ubuntu2204(config)# nexthop-group CCC
> ubuntu2204(config-nh-group)#  nexthop 192.0.2.211 loop1
> ubuntu2204(config-nh-group)# no  nexthop 192.0.2.211 loop1
> [..]
> 2023/12/05 08:59:22 SHARP: [H3QKG-WH8ZV] Removed nhg 179687505
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# no nexthop-group CCC
> [..]
> 2023/12/05 08:59:27 SHARP: [N030J-V0SFN] Failed removal of nhg 179687505

The NHG_DEL message is sent twice at the nexthop deletion, and at the
nexthop-group deletion. Avoid sending it twice.

Fixes: 82beaf6 ("sharpd: fix deleting nhid when suppressing nexthop from nh group")

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Dec 5, 2023
1 parent 82c1d82 commit 8fd9c39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sharpd/sharp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ static void sharp_nhgroup_delete_cb(const char *name)
if (!snhg)
return;

nhg_del(snhg->id);
if (sharp_nhgroup_id_is_installed(snhg->id))
nhg_del(snhg->id);
sharp_nhg_rb_del(&nhg_head, snhg);
XFREE(MTYPE_NHG, snhg);
}
Expand Down

0 comments on commit 8fd9c39

Please sign in to comment.