diff options
| author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2025-02-11 11:58:00 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-11 11:58:00 -0600 |
| commit | ba2b63991ac9aac7bc1d7aa2bf82a070abada4fd (patch) | |
| tree | c669ba23cfcf014f146e0bbcde57b6fc3492e770 /lib/zclient.c | |
| parent | 0245b8ed9246a588a761fbc9388281e0f63d84a6 (diff) | |
| parent | f1d22e011601e5c41a051fa7719170429256f055 (diff) | |
Merge pull request #18085 from FRRouting/mergify/bp/stable/10.1/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.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 1aab7b48ba..f2184b0aae 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2132,7 +2132,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; /* |
