Re: [PATCH net-next v5 03/12] amt: key relay tunnels on a union amt_addr endpoint
From: netdev-bot+sashiko
Date: Tue Dec 01 2026 - 01:46:30 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] For an IPv6 relay, the per-source tunnel cap treats each /64
as one source.
--
amt: key relay tunnels on a union amt_addr endpoint
This commit stores the relay's tunnel endpoint as a union amt_addr
instead of a __be32, so the field can hold an IPv6 outer source. It
switches the Membership Update MAC to a single siphash() over the packed
{address, port, nonce} tuple. It also makes the per-source tunnel cap
treat an IPv6 /64 as one source.
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 52ccaca08b5ec..386dec11acc62 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -189,6 +215,23 @@ static bool amt_addr_equal(union amt_addr *a, union amt_addr *b)
> return !memcmp(a, b, sizeof(union amt_addr));
> }
>
> +/* Bytes of an IPv6 source that make up its /64. */
> +#define AMT_SRC_PREFIX6_LEN 8
> +
> +/* Whether @a and @b are one source for the per-source tunnel cap. An IPv6
> + * host normally owns a whole /64, so counting per address would let it
> + * reach the cap from each of its addresses and fill the table; the cap
> + * therefore counts per /64. For IPv4 a source is an address. Tunnels
> + * themselves are still found by their full endpoint.
> + */
> +static bool amt_same_source(const struct amt_dev *amt,
> + const union amt_addr *a, const union amt_addr *b)
> +{
> + if (amt_v6(amt))
> + return !memcmp(&a->ip6, &b->ip6, AMT_SRC_PREFIX6_LEN);
> + return a->ip4 == b->ip4;
> +}
[Severity: Medium]
With the cap counted per /64, can a single IPv6 subscriber still fill the
relay's tunnel table?
The commit message says a per-address count "would let it open the cap's
worth of tunnels from each of its addresses and keep the table full".
The same reasoning seems to apply one level up. End sites are usually
delegated a /56 or /48, and residential DHCPv6-PD often hands out a /56
or /60. That gives one party between 16 and 65536 distinct /64 sources.
amt_max_tunnels_per_src() is:
return clamp_t(u32, amt->max_tunnels / 8, 1,
AMT_MAX_TUNNELS_PER_SRC);
With the default AMT_MAX_TUNNELS of 128 this is 16, so eight /64s are
enough to reach max_tunnels. To get a valid MAC for an endpoint, the
attacker only has to receive the Membership Query at that address. Anyone
who holds a routed prefix can do that:
amt_request_handler() per_src counted only within one /64,
Query sent with MAC
amt_update_handler() amt_relay_mac() verified
-> amt_update_tunnel()
-> amt_tunnel_get_or_create() tunnel created
When the table is full, amt_request_handler() withholds the Query, and
amt_tunnel_get_or_create() returns NULL for new legitimate gateways. On
IPv4 the same attack needs eight separate public addresses.
This path can't be reached at this commit because amt_v6() is always
false. It becomes reachable once IFLA_AMT_LOCAL_IP6 is added in "amt:
add netlink attributes for an IPv6 outer transport", and the per-/64
policy is still the same there.
The commit message covers the cost in the other direction: gateways that
share a /64, including all of fe80::/64, share one cap of at most 16. It
doesn't mention this case.
Would a shorter prefix, or an extra cap at a shorter prefix, fit the
stated rationale better? If not, could the commit message at least
describe this limitation?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130064249.1874523-1-omar%40blockcast.net