diff options
| author | Mark Stapp <mjs@voltanet.io> | 2021-07-02 07:52:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-02 07:52:22 -0400 |
| commit | 0a9fcd96d186bf2bbbb7a9148ced1eeadfbd5e03 (patch) | |
| tree | cc8582fd1ca1b095f1a917b8c5077ccc392cb114 /pbrd/pbr_zebra.c | |
| parent | 1e15822698cc62d0c30069688b5b2054acb21722 (diff) | |
| parent | 8643c2e5f7b5541f136a3dfff5abe5b537159442 (diff) | |
Merge pull request #8970 from ton31337/fix/use_IPV6_MAX_BITLEN
*: Do not use 32/128 numbers for prefixlen
Diffstat (limited to 'pbrd/pbr_zebra.c')
| -rw-r--r-- | pbrd/pbr_zebra.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index eb41bf6043..fc5303c9d8 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -286,11 +286,13 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg, api_nh->ifindex = nhop->ifindex; break; case NEXTHOP_TYPE_IPV6: - memcpy(&api_nh->gate.ipv6, &nhop->gate.ipv6, 16); + memcpy(&api_nh->gate.ipv6, &nhop->gate.ipv6, + IPV6_MAX_BYTELEN); break; case NEXTHOP_TYPE_IPV6_IFINDEX: api_nh->ifindex = nhop->ifindex; - memcpy(&api_nh->gate.ipv6, &nhop->gate.ipv6, 16); + memcpy(&api_nh->gate.ipv6, &nhop->gate.ipv6, + IPV6_MAX_BYTELEN); break; case NEXTHOP_TYPE_BLACKHOLE: api_nh->bh_type = nhop->bh_type; @@ -460,13 +462,13 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg) case NEXTHOP_TYPE_IPV4_IFINDEX: p.family = AF_INET; p.u.prefix4.s_addr = nhop->gate.ipv4.s_addr; - p.prefixlen = 32; + p.prefixlen = IPV4_MAX_BITLEN; break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: p.family = AF_INET6; - memcpy(&p.u.prefix6, &nhop->gate.ipv6, 16); - p.prefixlen = 128; + memcpy(&p.u.prefix6, &nhop->gate.ipv6, IPV6_MAX_BYTELEN); + p.prefixlen = IPV6_MAX_BITLEN; if (IN6_IS_ADDR_LINKLOCAL(&nhop->gate.ipv6)) /* * Don't bother tracking link locals, just track their |
