🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26138

Re: [PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan

#26138
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 03:59
202 lines
15999 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

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

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] ip6erspan_tunnel_xmit() (net/ipv6/ip6_gre.c:1135-1139) now
  picks the Packet Too Big type with `if (payload_protocol ==…
- [Low] Switching the native-mode dispatch in ip6erspan_tunnel_xmit()
  (net/ipv6/ip6_gre.c:1090) from skb->protocol to payload_protocol sends…
- [Low] The subject says the change is 'in ip6erspan', but the
  ip6_tunnel.c hunk changes the shared ip6_tnl_xmit() MTU floor…
- [Low] The patch fixes misbehaviour that users can see in
  ip6erspan_tunnel_xmit(), and the commit message says it was confirmed…

--

ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan

With this patch, ip6erspan_tunnel_xmit() uses the payload_protocol from
ip6gre_xmit_classify() instead of skb->protocol for VLAN-tagged frames.
That value now picks the traffic class, flow label, ERSPAN truncation bit
and ICMP error type. The patch makes the same change to the minimum MTU
floor in ip6_tnl_xmit().

> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index d7d7fd4782001..698cf1cdd4ab6 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -1021,11 +1021,11 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
>  	}
>  
>  	nhoff = skb_network_offset(skb);
> -	if (skb->protocol == htons(ETH_P_IP) &&
> +	if (payload_protocol == htons(ETH_P_IP) &&
>  	    (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff))
>  		truncate = true;

[Severity: Low]
Should this patch carry a Fixes: tag?

The commit message says the behaviour was confirmed in a VM. Tagged
frames went out with outer traffic class 0. The ERSPAN T bit was not set
from the inner IP length. An oversized IPv4 packet behind a tag got an
ICMPv6 Packet Too Big built from its IPv4 header.

The first and previous patches in this series each have two Fixes: tags,
but this one has none. Without a tag, stable selection has nothing that
links this change to the classify patch it depends on.

>  
> -	if (skb->protocol == htons(ETH_P_IPV6)) {
> +	if (payload_protocol == htons(ETH_P_IPV6)) {
>  		int thoff;
>  

[ ... ]

> @@ -1087,7 +1087,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
>  			goto tx_err;
>  		}
>  	} else {
> -		switch (skb->protocol) {
> +		switch (payload_protocol) {
>  		case htons(ETH_P_IP):
>  			memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
>  			prepare_ip6gre_xmit_ipv4(skb, dev, &fl6,

[Severity: Low]
This switch now sends tagged IPv4/IPv6 frames through
prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(). Before, they
went to the default arm, which only copied t->fl.u.ip6. The commit
message lists the traffic class, flow label, T bit and ICMP type. Doesn't
this also change a few other things for tagged frames?

The encap limit is now applied unless IP6_TNL_F_IGN_ENCAP_LIMIT is set:

prepare_ip6gre_xmit_ipv4() {
	if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
		*encap_limit = t->parms.encap_limit;
	...
}

As a result, ip6_tnl_xmit() pushes the 8-byte tunnel encapsulation limit
destination option and lowers its mtu by 8. With the iproute2 default
encap limit of 4, tagged frames now carry an extra destination options
header on the wire.

fl6.flowi6_mark now becomes t->parms.fwmark or skb->mark. It used to
be 0.

A statically configured tclass, ip6_tclass(t->parms.flowinfo), now
reaches the outer header. Before, dsfield was 0.

Tagged IPv6 frames also get two new drop paths:

- the inner saddr equals t->parms.raddr
- the inner TEL option has encap_limit 0, in which case
  prepare_ip6gre_xmit_ipv6() also sends ICMPV6_PARAMPROB

Untagged ip6erspan traffic and tagged ip6gretap traffic already get all
of this, so the code itself looks fine. The previous patch listed its
side effects under "What changes for traffic that was not broken before".
Could this commit message mention these changes in the same way?

[ ... ]

> @@ -1132,7 +1132,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
>  	if (err != 0) {
>  		/* XXX: send ICMP error even if DF is not set. */
>  		if (err == -EMSGSIZE) {
> -			if (skb->protocol == htons(ETH_P_IP))
> +			if (payload_protocol == htons(ETH_P_IP))
>  				icmp_ndo_send(skb, ICMP_DEST_UNREACH,
>  					      ICMP_FRAG_NEEDED, htonl(mtu));
>  			else

[Severity: Medium]
Because of the catch-all else, every payload that is not IPv4 still gets
icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu). Is that intended?

Take a VLAN-tagged frame whose inner type is neither IPv4 nor IPv6, such
as MPLS, ARP or PPPoE behind a tag. ip6gre_xmit_classify() leaves
payload_protocol at the VLAN type and does not move the network header.
The comment on ip6gre_xmit_classify() says such frames are sent:

 * as it is, with the
 * network header left alone, and no field is taken from it.

icmp6_send() does not check the protocol. It reads the bytes at the
network header as an ipv6hdr, within the linear area, and sends the
Packet Too Big to hdr->saddr. Here hdr->saddr is just payload bytes. For
ICMPV6_PKT_TOOBIG, icmp6_send() also skips the multicast and
non-PACKET_HOST filter.

The mtu passed here can also be below IPV6_MIN_MTU. ip6_tnl_xmit()
clamps to IPV4_MIN_MTU when payload_protocol is not ETH_P_IPV6. For
example, the mtu can be around 1210-1218 when the outer path MTU is 1280.

The -EMSGSIZE check in ip6_tnl_xmit() does not depend on the protocol.
A large non-GSO tagged frame can therefore reach this path when the outer
path MTU is below the device MTU plus overhead.

For comparison, ip6gre_xmit_other() sends no ICMP for the same result,
and ipxip6_tnl_xmit() does nothing in its default case:

	case IPPROTO_IPV6:
		icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
		break;
	default:
		break;

Untagged non-IP payloads already behaved this way before the series.
Since this hunk makes the ICMP family follow the real payload, should the
else become else if (payload_protocol == htons(ETH_P_IPV6))?

> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index 868c49b97a8f9..8ccc90333c99e 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -1227,7 +1227,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
>  		max_headroom += 8;
>  		mtu -= 8;
>  	}
> -	mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ?
> +	mtu = max(mtu, payload_protocol == htons(ETH_P_IPV6) ?
>  		       IPV6_MIN_MTU : IPV4_MIN_MTU);

[Severity: Low]
The subject says "in ip6erspan", but every caller shares ip6_tnl_xmit().
Doesn't this hunk also change ip6gretap?

ip6gre_xmit_ipv6() already passes htons(ETH_P_IPV6) as payload_protocol
for VLAN-tagged IPv6 frames:

	err = __gre6_xmit(skb, dev, dsfield, &fl6, encap_limit,
			  &mtu, skb->protocol, htons(ETH_P_IPV6));

Before this patch, the floor for those frames came from the VLAN
skb->protocol, so it was IPV4_MIN_MTU. After it, the floor is
IPV6_MIN_MTU.

On ip6gretap, that changes when -EMSGSIZE and the ICMPv6 Packet Too Big
fire. It also changes the value passed to
skb_dst_update_pmtu_no_confirm().

For example, with an outer path MTU of 1280, a tagged IPv6 frame used to
get -EMSGSIZE at around 1218 bytes. Now it passes the check and the outer
IPv6 layer fragments it.

The new floor looks correct and matches untagged IPv6 on ip6gretap. Could
the commit message say that ip6gretap is affected too, given that it also
says the minimum MTU was not measured?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201005941.1536429-1-littlesmilingcloud%40gmail.com
Technical Details
Message-ID: <179627038087.3146.15958875713666581523@kernel.org>
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376277-linux-kernel-netdev=dewy.ru
References: <20261201005941.1536429-5-littlesmilingcloud@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376277-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind
 VLAN tags in ip6erspan
Date: Thu, 03 Dec 2026 03:59:40 +0000
Organization: Usenet Network
Message-ID: <179627038087.3146.15958875713666581523@kernel.org>
References: <20261201005941.1536429-5-littlesmilingcloud@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2136938"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:H+3PIjEX1qNsAVNGjTPsma9FdkE= sha256:RgfZceOd4vj5FQJ4bXWclAmPL99xtnHiQ9uVbAnG5oo=
	sha1:pfATQ7U09cKCpyi+eRM8+BVh8Fg= sha256:WrRgLY9MjDrKVQrH72GVj4qSgYzBgR5VZf1XlocoJ1k=
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 B838E117812; Thu,  3 Dec 2026 07:00:06 +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 XbCx7_qCgpi8;
	Thu,  3 Dec 2026 07:00:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376277-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 C1C2A1174ED; Thu,  3 Dec 2026 06:59:54 +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 DD5242B123; Thu,  3 Dec 2026 03:59:48 +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=1796270388;
	b=jGkIrORvFCt73D05IRSzP9CnKuGXgK7AZzD6a8aFaE8C/5rTiSsT0xb33yhzOyN11uZ3
	 8wSLeEYVoB8R7FIPfuVyBCcIOxHFd0F0o2GlFVNUlWt54JvCj4mYsozl4ZV7FA8Wt0h/V
	 gL/AVsEWwXeZZG2YuGJTKXT/tJWkprfLMdvbHmdikfZwpYvuwFpfU4E2rh5BlQwolbTPr
	 ecXKDup8XOxEN+KBbHTG9qbtAVp4S2DzRiozrq2YagDeYTagqdRf3npg71MwU/yHPyoja
	 vPrF7IXMM6oqVrbzHa9PovTVFCqftn5yxiswzdei+IXGCri8Kfb1YNjpmVpE99L9dYQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796270388;
	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=nJmjxv7P1zmLZLPqQKhJBD5QOZ5D+FIBSXoJcgbCH3s=;
	b=ab8P/WhyvmzjtYDlRGSS32M1D6en7lSWdVkwFRM9kAV39JICwz7Z4X+M/rA+ThQijwoa
	 F4GG9v00ZfCQv8+Jg8St8F+nwitxm+cEikAOHqXHy0z4vPVcnIhnfjP7bRz7hLDc4+MBa
	 shJMbnrhRTzbCgbrJh5dy42pA2iADyuBEfGo0y1LwU9c2WhXIFtxlSu/Rn7iFkuZ85gHT
	 50qZwBG69g7tmIft8q9PBYl6/ji1VhMMrvYMlRYOXykgAMMxayHk8vFJ0DjSmUO4lpL+S
	 Cr847MVn8JFdPnNsft42JPMPjjsKqhvGGj+dAfAmNCFZV2O9ptmQ7ymlWbXfbrbZNzw==
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=B4LbI2Rk;
	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 83E31606A32F;
	Thu,  3 Dec 2026 03:59:48 +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=B4LbI2Rk
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=1796270382;
	b=ophXvy9GHCaAqFSYybq0IlEAJQodMyL93piJzvnjGxQYzoN/ik3GhnVWODSsfmoVLM/s
	 UkYNLWPo2I4eCl/LB5e0kpvMaiLx0e1vDdGF5UnKIgq7khhv/gja7MZ4B9IoghT8sls0+
	 KlLLItYj+irMMDsVBbGU5GJcnUqk1ntvu2UjF+tSCJsQCJNTv1sREKCY4oV97pbeCbG9o
	 yF95Cji5KF4jGKrbWAx+n3AbfCw369rtVjExQg+ZuUlvRObNfGMiHKUAM+MdpV5wwu+RU
	 lzfk3hILrjySNwRbGF3dwlzHFLFlLZ3gLVynN80usPKGJgPD8RYNQS8G98f61dflscA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796270382;
	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=nJmjxv7P1zmLZLPqQKhJBD5QOZ5D+FIBSXoJcgbCH3s=;
	b=zEV4kY4nA1fEJF/4/iBBCZVk2w9a1+E4ZrGcaif8xxnmVevbM08h89HhKGxUgJTVRrjZ
	 O2G6GSVGb66zg0UZzYEw1YO6s39aimGy08SW4KgnchVWSOFaC8YXETcO8dn1DWfujlAPA
	 uE1NeDX4K04d2UM+U2wXz7zvqcWA0CqUXVeaYBAqkIdw8lDL14eLNL4bOxKyxuGz4aIgd
	 K8pAsT9n5PgiOF1Z8qFGy/FdWZLL3EiCNJUkhZsURRsr1YIvbZBSX387IM+mKReq9X3kr
	 G0HLQMAmqUMePVjdHu1IXdAVVEG4dmvnTutUaPIRkuxpvC57Q42+YQPvaGBzWkMAECQ==
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=B4LbI2Rk;
	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 A49AB606A33C;
	Thu,  3 Dec 2026 03:59:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8AC1F000C1;
	Thu,  3 Dec 2026 03:59:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796270382;
	bh=nJmjxv7P1zmLZLPqQKhJBD5QOZ5D+FIBSXoJcgbCH3s=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=B4LbI2RkBcI1t+dQzJb4rwdvePylEqKe7Ijbs3oqja9URyw29SZ/TptDY2Vx2546X
	 8PXUETWHZlYPoS46FLglGJzlBetsypdkKVYZ0KdnibuJ7597+ZRvEOGHO2xJ05ameh
	 kR9wAztzX2021iY6+1Iu5YtNFZTjfcP75XmupMe36+iqXXzjWf3a0kY5xUBjVbj6iQ
	 9O/WsZXzkrudBVJ5a5uDRrpCy4cWZsKrv9z86IpJZEnKgm9hMFvhzfqjlP8nqPdsup
	 sbCtfn60F7P1897Q/CUOpUssGRRBd2pqIdlTIz8csFY/telxs0UAHfjOldh1UCkSlN
	 o0OXWO4cpspiQ==
X-Cc: netdev@vger.kernel.org, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, davem@davemloft.net, horms@kernel.org, dsahern@kernel.org,
 willemb@google.com, idosch@nvidia.com, fw@strlen.de, u9012063@gmail.com,
 mvohra@vmware.com, matthias.may@westermo.com, mazin@getstate.dev,
 shuah@kernel.org, linux-kselftest@vger.kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261201005941.1536429-5-littlesmilingcloud@gmail.com>
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