]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Move prefix lookup to outside re loop 16681/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 28 Aug 2024 17:18:00 +0000 (13:18 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 28 Aug 2024 17:18:00 +0000 (13:18 -0400)
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 <sharpd@nvidia.com>
zebra/zebra_vty.c

index 5742c38e23eee6907e41909b1e4960fef648f812..3b786e3257c0c870ab43c66834f4f52ce3859db5 100644 (file)
@@ -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);