]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: break if duplicate nexthop found in nhe2grp
authorStephen Worley <sworley@cumulusnetworks.com>
Thu, 26 Mar 2020 14:57:45 +0000 (10:57 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 3 Apr 2020 19:14:53 +0000 (15:14 -0400)
If we find that a nexthop is a duplicate, break immediately
rather than continuing to look through the rest of the list.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
(cherry picked from commit d43122b58f4bf9cb729c786b990ae254b8dde35b)

zebra/zebra_nhg.c

index 717f03d890a12f148f73fa46410fb745bbee4bc2..72c22a1a29bebc34edd743e0776bd0013863f188 100644 (file)
@@ -1901,8 +1901,10 @@ static uint8_t zebra_nhg_nhe2grp_internal(struct nh_grp *grp,
 
                        /* Check for duplicate IDs, ignore if found. */
                        for (int j = 0; j < i; j++) {
-                               if (depend->id == grp[j].id)
+                               if (depend->id == grp[j].id) {
                                        duplicate = true;
+                                       break;
+                               }
                        }
 
                        if (duplicate) {