summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-02-11 11:57:41 -0600
committerGitHub <noreply@github.com>2025-02-11 11:57:41 -0600
commitb75732ce31c9d496dc41115dde541df457b52c4e (patch)
tree87652d155e5128eed7a328e317c651f01a60d5d7 /lib/zclient.c
parent8cd14f58f410481166c2524e33f112866a8fcc8f (diff)
parent46e685d2f9cd1a359e0abd95b584f7cc3df9ae2c (diff)
Merge pull request #18084 from FRRouting/mergify/bp/stable/10.2/pr-17901
lib: actually hash all 16 bytes of IPv6 addresses, not just 4 (backport #17901)
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 0e832f0d8f..b5a8244eaf 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -2180,7 +2180,27 @@ struct nexthop *nexthop_from_zapi_nexthop(const struct zapi_nexthop *znh)
n->type = znh->type;
n->vrf_id = znh->vrf_id;
n->ifindex = znh->ifindex;
- n->gate = znh->gate;
+
+ /* only copy values that have meaning - make sure "spare bytes" are
+ * left zeroed for hashing (look at _nexthop_hash_bytes)
+ */
+ switch (znh->type) {
+ case NEXTHOP_TYPE_BLACKHOLE:
+ n->bh_type = znh->bh_type;
+ break;
+ case NEXTHOP_TYPE_IPV4:
+ case NEXTHOP_TYPE_IPV4_IFINDEX:
+ n->gate.ipv4 = znh->gate.ipv4;
+ break;
+ case NEXTHOP_TYPE_IPV6:
+ case NEXTHOP_TYPE_IPV6_IFINDEX:
+ n->gate.ipv6 = znh->gate.ipv6;
+ break;
+ case NEXTHOP_TYPE_IFINDEX:
+ /* nothing, ifindex is always copied */
+ break;
+ }
+
n->srte_color = znh->srte_color;
n->weight = znh->weight;