Skip to content

Commit ed6953a

Browse files
authored
Merge pull request #16560 from FRRouting/mergify/bp/stable/10.1/pr-16554
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
2 parents 0385a87 + a0bcf64 commit ed6953a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

zebra/zebra_nhg.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,18 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
525525
struct nexthop *nexthop1;
526526
struct nexthop *nexthop2;
527527

528-
/* No matter what if they equal IDs, assume equal */
529-
if (nhe1->id && nhe2->id && (nhe1->id == nhe2->id))
530-
return true;
528+
/* If both NHG's have id's then we can just know that
529+
* they are either identical or not. This comparison
530+
* is only ever used for hash equality. NHE's id
531+
* is sufficient to distinguish them. This is especially
532+
* true if NHG's are owned by an upper level protocol.
533+
*/
534+
if (nhe1->id && nhe2->id) {
535+
if (nhe1->id == nhe2->id)
536+
return true;
537+
538+
return false;
539+
}
531540

532541
if (nhe1->type != nhe2->type)
533542
return false;

0 commit comments

Comments
 (0)