Skip to content

Commit

Permalink
Merge pull request #16561 from FRRouting/mergify/bp/stable/10.0/pr-16554
Browse files Browse the repository at this point in the history
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
  • Loading branch information
donaldsharp authored Aug 13, 2024
2 parents b026de1 + 9aff229 commit 6cfe383
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,18 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
struct nexthop *nexthop1;
struct nexthop *nexthop2;

/* No matter what if they equal IDs, assume equal */
if (nhe1->id && nhe2->id && (nhe1->id == nhe2->id))
return true;
/* If both NHG's have id's then we can just know that
* they are either identical or not. This comparison
* is only ever used for hash equality. NHE's id
* is sufficient to distinguish them. This is especially
* true if NHG's are owned by an upper level protocol.
*/
if (nhe1->id && nhe2->id) {
if (nhe1->id == nhe2->id)
return true;

return false;
}

if (nhe1->type != nhe2->type)
return false;
Expand Down

0 comments on commit 6cfe383

Please sign in to comment.