Skip to content

Commit

Permalink
zebra: Fix snmp walk of zebra rib
Browse files Browse the repository at this point in the history
The snmp walk of the zebra rib was skipping entries
because in_addr_cmp was replaced with a prefix_cmp
which worked slightly differently causing parts
of the zebra rib tree to be skipped.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Sep 25, 2024
1 parent a172bea commit ecd9d44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zebra/zebra_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,11 @@ static void check_replace(struct route_node *np2, struct route_entry *re2,
return;
}

if (prefix_cmp(&(*np)->p, &np2->p) < 0)
if (in_addr_cmp((uint8_t *)&(*np)->p.u.prefix4,
(uint8_t *)&np2->p.u.prefix4) < 0)
return;
if (prefix_cmp(&(*np)->p, &np2->p) > 0) {
if (in_addr_cmp((uint8_t *)&(*np)->p.u.prefix4,
(uint8_t *)&np2->p.u.prefix4) > 0) {
*np = np2;
*re = re2;
return;
Expand Down

0 comments on commit ecd9d44

Please sign in to comment.