Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	shuah@kernel.org, horms@kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	willemb@google.com
Subject: Re: [PATCH net-next v5 03/12] amt: key relay tunnels on a union amt_addr endpoint
Date: Tue, 01 Dec 2026 06:46:18 +0000	[thread overview]
Message-ID: <179610757853.3146.12008456241680136082@kernel.org> (raw)
In-Reply-To: <20261130064249.1874523-4-omar@blockcast.net>

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

  reply	other threads:[~2026-12-01  6:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  6:42 [PATCH net-next v5 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko
2026-11-30  6:42 ` [PATCH net-next v5 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko [this message]
2026-11-30  6:42 ` [PATCH net-next v5 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 05/12] amt: forward multicast data " Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko
2026-11-30  6:42 ` [PATCH net-next v5 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 08/12] amt: receive " Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko
2026-11-30  6:42 ` [PATCH net-next v5 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-30  6:42 ` [PATCH net-next v5 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko
2026-11-30  6:42 ` [PATCH net-next v5 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-12-01  6:46   ` netdev-bot+sashiko
2026-11-30 17:27 ` [PATCH net-next v5 00/12] amt: add an IPv6 outer transport Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179610757853.3146.12008456241680136082@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=omar@blockcast.net \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox