Skip to content

Commit

Permalink
zebra: fix wrong nexthop id debug message
Browse files Browse the repository at this point in the history
When allocating big protocol level identifiers, the number range is
big, and when pushing to netlink messages, the first nexthop group
is truncated, whereas the nexthop has been installed on the kernel.

> ubuntu2204(config)# nexthop-group A
> ubuntu2204(config-nh-group)# group 1
> ubuntu2204(config-nh-group)# group 2
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# nexthop-group 1
> ubuntu2204(config-nh-group)# nexthop 192.0.2.130 loop1 enable-proto-nhg-control
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# nexthop-group 2
> ubuntu2204(config-nh-group)# nexthop 192.0.2.131 loop1 enable-proto-nhg-control
> [..]
> 2023/11/24 16:47:40 ZEBRA: [VNMVB-91G3G] _netlink_nexthop_build_group: ID (179687500): group 17968/179687502

> # ip nexthop ls
> id 179687500 group 179687501/179687502 proto 194

Fix this by increasing the buffer size when appending the first number.

Fixes: 8d03bc5 ("zebra: Handle nhg_hash_entry encaps/more debugging")

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Nov 27, 2023
1 parent 58809bc commit 1afac86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,7 @@ static bool _netlink_nexthop_build_group(struct nlmsghdr *n, size_t req_size,

if (IS_ZEBRA_DEBUG_KERNEL) {
if (i == 0)
snprintf(buf, sizeof(buf1), "group %u",
snprintf(buf, sizeof(buf), "group %u",
grp[i].id);
else {
snprintf(buf1, sizeof(buf1), "/%u",
Expand Down

0 comments on commit 1afac86

Please sign in to comment.