🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23214

Re: [PATCH net-next v2 05/12] amt: forward multicast data over IPv6

#23214
From: netdev-bot+sashiko
Date: Thu, 26 Nov 2026 19:16
151 lines
13572 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] When the outer transport is IPv6, amt_tmtu_exceeded()
  (drivers/net/amt.c:1255) checks a GSO inner IPv6 packet with…
- [Low] amt_tmtu() (drivers/net/amt.c:1246) computes dst_mtu(dst) -
  sizeof(struct ipv6hdr) - sizeof(struct udphdr) - sizeof(struct…

--

amt: forward multicast data over IPv6

This patch lets an IPv6 relay send Multicast Data by routing the copy
through amt_udp_xmit() for either outer family. Over IPv6 it routes
first and drops a payload that exceeds the route MTU less the outer
headers. It then sends one Packet Too Big to the source after it has
walked all tunnels.

> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 7e8219a0cdf9e..823367e8232bb 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
> @@ -1237,26 +1237,51 @@ static void amt_req_work(struct work_struct *work)
>  				 msecs_to_jiffies(100));
>  }
>
> +/* RFC 7450 s5.3.3.6: a Multicast Data message sent over IPv6 must not
> + * carry a Fragment header, so a payload larger than the tunnel MTU is
> + * dropped, and an IPv6 source is sent a Packet Too Big. An IPv4 source is
> + * not told, as icmp_send() never answers a multicast datagram. The tunnel
> + * MTU follows the route's path MTU, as on every IPv6 UDP tunnel.
> + */
> +static u32 amt_tmtu(const struct dst_entry *dst)
> +{
> +	return dst_mtu(dst) - sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
> +	       sizeof(struct amt_header_mcast_data);
> +}

[Severity: Low]
Can this u32 subtraction wrap when dst_mtu(dst) is below 50?

ip6_dst_mtu_maybe_forward() returns the raw RTAX_MTU metric when one is
set, and ip_metrics_convert() only clamps RTAX_MTU from above. So an
admin route with something like "mtu 40" is accepted. A large lwtunnel
headroom (for example seg6 with a big SRH) can also push dst_mtu() below
the 50 byte overhead.

