๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26142

Re: [PATCH net-next v6 07/12] amt: send the AMT gateway control plane over IPv6

#26142
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 04:33
127 lines
12181 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] The new gateway IPv6 control path never counts transmit
  failures that happen after routing.

--

amt: send the AMT gateway control plane over IPv6

This commit lets an AMT gateway send its Discovery, Request and Membership
Update messages with an IPv6 outer header. Discovery and Request are built
on the stack and sent via amt_send_ctrl_v6(). The Membership Update goes
through amt_udp_xmit().

> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 79702b002d14f..40481b0f9d5ef 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c

[ ... ]

> @@ -824,10 +825,36 @@ static int amt_send_ctrl_v6(struct amt_dev *amt, const struct in6_addr *saddr,
>  			     ip6_dst_hoplimit(dst), 0, sport, dport, false, 0);
>  	err = 0;
>  out:
> -	rcu_read_unlock();
> +	rcu_read_unlock_bh();
>  	return err;
>  }
>
> +static void amt_send_discovery_v6(struct amt_dev *amt)
> +{
> +	struct amt_header_discovery amtd = {
> +		.type	= AMT_MSG_DISCOVERY,
> +		.nonce	= amt->nonce,
> +	};
> +
> +	if (!amt_send_ctrl_v6(amt, &amt->local_ipv6, &amt->discovery_ipv6,
> +			      amt->gw_port, amt->relay_port,
> +			      &amtd, sizeof(amtd)))
> +		amt_update_gw_status(amt, AMT_STATUS_SENT_DISCOVERY, true);
> +}
> +
> +/* The inner family @v6 sets the P bit, independent of the outer one. */
> +static void amt_send_request_v6(struct amt_dev *amt, bool v6)
> +{
> +	struct amt_header_request amtrh = {
> +		.type	= AMT_MSG_REQUEST,
> +		.p	= v6,
> +		.nonce	= amt->nonce,
> +	};
> +
> +	amt_send_ctrl_v6(amt, &amt->local_ipv6, &amt->remote_ipv6,
> +			 amt->gw_port, amt->relay_port, &amtrh, sizeof(amtrh));
> +}

[Severity: Medium]
Does the IPv6 Discovery and Request path stop counting tx_errors on
amt->dev when a send fails after routing?

amt_send_ctrl_v6() passes a NULL net_device to udp_tunnel6_xmit_skb() and
then sets err = 0 unconditionally:

	udp_tunnel6_xmit_skb(dst, sk, skb, NULL, saddr, daddr, AMT_TOS,
			     ip6_dst_hoplimit(dst), 0, sport, dport, false, 0);
	err = 0;

In ip6tunnel_xmit(), all of the error accounting sits behind a dev check.
That covers both the recursion-limit drop and the ip6_local_out() failure:

include/net/ip6_tunnel.h:ip6tunnel_xmit() {
    ...
	if (unlikely(dev_recursion_level() > IP_TUNNEL_RECURSION_LIMIT)) {
		if (dev) {
			...
			DEV_STATS_INC(dev, tx_errors);
		}
    ...
	err = ip6_local_out(skb_dst_dev_net(skb), sk, skb);

	if (dev) {
		if (unlikely(net_xmit_eval(err)))
			pkt_len = -1;
		iptunnel_xmit_stats(dev, pkt_len);
	}
    ...
}

So a Discovery or Request that netfilter drops, that fails in the
neighbour or xmit path, or that hits the recursion limit will not be
counted in amt->dev tx_errors.

The IPv4 code paths that these functions replace, amt_send_discovery() and
amt_send_request(), do count these failures:

	err = ip_local_out(amt->net, sk, skb);
	if (unlikely(net_xmit_eval(err)))
		DEV_STATS_INC(amt->dev, tx_errors);

The IPv6 Membership Update path in amt_udp_xmit() passes amt->dev to the
same udp_tunnel6_xmit_skb(). On one device, IPv6 Update failures are
counted but IPv6 Discovery/Request failures are not.

amt_v6() is always false at this commit. Later in the series, "amt: add
netlink attributes for an IPv6 outer transport" sets local_ipv6 from
IFLA_AMT_LOCAL_IP6, which makes this path reachable. The final state of the
series still passes NULL here.

Passing amt->dev directly would also add tx_packets and tx_bytes for
control messages, which the IPv4 control path does not count. Would it
make sense to count tx_errors in amt_send_ctrl_v6() itself, so that it
matches the IPv4 behaviour?

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202043200.286260-1-omar%40blockcast.net
Technical Details
Message-ID: <179627240022.3146.8274048803110548214@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376284-linux-kernel-netdev=dewy.ru
References: <20261202043200.286260-8-omar@blockcast.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376284-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v6 07/12] amt: send the AMT gateway control plane
 over IPv6
