From: Stephen Worley Date: Thu, 26 Mar 2020 14:57:45 +0000 (-0400) Subject: zebra: break if duplicate nexthop found in nhe2grp X-Git-Tag: frr-7.3.1~11^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b4deb56ddd15681b7bf1cd859d5f6ad817ad4899;p=matthieu%2Ffrr.git zebra: break if duplicate nexthop found in nhe2grp 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 (cherry picked from commit d43122b58f4bf9cb729c786b990ae254b8dde35b) --- diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 717f03d890..72c22a1a29 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -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) {