Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sharpd: fix deleting nhid when suppressing nexthop from nh group
When removing the last nexthop from a nexthop-group, the nexthop group remains in the zebra contexts: > ubuntu2204(config)# nexthop-group gdgd > 2023/11/23 14:06:36 SHARP: [Q5NBA-GN1BG] NHG ID assigned: 179687502 > ubuntu2204(config-nh-group)# nexthop 192.0.2.7 loop1 > ubuntu2204(config-nh-group)# 2023/11/23 14:06:38 ZEBRA: [VNMVB-91G3G] _netlink_nexthop_build_group: ID (179687502): group 338 > 2023/11/23 14:06:38 ZEBRA: [R43C6-KYHWT] netlink_nexthop_msg_encode: RTM_NEWNEXTHOP, id=179687502 > 2023/11/23 14:06:38 ZEBRA: [HYEHE-CQZ9G] nl_batch_send: netlink-dp (NS 0), batch size=44, msg cnt=1 > 2023/11/23 14:06:38 SHARP: [JWRCN-N9K90] Installed nhg 179687502 > > ubuntu2204(config-nh-group)# no nexthop 192.0.2.7 loop1 > 2023/11/23 14:06:47 SHARP: [Y2G2F-ZTW6M] nhg_add: nhg 179687502 not sent: no valid nexthops > ubuntu2204(config-nh-group)# do show nexthop-group rib 179687502 > ID: 179687502 (sharp) > RefCnt: 1 > Uptime: 00:00:23 > VRF: default > Valid, Installed > Depends: (338) > via 192.0.2.7, loop1 (vrf default), weight 1 Fix this by sending an NHG_DEL message when no nexthops are attached, and when the id was already installed. Fixes: 5a9c093 ("sharpd: don't send invalid nexthop-groups to zebra") Signed-off-by: Philippe Guibert <[email protected]>
- Loading branch information