Date: Thu, 03 Dec 2026 04:33:20 +0000
Organization: Usenet Network
Message-ID: <179627240022.3146.8274048803110548214@kernel.org>
References: <20261202043200.286260-8-omar@blockcast.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2142624"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yWz2HmTEF6YCduLFr/sARytpLeg= sha256:88tuMVDBZwo8Cu8msP29u28/9P5qA5+Lx7+p8WmWiHg=
	sha1:FkMDUDmu/uB/84GLmufwHXTwpwQ= sha256:DBfY588DlnPDEUVPtuGbg2WpaTWDF8fKjSZnx+tlr/0=
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 98ADB117818; Thu,  3 Dec 2026 07:33:51 +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 qr8wE5VXUFQ8;
	Thu,  3 Dec 2026 07:33:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376284-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 E73F0117816; Thu,  3 Dec 2026 07:33:38 +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 085742A583; Thu,  3 Dec 2026 04:33:26 +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=1796272402;
	b=UaRzpQMrQDhLN7Lf8XpdG45lY5kwZU7DCz0SZwzEE1Pe0XWbg+gRIqwAGml+iCS/13G6
	 G6CeU47MNKW4/uanpWJzmv129XeGUL97HGYJ6dzkdwaCHcWIDzd0337HHpTq3EFonDg4r
	 J0Ua00sS8yUMkF3A6I/98NSnp/bm8NfxzIDHibPhoI2G3/Uc94AhmWTefdD5T9wi+n9GS
	 aDZXDS7A65Q7CHBS/KKAZ7J7P9Qj25mnBIHxAh7u65kNCsz7WQcJ8hNfknbg27iagSfHq
	 XQJUD8YfDvj5s55IxOzDQ85g8NylgLfQYqXgrBdphUtATu/a1CVmzc3l7P4MN6qv8FA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796272402;
	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=TdwXQjvijuoHz17ZUDzVPw/4SKV4Qkh2tNOXXHZcNrQ=;
	b=h71Hzv2gQFm1hNCv8rymnUPmNbAgh/S3mu1ri98BuOjZmTFmDmeQMLUujwh+ey+sUxHe
	 NIsohtZTCj1ukYsjv89JyXvQl6ICo3DGeRRUGBHTFQygh2g3S0n6aVTu78HsJ6Rz8LH1n
	 3Njw5CrAvYNXc3G5nCkqmcYIkOo3ecFOVFt8ZHP28VhRkSwGFR0IwElftKjaAwNWvJvBQ
	 173W86pm1gky+f2PSkAVVU4II6Xjg3IZckgefrqXEGB/LCMBoS6oVnDjfBzVxUnFG7/Zd
	 +rojuUA0BxNtnSYBbqDX/52IQvqSUBw2i/nS4ggYiY6R/PhWEhMsrrmLbOjoKAAwzlg==
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=PfdQ6YdB;
	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 998DE606A680;
	Thu,  3 Dec 2026 04:33:22 +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=PfdQ6YdB
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=1796272401;
	b=yI4c+S6rHvZY1eIuF6E1cP1CaO0jCLOLXugfyyJo2b0jn/yOpQ++9C9XdOtmEFUIOFnb
	 drxXzMnGmoigrsJNRcTz2Nx7Kvc7ZlqFqHNu62FBNt0W3giCsOHWuzdWtDo9g9JIj7mUS
	 PjdgCYMp0g0XNT1ogP4qqJfbMpuCN6K8WTjCoAZenkirI98oYTZst8a04YXVBUa6Tqn0o
	 uYRcrtMoe/0le7rVyV0MQLgwjTLOHpNfr9nyMJHIYQ8NYB4HW6qiOzMrdFGDuPizZVPxS
	 I7Zg27JjhywJQipETj/Wa08VZxFPpAdfre/xU4jkQl9RsgH5+WOlZaYVUp7csH0RJCQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796272401;
	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=TdwXQjvijuoHz17ZUDzVPw/4SKV4Qkh2tNOXXHZcNrQ=;
	b=mSSahwvnKHBeEKRJjOFkEn3pCv2CPqFhk2hAOJIe9PbqpTZnTPCYhxj0DmJDCFQ0JjyS
	 GKqFCzq+5ueTc+vvknaJhU84LmBYsAcbzBO3HwtgG8odlkkaz6XG7JhGhotyWVN98IAbn
	 ITIjy3TuoCSS+plWhi+5Uhizx8KZoBjMOe4d1DE3mBUk7N4H9rb7YK4KGf3G40qIJz5ov
	 sVOQ6k5U6c+Hn+X6+OUlHeEYPCyjriUbWjG2FY9YO/CbrMikHaSEzXBXWiBCfASDyehXf
	 PufmzIlRXdvAZFYaYQIpW8qYINjBIjE5W1W/AnSgYGfaVIiwookIQGNyP7lS+tDfGjw==
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=PfdQ6YdB;
	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 BC151606A6A4;
	Thu,  3 Dec 2026 04:33:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D5671F00926;
	Thu,  3 Dec 2026 04:33:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796272401;
	bh=TdwXQjvijuoHz17ZUDzVPw/4SKV4Qkh2tNOXXHZcNrQ=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=PfdQ6YdBV3VzGEJvbORIv5r5AdpyrM2GmgL81oOIWB9lZIiLJTayyIsb+inNKl0WX
	 8o8KJ1EVbz9CYVRhsemI51CbXDB86eiPams3vigA3aa5j1UO6Xqyh0OzMRUnQIcYm8
	 HRhpwnim1exf+E8ZDY2NxBqK3xWoTHigbS295+fpYRnCMuZuopD90kAaAB8yFtaKPN
	 sTlf8dCrpyHtkAULjRSFTqr0Hv0nHM1wY+0UfhJPzXbk3+9hpGxaEtqeQw+2kPDVHp
	 e4zqLRt4FFCHTR1k/fgSurIyU2oNfWzV6qO2IJvzVnV+eaFWJ5zd1EzdY0++RFxsMl
	 MokF036WQCfmQ==
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, dsahern@kernel.org,
 idosch@nvidia.com
X-In-Reply-To: <20261202043200.286260-8-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