zebra: Fix netlink RTM_NEWNEXTHOP parsing for nested attributes

With the addition of resillient hashing for nexthops, the
parsing of nexthops requires telling the decoder functions
that there may be nested attributes.  This was found by
code inspection of iproute2/ipnexthop.c when trying to
understand resillient hashing as well as statistics
gathering for nexthops that are / will be in upstream
kernels in the near future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-10-28 08:10:28 -04:00
parent 68275b093b
commit 6e1e2e8da9
2 changed files with 3 additions and 2 deletions

View File

@ -1045,7 +1045,7 @@ next_rta:
plen = RTA_PAYLOAD(rta);
zlog_debug(" rta [len=%d (payload=%zu) type=(%d) %s]", rta->rta_len,
plen, rta->rta_type, nhm_rta2str(rta->rta_type));
switch (rta->rta_type) {
switch (rta->rta_type & ~NLA_F_NESTED) {
case NHA_ID:
u32v = *(uint32_t *)RTA_DATA(rta);
zlog_debug(" %u", u32v);

View File

@ -2892,7 +2892,8 @@ int netlink_nexthop_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return -1;
}
netlink_parse_rtattr(tb, NHA_MAX, RTM_NHA(nhm), len);
netlink_parse_rtattr_flags(tb, NHA_MAX, RTM_NHA(nhm), len,
NLA_F_NESTED);
if (!tb[NHA_ID]) {