mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
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: 5a9c0931aa
("sharpd: don't send invalid nexthop-groups to zebra")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
498505c25a
commit
82beaf6ae5
|
@ -563,9 +563,15 @@ void nhg_add(uint32_t id, const struct nexthop_group *nhg,
|
|||
}
|
||||
|
||||
if (api_nhg.nexthop_num == 0) {
|
||||
zlog_debug("%s: nhg %u not sent: no valid nexthops", __func__,
|
||||
id);
|
||||
is_valid = false;
|
||||
if (sharp_nhgroup_id_is_installed(id)) {
|
||||
zlog_debug("%s: nhg %u: no nexthops, deleting nexthop group", __func__,
|
||||
id);
|
||||
zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg);
|
||||
} else {
|
||||
zlog_debug("%s: nhg %u not sent: no valid nexthops", __func__,
|
||||
id);
|
||||
is_valid = false;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue