summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2024-08-13 08:45:42 -0400
committerGitHub <noreply@github.com>2024-08-13 08:45:42 -0400
commit6cfe383166a0ef517179f0ca31b29603f1247013 (patch)
treed1e6a8a35c7718ba82b9603e5be03b746c740da0
parentb026de1f6ca7d977b8514c80da1c64289306604f (diff)
parent9aff229696fb0c0acab2699aab185a7c525a93c0 (diff)
Merge pull request #16561 from FRRouting/mergify/bp/stable/10.0/pr-16554
zebra: Ensure non-equal id's are not same nhg's (backport #16554)
-rw-r--r--zebra/zebra_nhg.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index ed949da917..7a558be3b4 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -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;