]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Check active count first in nhg_hash_equal
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 6 Aug 2019 17:16:07 +0000 (13:16 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:42 +0000 (11:13 -0400)
Before checking the equivalence of the whole group itself,
check to see if they contain the same number of non-recursive
active nexthops. This should shorten lookup time for the case of
non-resolved nexthop group creation.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index b343778bf3a601e921957684b9c6fcdc37b0e8d8..3a2efacd9beabbd1447f06a8ba6613a6a3f4c7d8 100644 (file)
@@ -387,13 +387,13 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
        if (nhe1->afi != nhe2->afi)
                return false;
 
-       if (!nexthop_group_equal(nhe1->nhg, nhe2->nhg))
-               return false;
-
        if (nexthop_group_active_nexthop_num_no_recurse(nhe1->nhg)
            != nexthop_group_active_nexthop_num_no_recurse(nhe2->nhg))
                return false;
 
+       if (!nexthop_group_equal(nhe1->nhg, nhe2->nhg))
+               return false;
+
        return true;
 }