diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-03-01 10:57:58 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-03-02 11:01:46 +0100 |
commit | bc97f40dffa7b0d1c2f7f778eefd356c6a272470 (patch) | |
tree | 6b950e789e07e3fdb988b9be7a174813465034ad /pimd/pim_nht.c | |
parent | Merge pull request #10657 from patrasar/pim_remove_in_addr_none (diff) | |
download | frr-bc97f40dffa7b0d1c2f7f778eefd356c6a272470.tar.xz frr-bc97f40dffa7b0d1c2f7f778eefd356c6a272470.zip |
pim6d: fixup NHT code for IPv6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_nht.c')
-rw-r--r-- | pimd/pim_nht.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 48dd565b2..817f575c4 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -482,23 +482,13 @@ static int pim_update_upstream_nh(struct pim_instance *pim, uint32_t pim_compute_ecmp_hash(struct prefix *src, struct prefix *grp) { uint32_t hash_val; - uint32_t s = 0, g = 0; - if ((!src)) + if (!src) return 0; - switch (src->family) { - case AF_INET: { - s = src->u.prefix4.s_addr; - s = s == 0 ? 1 : s; - if (grp) - g = grp->u.prefix4.s_addr; - } break; - default: - break; - } - - hash_val = jhash_2words(g, s, 101); + hash_val = prefix_hash_key(src); + if (grp) + hash_val ^= prefix_hash_key(grp); return hash_val; } @@ -549,9 +539,9 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim, break; } - if (curr_route_valid - && !pim_if_connected_to_source(nexthop->interface, - src->u.prefix4)) { + if (curr_route_valid && + !pim_if_connected_to_source(nexthop->interface, + src_addr)) { nbr = pim_neighbor_find_prefix( nexthop->interface, &nexthop->mrib_nexthop_addr); @@ -668,7 +658,7 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim, nh_node->gate.ipv4; #else nexthop->mrib_nexthop_addr.u.prefix6 = - nh_node->gate->ipv6; + nh_node->gate.ipv6; #endif nexthop->mrib_metric_preference = pnc->distance; nexthop->mrib_route_metric = pnc->metric; |