From d43122b58f4bf9cb729c786b990ae254b8dde35b Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Thu, 26 Mar 2020 10:57:45 -0400 Subject: [PATCH] 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 --- zebra/zebra_nhg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index c2582b93e1..dc0af050d7 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1929,8 +1929,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) { -- 2.39.5