In that case tmtu becomes roughly 4G, and amt_tmtu_exceeded() never
fires in amt_send_multicast_data():

	tmtu = amt_tmtu(dst);
	if (amt_tmtu_exceeded(oskb, tmtu)) {

The copy is still dropped later in the IPv6 output path. Because the
patch already leaves out tunnel MTUs below IPV6_MIN_MTU, no Packet Too
Big to the source is lost. However, an skb copy is still made and
pushed through IPv6 output per tunnel per packet. An ICMPv6 Packet Too
Big is generated toward the relay's own address, and tx_dropped is not
counted on the amt device.

Should amt_tmtu() clamp at zero, or should amt_send_multicast_data()
treat a dst_mtu() smaller than the overhead as exceeded?

> +
> +/* True if @skb, the inner packet before encapsulation, or any segment of
> + * it, is larger than @tmtu.
> + */
> +static bool amt_tmtu_exceeded(const struct sk_buff *skb, u32 tmtu)
> +{
> +	if (skb_is_gso(skb))
> +		return !skb_gso_validate_network_len(skb, tmtu);
> +	return skb->len > tmtu;
> +}

[Severity: Medium]
Is the transport header reliable at this point for an inner IPv6 GSO
skb that carries extension headers?

skb_gso_validate_network_len() computes the per-segment length as
(skb_transport_header - skb_network_header) plus
skb_gso_transport_seglen(). Earlier, amt_dev_xmit() calls
ipv6_mc_check_mld(), and ipv6_mc_check_ip6hdr() always resets the
transport header to just past the fixed IPv6 header:

net/ipv6/mcast_snoop.c:ipv6_mc_check_ip6hdr() {
    ...
	skb_set_transport_header(skb, offset);
    ...
}

ipv6_mc_check_exthdrs() then returns -ENOMSG for a non-MLD packet before
it corrects the offset:

	if (ip6h->nexthdr != IPPROTO_HOPOPTS)
		return -ENOMSG;
    ...
	if (nexthdr != IPPROTO_ICMPV6)
		return -ENOMSG;

	if (!skb_set_transport_header_careful(skb, offset))

So for every IPv6 data packet the transport header stays at nh+40, even
when Hop-by-Hop or Destination Options headers come before UDP.

For an SKB_GSO_UDP_L4 skb with such headers, the computed segment length
is short by the length of those extension headers. A segment that is
larger than tmtu by up to that amount passes this check. In that case
*ptb is not lowered, no Packet Too Big reaches the source, and the copy
is encapsulated.

skb_reset_inner_headers() in amt_send_multicast_data() then copies the
same offset into inner_transport_header. The outer
ip6_finish_output_gso() validation would also under-count, so the
oversized segments go out on a path whose route MTU cannot carry them.

This seems to contradict this part of the commit message:

    The device offers software GSO, so a GSO skb is checked
    per segment with skb_gso_validate_network_len(), before the tunnel
    offloads are set up. A payload that does not fit is dropped.

Would it make sense to locate the real upper-layer offset (for example
with ipv6_skip_exthdr()) before validating, or to fix up the transport
header in amt_dev_xmit() for data packets?

[ ... ]

> @@ -1575,8 +1617,10 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev)
>  			}
>  			continue;
>  found:
> -			amt_send_multicast_data(amt, skb, tunnel, v6);
> +			amt_send_multicast_data(amt, skb, tunnel, v6, &ptb);
>  		}
> +		if (ptb && v6)
> +			icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, ptb);
>  	}
>
>  	dev_kfree_skb(skb);

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125191450.2497936-1-omar%40blockcast.net
Technical Details
Message-ID: <179572061952.3135.14503580379845323397@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-372293-linux-kernel-netdev=dewy.ru
References: <20261125191450.2497936-6-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-372293-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 05/12] amt: forward multicast data over IPv6
Date: Thu, 26 Nov 2026 19:16:59 +0000
Organization: Usenet Network
Message-ID: <179572061952.3135.14503580379845323397@kernel.org>
References: <20261125191450.2497936-6-omar@blockcast.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="542424"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:S8TQF7agad9Hw9JyZzOm9+jCwXA= sha256:1xHn6iL1RtyXcghN4sH8OYsNlXWc+NIqKOgJhWzTgBA=
	sha1:VCIFQU3xAxuReQR0hHj6lpjIrS8= sha256:Sf8L6vVs9cFp5VW2UKjQ6EohMym0S8B6cIvl3h2RJK0=
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 71086125EF5; Thu, 26 Nov 2026 22:17:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 42YYVhWikHbv;
	Thu, 26 Nov 2026 22:17:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372293-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 13093125EF8; Thu, 26 Nov 2026 22:17:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 1E4A931D32; Thu, 26 Nov 2026 19:17:06 +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=1795720622;
	b=P0SxY4g2zERQLRW3dNlUgk278dxLeH92ryQ5yPM0ERoUlcl2ViIDWtMzMslWaT2t/FRz
	 gjKOPrb0TLDlC49WjtrMR+utJN2sP55UHqpxPHVScic9c79Nj8UZOzvuNUATbqIr3idQJ
	 gXYBxZgB7blrNaRGxBYDO7EOGdEKG+PjeEY1CBksgeWZdUGFVguIHH9X3us9CHZmPNd8n
	 fq1aHLm7HYpQihOSfITyHKoAZIaYXMMRRpN+KWpyqMBVk9BYdOZqSD5OU1k9V0NZNviuT
	 DfUKAmjRUL4iy5C9nfThKsZv1xdZ19Xw75OPYE9tt36D6nMXPtV1315qwt4LzVoFUMw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795720622;
	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=QC9DfUnNWJVMnUf2ONDNYFI/o23hdAko+A6GsVR1Eek=;
	b=juLo4fhbnMCVQe2w2cpEGBI2l3DMRkW38TMaieSTSGk0K4s4RA5uiW+gMi9PRVj5NVZN
	 pJhruBiXcudzXBGFkXlsW6WNzZq3T6Y0j616ToeJWi2bKov8FDySBN97IInV3uQgk2IeG
	 /WFLzUuTxXr35BlyartEYaGpHxBkirnWPADKcInD8IRvUXWqb/IQaMbz9mb2Kx71TaKZW
	 qho+DSt14UlZqLCu7SPvmoElrVLJb3NpDu6snSrCBCEOvCKHMXHTsaYB8uwMRcYiR6FwM
	 cneGAqd+JBiBpJgGMV/HbP4fr/1bav5Q8a/2viOTMl8sEG/S4y3td2vcAm97dmCpW2w==
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=Rzv+FSSh;
	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 05E58606A69A;
	Thu, 26 Nov 2026 19:17:02 +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=Rzv+FSSh
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=1795720621;
	b=U46RpbSguDJiHOgooONq5dlqQa2CFRjXRSioT6kSnQKlVGHlpf17wQVVNmbE9wpKXmY+
	 X7yWpRQT2cR09uPG7LEeWPSVYS7GtDxW6u2Nfgi+gA3Q0xlFgyVFh/09QAQiY0gUdbN7D
	 +5pdMgN6/lIhP4jrMVhBXPSo/ulMW+qCwc9tbfZKa/TzsY4pz6SQBza7HmlV92oj6/1Ox
	 3Op5JLg6KBNAIL6nTiN2QXL514NKQ7fWbk527HngS4nAQ4U46RpMAYYIziYeKyo1EcEPw
	 YxsfIlFUJFo0TVWKwbZ0gCPNh+ax5XiENz9xGZ9nz2+Mso1jojMbNP68+dazfKXdnYQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795720621;
	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=QC9DfUnNWJVMnUf2ONDNYFI/o23hdAko+A6GsVR1Eek=;
	b=AevqYkU/Pot+ADPxnrBVdwtyRQ8GyDWMYfx2cv+FFGS55O55wXgikKMugg0Y3gIkl3V3
	 tv79gkCi+m6vjH0W+BbpljMyIWIdF0avjvuf/5FZ9vPl1pT896b9Ck173sL73GMUU7NtX
	 dVnlU1eQ9aDJYRuZh0j4kfHsyOU3oIxnLUQNi3DtFlcjXWjBNqWf57B3My9akvvuN5f3B
	 Q3GLGhOISLIDYcC4ykvV99xoEj/ge7MCSVsTUAwD/08PAQjvj7dlFUNFyJi+BsO+bR9ht
	 RxDF/qTYI13IMM7y9jojcEyh0CUY6rH3NYtskIxCiZcy8ynEG3lQRlsw7pBmrogI5VA==
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=Rzv+FSSh;
	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 27865606A32A;
	Thu, 26 Nov 2026 19:17:00 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04FAA1F0093C;
	Thu, 26 Nov 2026 19:16:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795720620;
	bh=QC9DfUnNWJVMnUf2ONDNYFI/o23hdAko+A6GsVR1Eek=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Rzv+FSShHeqQWihtE2UmvqeWgncDIRGoEaFlpg6SmxxE9O21lI7f6PXJ4Ig7KE6a3
	 eNbh7EyN0IRSHcXUm0Ly9M6AqPCkSwUnlTWSselPzB+zfCgC5xoZzMXV6+AgXlIyMj
	 XjT535nrKK8IaVkcL6x3QIZN0obby2Lt/erxl6IZq9wz4N/vg60i9Rlo4qZj2obsrQ
	 IWQeICyp19zLtKM1Ts3EHqrr9uXrMqkZsmmRyWryMWjUuRU4aMorkwA0Sk+1hnvUzP
	 ek6Gjlo08cn0bg1r++4vK64kpJXqZ1ZMNEacyHVNkWroMzJ90AO3YsU4heUTJMt68z
	 cdDct9esxmuEA==
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
X-In-Reply-To: <20261125191450.2497936-6-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