🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24361

Re: [PATCH net-next v4 02/12] amt: send the Relay Advertisement over IPv6

#24361
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 03:48
123 lines
12561 bytes
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] In the new IPv6 Discovery path of amt_discovery_handler()
  (drivers/net/amt.c), the only filters are a multicast outer…

--

amt: send the Relay Advertisement over IPv6

This patch adds the 24-byte IPv6 form of the Relay Advertisement and a
new amt_send_ctrl_v6() helper, which routes through amt_route6() and
sends with udp_tunnel6_xmit_skb(). On an IPv6 device,
amt_discovery_handler() now answers a Discovery with this form. The
reply is sourced from the Discovery's outer destination and sent back
to its outer source and UDP source port.

> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 3f3205d2df3e8..52ccaca08b5ec 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c

[ ... ]

> @@ -3026,6 +3118,29 @@ static bool amt_discovery_handler(struct amt_dev *amt, struct sk_buff *skb)
>  	if (amtd->reserved || amtd->version)
>  		return true;
>  
> +	/* The Advertisement takes the form of the outer IP version, and
> +	 * RFC 7450 s5.1.2 sources it from the address the Discovery was
> +	 * sent to, which may be an anycast Relay Discovery Address rather
> +	 * than local_ipv6.
> +	 */
> +	if (amt_v6(amt)) {
> +		struct in6_addr saddr = ipv6_hdr(skb)->saddr;
> +		struct in6_addr daddr = ipv6_hdr(skb)->daddr;
> +
> +		/* The socket bound to :: also receives a Discovery sent to
> +		 * a group, and a multicast address can never be a source
> +		 * (RFC 4291 s2.7), so such a Discovery is not answered. Nor
> +		 * is one from ::, which has nowhere to be sent.
> +		 */
> +		if (ipv6_addr_is_multicast(&daddr) ||
> +		    ipv6_addr_any(&saddr))
> +			return true;
> +
> +		amt_send_advertisement_v6(amt, amtd->nonce, &daddr, &saddr,
> +					  udph->source);

[Severity: Medium]
Will a Discovery whose outer IPv6 source is one of the relay's own
addresses still be answered here? The only filters are a multicast
destination and a :: source. The outer saddr and udph->source then
become the destination address and port of the reply.

A remote sender that can forge the source address (on the same link, or
on a path without BCP38) could send a Discovery to relay_port. It would
set the source to local_ipv6 or the link-local address of stream_dev
(for example with saddr == daddr), pick a UDP source port P, and choose
the nonce. The reply would then take this path:

amt_discovery_handler()
  amt_send_advertisement_v6(amt, nonce, &daddr, &saddr, udph->source)
    amt_send_ctrl_v6()
      amt_route6()
        ip6_dst_lookup_flow()    <- local route for a stream_dev address
      udp_tunnel6_xmit_skb()     <- delivered back to the host over lo

The host would send itself a 24-byte datagram from
<local addr>:relay_port to <local addr>:P. The 4-byte nonce in it is
chosen by the sender. The datagram arrives with iif=lo, so common rules
such as "-i lo -j ACCEPT" (ufw and firewalld defaults) would let it
through. It could then reach local UDP services bound to :: or to that
address, which the sender cannot reach directly.

The IPv6 input path doesn't seem to stop this. It only rejects loopback
and multicast sources:

net/ipv6/ip6_input.c:ip6_rcv_core() {
    ...
	if ((ipv6_addr_loopback(&hdr->saddr) ||
	     ipv6_addr_loopback(&hdr->daddr)) &&
	    !(dev->flags & IFF_LOOPBACK) &&
	    !netif_is_l3_master(dev))
		goto err;
    ...
	if (ipv6_addr_is_multicast(&hdr->saddr))
		goto err;
    ...
}

On IPv4, fib_validate_source() treats a local source as martian by
default (accept_local=0). That is why the existing
amt_send_advertisement() path is not exposed in the same way.

amt_discovery_handler() and amt_rcv() still have only these checks at
the end of the series. The path becomes reachable once "amt: add
netlink attributes for an IPv6 outer transport" allows an IPv6 outer
address to be configured.

Would it make sense to drop a Discovery whose outer source is a local
address, for example with ipv6_chk_addr(amt->net, &saddr, NULL, 0) or a
check on the route type? At minimum, could a Discovery with saddr equal
to daddr be dropped?

> +		return false;
> +	}
> +
>  	amt_send_advertisement(amt, amtd->nonce, iph->saddr, udph->source);
>  
>  	return false;

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129034652.1853485-1-omar%40blockcast.net
Technical Details
Message-ID: <179601051051.3146.13369414407667117379@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373830-linux-kernel-netdev=dewy.ru
References: <20261129034652.1853485-3-omar@blockcast.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373830-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 02/12] amt: send the Relay Advertisement over IPv6
Date: Mon, 30 Nov 2026 03:48:30 +0000
Organization: Usenet Network
Message-ID: <179601051051.3146.13369414407667117379@kernel.org>
References: <20261129034652.1853485-3-omar@blockcast.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1325164"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FbBpJjDrikL+hTkLnvJCtVdoYRM= sha256:Jk/F5sQHJWU2tWTjlhIR1adoCMUfeCv9rbGE7XPpoYs=
	sha1:Gq8To0pJUjKiymJc/Co17aGi7Es= sha256:WK/CXPohvw1+iWFwpQTxI9X/6E5a+yhUs14lcLACZn0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AF831125FBE; Mon, 30 Nov 2026 06:49:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id nFpB2N07dt-E;
	Mon, 30 Nov 2026 06:49:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373830-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id EE745125D6D; Mon, 30 Nov 2026 06:48:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B05E92939A; Mon, 30 Nov 2026 03:48:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796010513;
	b=ClY8f4+3LUYe/4Zqhdo4zzvuymalAHmPKS5oboQcfBGXxsvnDGhMNP72774nMX6x75P/
	 eTm9P6OuIMKxWsHyd+TKogmu0pzNFymCJekstDfzZnqgOqsiISlzqZJQDbTjfgmiTpZ7O
	 08TMq25rQu2TRp7/L4sY133VAUcuVLVYAWTlvB6ZLWYMwLo3H4ArXnolHdyM0aPQz4T03
	 Vx+y4A94OesfH9iJKinKP/Nk1XRrIQBMhlY+GVkNHgyydl6VqA7akvpVO7o38VqJtAuxL
	 lXKFNizsNUpBVI95DkeEjuy/sg4pY9yBbVbO0eCntE6gm0T9OPYq8+r/jSXn3oskScA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796010513;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=34Fp4qx4ji5y+XfrHFyf+oWgy8IowAkeTf1HOP+pFmU=;
	b=o7vgG99R5HAzy1NQgPbsBRJ3aqk9sCy3tUrQAI5f7vAC1nmNvQfRMCkN7IgjCune2vng
	 fVR7BcyUXr0oJ0JwveR9r/EKS6lGMa4BUWu6+PT4ASIJGDizCMUS+eNxSV16RyEOWna7O
	 zuZFV22Y8/YL/WS1RRzwmlndH+hHLI/VIwRmJGgAplYzzuKFu9i7VmW4WpDQ1jXfpET9E
	 5DxoIBcUqJxRXJrzEu+NycGVTbo/7H2i+dQo0BRKJkU8WHXo6/mX5j0yHKabxcl1TsaGC
	 aqlHtL5U9hIqWrwuuX4HbXd8ovaoZOwEn2T4flaGx72dzODtK4IhQ1qF3f9G/FmgvHg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YHMlEzac;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E97A606A681;
	Mon, 30 Nov 2026 03:48:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YHMlEzac
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796010512;
	b=p9BaoOuBPXznKAjIsijuFobj6gnDqBLCcz0AkW8MlKRO0YSsG5MMiZImNJcCHL48FIkc
	 MwY0YBU3et2vLdadDAprJUyZepzXDQBxJfR4RVey6V/US7/5+NgqoJRays9VMwk9+TFor
	 t9g6qf2C0ZNRDXdJAke0D0nquRocROcS1g3sap1X8EDvTgH1B6q03l4Ag18zI3r5j8xo9
	 sflG/PxDpuIxZzC8LWKIYo/SY9nrIo25AxYNwlCGHroNQiMiOaQw1CRH+ZbgNOCAiiY0O
	 GtkEyCHPeiQUAHeCFWaczyd1ezHnndSIvZpT8GsWqdZbXnQPLcLAKMwVyS3Cdbqgw1A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796010512;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=34Fp4qx4ji5y+XfrHFyf+oWgy8IowAkeTf1HOP+pFmU=;
	b=FoeeubrhPNT9ITbEEK1qoCWHyd1+/T0sEU5NacL2Q4rBY9quuQcoyOBj3AbtzeYgDQ4k
	 ZsOLRfPN0d2nbO92eA1greLcOM86ZT+9+jYcVmfQDQATFf6FMJJ2EN2eb2LiBzMt10imG
	 p1jv5T7jt8oa0eXvkt3cE7LSEUCCDeq0bJlkxYfaR/dbErwBmOVejUxyB3n3+J8XO7zPz
	 hQAA4UcZRGT6F0R4NhMucnbGhsajciPawpR/sXRMuLjEKsRrC+xjyZoiAcL46dpW/BF0n
	 pPiqzH3DaJtVLSHll6095wiUDRLKRrh/DRBgnTf4hR5pMMaD0PpEI0U3Pw6ME/bpLGw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YHMlEzac;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30574606A325;
	Mon, 30 Nov 2026 03:48:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A9A1F00924;
	Mon, 30 Nov 2026 03:48:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796010511;
	bh=34Fp4qx4ji5y+XfrHFyf+oWgy8IowAkeTf1HOP+pFmU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=YHMlEzac2yNiw/aqyJNv6oFoHx631CD6COXujzkSMuNqQPpat+sUR0SmuFjFg5pWg
	 YlmFgJ6+f81wl0pDE+MDxAVBUGhg/Bh+X4kJ2+20FRl+0LNMYvOknuGY1+G4M3Jh8p
	 io5asFa4LZquvcSoRXFSlXKid3jY7qGAIPcI0uq7XQYaP8r4nTZwUAR7ImJwoa3n3I
	 o5FbP9D8ew6rGSxvW1pUh0GvJsmN0lLd9LLnpwbrMCQR9EZgafltRTtfg/LxmJnk90
	 JK1nE6eyXRTMeZjIC0GAe8XX92TMXw6vSewH+a3wwjW6peB7lDzHahX3NDEfwYu5Kt
	 dIk34zt2PwrMQ==
X-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
X-In-Reply-To: <20261129034652.1853485-3-omar@blockcast.net>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list