Re: [PATCH net-next v6 03/12] amt: key relay tunnels on a union amt_addr endpoint
From: netdev-bot+sashiko
Date: Wed Dec 02 2026 - 23:33:44 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message's reason for the IPv6 per-source tunnel cap is
wrong, so the trade-off it describes is misjudged.
--
amt: key relay tunnels on a union amt_addr endpoint
This commit changes the relay tunnel key from a __be32 IPv4 address to a
union amt_addr, so that an IPv6 outer source can be stored and compared in
full. It replaces siphash_3u32() for the Update MAC with amt_relay_mac().
It also makes the per-source tunnel cap count an IPv6 /64 instead of a
single address, via amt_same_source().
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index e3c69ebf78f20..bfdce6897f7cd 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -187,6 +210,19 @@ static bool amt_addr_equal(union amt_addr *a, union amt_addr *b)
> return !memcmp(a, b, sizeof(union amt_addr));
> }
>
> +#define AMT_SRC_PREFIX6_LEN 8
> +
> +/* One source for the per-source tunnel cap: an IPv4 address or an IPv6
> + * /64, so that one host cannot reach the cap from each of its addresses.
> + */
> +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: Low]
Is the premise behind this grouping accurate? The commit message says:
"one host normally owns a /64 and could otherwise hold the cap from
each of its addresses"
A /64 is usually the size of one link, not one host. SLAAC gives every
host on a LAN an address from the same /64. Many cloud subnets and VPS
providers also put many hosts or customers in one /64.
On an IPv6 relay, all gateways in such a /64 would share a single cap
from amt_max_tunnels_per_src():
return clamp_t(u32, amt->max_tunnels / 8, 1,
AMT_MAX_TUNNELS_PER_SRC);
That cap can never go above 16, whatever max_tunnels is set to.
Once that many tunnels exist in the /64, amt_request_handler() stops
sending the Membership Query:
if (!have && (full || per_src >= amt_max_tunnels_per_src(amt)))
return true;
and amt_tunnel_get_or_create() refuses to create a tunnel:
if (amt->nr_tunnels >= amt->max_tunnels ||
per_src >= amt_max_tunnels_per_src(amt)) {
Would every later gateway on that link then get no service? It also
looks like one party in a shared /64 could use up the cap and lock out
its /64 neighbours. That can't happen for IPv4 hosts that have separate
public addresses.
The commit message does say "Gateways in one /64 share the cap", but it
treats this as the unusual case when it is probably the common one.
This patch can't reach the path yet, because amt_v6() is still false. The
behaviour stays the same once the later patch "amt: add netlink
attributes for an IPv6 outer transport" makes amt_v6() reachable.
Could the commit message rationale be corrected, or the /64 grouping be
reconsidered?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202043200.286260-1-omar%40blockcast.net