From 184dccca6001ca566788e3a51d2da4248f379f92 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 28 Aug 2024 13:18:00 -0400 Subject: [PATCH] zebra: Move prefix lookup to outside re loop Move the prefix lookup/comparison to outside the re loop and into the rn loop, since that is where the code should actually be. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 5742c38e23..3b786e3257 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -891,6 +891,9 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, for (rn = route_top(table); rn; rn = srcdest_route_next(rn)) { dest = rib_dest_from_rnode(rn); + if (longer_prefix_p && !prefix_match(longer_prefix_p, &rn->p)) + continue; + RNODE_FOREACH_RE (rn, re) { if (use_fib && re != dest->selected_fib) continue; @@ -898,10 +901,6 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, if (tag && re->tag != tag) continue; - if (longer_prefix_p - && !prefix_match(longer_prefix_p, &rn->p)) - continue; - /* This can only be true when the afi is IPv4 */ if (supernets_only) { addr = ntohl(rn->p.u.prefix4.s_addr); -- 2.39.5