Article View: linux.kernel.netdev
Article #26377Re: [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 12:39
Date: Thu, 03 Dec 2026 12:39
181 lines
15075 bytes
15075 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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 advertised MTU on the -EMSGSIZE path is too large for
ip6erspan, and this patch now sends it to VLAN-tagged IPv4 senders as…
- [Low] The commit message does not mention several behaviour changes the
patch makes.
- [Low] The patch fixes user-visible bugs in ip6erspan_tunnel_xmit() but
has no Fixes: tag.
--
ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
This patch makes ip6erspan_tunnel_xmit() and ip6_tnl_xmit() use the
payload protocol classified on tunnel entry instead of skb->protocol. With
this, VLAN-tagged IPv4/IPv6 frames get traffic class inheritance, length
checks and the matching ICMP error. On -EMSGSIZE, non-IP payloads no
longer go down the ICMPv6 error path.
> ip6erspan_tunnel_xmit() uses skb->protocol to select the inner header
> for traffic class and flow label inheritance, length checks and ICMP
> errors. ip6_tnl_xmit() uses it to select the minimum MTU. When the
> protocol is a VLAN EtherType, a tagged IPv4 packet can lose its traffic
> class and take the ICMPv6 error path on -EMSGSIZE.
[ ... ]
> Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
[Severity: Low]
Should this patch have a Fixes: tag?
Users can see both behaviours fixed here:
- On native ip6erspan, tagged IPv4/IPv6 lost traffic class and flow
label inheritance because the switch fell into the default branch.
- On -EMSGSIZE, every non-IPv4 payload (ARP, or IPv4 behind a tag) went
to icmpv6_ndo_send() through the unconditional else.
Both go back to the original ip6erspan native and collect_md support.
This patch also depends on payload_protocol, which comes from the
previous patch in the series, "ip6_gre: classify the inner packet once
on transmit". That patch does carry Fixes: tags.
Without a tag here, could stable tooling pick up the prerequisite but
miss this follow-up? That would leave ip6erspan only partly fixed in
stable trees.
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index c413e47c6ceb0..0ecee2271bbd1 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
[ ... ]
> @@ -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) {
[Severity: Low]
This isn't a bug, but should the commit message describe the other
behaviour changes for tagged frames on native ip6erspan?
With switch (payload_protocol), VLAN-tagged IPv4/IPv6 frames now go
through prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(). They
used to take the default branch, which left encap_limit at -1:
default:
memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
break;
For tagged traffic this means:
- encap_limit now comes from t->parms.encap_limit unless
IP6_TNL_F_IGN_ENCAP_LIMIT is set. Unset is the default, because
ip6gre_netlink_parms() zeroes the flags. ip6_tnl_xmit() then lowers
mtu by 8 and pushes an 8-byte Tunnel Encapsulation Limit destination
option, so the packets on the wire change.
- With IP6_TNL_F_USE_ORIG_FWMARK, the outer route lookup now uses
skb->mark.
- Tagged IPv6 frames whose source equals t->parms.raddr are now dropped.
- Tagged IPv6 frames that carry an encap limit option of 0 are now
dropped, and an ICMPv6 Parameter Problem is sent.
The subject mentions only ip6erspan, but the floor change in
ip6_tnl_xmit() also affects ip6gretap. ip6gre_xmit_ipv6() passes
ETH_P_IPV6 as payload_protocol for tagged IPv6:
err = __gre6_xmit(skb, dev, dsfield, &fl6, encap_limit,
&mtu, skb->protocol, htons(ETH_P_IPV6));
So tagged IPv6 on ip6gretap now gets the IPV6_MIN_MTU floor instead of
IPV4_MIN_MTU.
Untagged traffic already behaves this way, so these changes are probably
intended. The previous patch in the series, "ip6_gre: classify the inner
packet once on transmit", has a "What changes for traffic that was not
broken before" section. Could this patch have a similar one?
> case htons(ETH_P_IP):
> memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
> prepare_ip6gre_xmit_ipv4(skb, dev, &fl6,
> @@ -1132,10 +1132,10 @@ 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
> + else if (payload_protocol == htons(ETH_P_IPV6))
> icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
[Severity: Medium]
Is the mtu reported here small enough for ip6erspan? VLAN-tagged IPv4
senders now receive it too.
In ip6_tnl_xmit(), the only tunnel header subtracted from the advertised
value is the GRE header, via t->tun_hlen:
mtu = dst6_mtu(dst) - eth_hlen - psh_hlen - t->tun_hlen;
...
if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) {
*pmtu = mtu;
err = -EMSGSIZE;
ip6erspan_calc_hlen() sets tun_hlen to 8 and counts the ERSPAN header
only in t->hlen:
tunnel->tun_hlen = 8;
tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
erspan_hdr_len(tunnel->parms.erspan_ver);
By the time ip6_tnl_xmit() runs, ip6erspan_tunnel_xmit() has already
pushed the ERSPAN and GRE headers. ip6gre_xmit_classify() has also put
the network header behind the tags, at depth = ETH_HLEN + 4 * n_tags.
So the length check passes only when the inner IP length is at most
mtu - erspan_hdr_len - 4 * n_tags. Yet icmp_ndo_send() and
icmpv6_ndo_send() advertise mtu itself, and
skb_dst_update_pmtu_no_confirm() caches that same value on the inner
route.
A sender that honours this Frag Needed or Packet Too Big would shrink
its packets to mtu, get rejected again with the same mtu, and never
converge. Wouldn't packets in the window
(mtu - erspan_hdr_len - 4 * n_tags, mtu] be black-holed?
The test result in the commit message looks like an example of this:
"Each error quoted the original Echo Request and advertised MTU 1338."
With that path MTU, the largest inner packet that passes the check seems
to be 1330 bytes for v1 without a tag, and 1326 bytes for v1 with one
802.1Q tag.
The ERSPAN header part already affected untagged traffic before this
patch. The tag bytes part is new exposure for tagged IPv4 on ip6erspan.
> }
>
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202123613.1708463-1-littlesmilingcloud%40gmail.com
Technical Details
Message-ID:
<179630154270.3146.6100860750270294903@kernel.org>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!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-376603-linux-kernel-netdev=dewy.ruReferences:
<20261202123613.1708463-5-littlesmilingcloud@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!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-376603-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan Date: Thu, 03 Dec 2026 12:39:02 +0000 Organization: Usenet Network Message-ID: <179630154270.3146.6100860750270294903@kernel.org> References: <20261202123613.1708463-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="2489578"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:IA0B1OJO8WFhz1yQI7qdUEJzrCc= sha256:KWtF7hA3zL7fe/4K9K7qnJ3P7Bi6f+Gtx95O75TR5l4= sha1:mkC1NxyUnGLFeCKI6jsdREu8Rt4= sha256:boKDw1mwDlAGVp8h256T3i4G347dn2XmRUmcBGNrSBs= 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 9B93D117942; Thu, 3 Dec 2026 15:39:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 i_t4AG-zHv37; Thu, 3 Dec 2026 15:39:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-376603-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 3C8791178EF; Thu, 3 Dec 2026 15:39:20 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 490792A337; Thu, 3 Dec 2026 12:39:18 +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=1796301550; b=im45gSd9BAVQr34sm2LDJ9VW5JUd46SAZ/9yUU/oyuButuJQGWAwRKR5qQf9ypd+L5qW 3JN1yIWmsxFYLDxR9gqpe/ygXQFN6AsjQ43JMfCrzxckZRgbVb6QVwZcjQyaYuo71VVsm sIrearN39CLfkZh96upCv1t84vPBHWYOCI144bnTJj2m6WtOlVK2miw3fXuK+M2XZbt/O r6s7MkClmedRHEpzRm0ErwNApVpha+/r54N/gIuGNBHe3GRsykISCX+nlyDFW3Bhv5/mC qaWLyUY0MtPCxi9EV36nQ2avCVYsy/QrZOUutkDWVANJhKmq5lGu0cl1hpGyAocdVOw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796301550; 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=2yNQMCtxGNPKwPPlW6QD3n3RrNao4cRQzpom4G7rSt8=; b=A+1U2sn61Tog9MU/W5qgj7uZFIcyOaI3J6Y+yms9rkEOHi1AaiaOsiBww8v0oX2mo3AC a/HlRNAYPuUnCTnb9xjqLfbt0zB7J2EKGs8hWZhKgxp3RvaAoxkDn9RFjKtTI3Io+lPxc 0ymjGlfXLVSXnODwQDLvnwQS4y4tgCdMDoWeg3JSXqVPjYZhSrWu7llg2RRzWd42oLf8w xJX0wSP7PI5Zl4BEx7xmqXQVZyAz3hW5g2urDudAn3GCNjbHC3vcuXrunG6ZBwqmfCkaq 6lq+xVYZjaouw4kpPHMMmmnfHiHUN+DySuLujpVjZuGkWtIGP7PRU4cGf06aEd/emlQ== 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=PasfUVDO; 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 59EB3606A333; Thu, 3 Dec 2026 12:39:10 +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=PasfUVDO 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=1796301544; b=i0H9Oe9JAFvVi5gPv8WIjwK8FWsF/BxYhhuyxG04YG9OhYsdXyArGVY7sufBtA0VV9sH CcH1KR7pVjqc3hhNioXqYs6aZAYFEB1hIDt2PPW9+FXFqW4rzIeCebrbfWom4H/rSQ7Kt +fxda3EnVmiiot+lOclydxhVr9ydL8mcZEgLfpyCxZDDHLxrp/Lf80lzU8eu3zguoNSNp W/xosjve+/P+6okUp4hdpbuXKCjIxUBoViIia+K3U5DPbyO5LxtNOafnSdADmkPoXmSj0 mtvpX/0vQzXW8YmOr6zzT5uVdRGOIuH9j4604mI4NlDd8K+Z6kTH0C6I/p2QTrIR1Dw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796301544; 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=2yNQMCtxGNPKwPPlW6QD3n3RrNao4cRQzpom4G7rSt8=; b=WfomJ+arEFgoWEyOf0bL4kTy9nmUiTZeRT24yCWACObf6KQ79yXI+J2ESyrzmVcGPiEm Oeh53pqm2JOFcJKeiYMtoC7/gVn0OZLCjC8aUS+Pbj5DoSPrU+LwE2Aer7dHSR+dfoj3O vHhq5MQkaPKifroUT4O2dsM3M9RScUAiOF6MKY+IHomNPniWQ0SGcbmtmpraaCtxHHT7I Pblqw0SujuCyBlgiZGVPadsiTy0bNogBc7HnL4KYiq2Z7lfYBiuXJPdJD64oHKlvb/xto MpW7agI2j7zb8FQQ8VzhwmfN80AlozEn4MuL+QNsENUPS/kLD4K7y90VSGTAVsvOU6Q== 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=PasfUVDO; 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 795CA606A330; Thu, 3 Dec 2026 12:39:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 276071F000C1; Thu, 3 Dec 2026 12:39:03 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796301544; bh=2yNQMCtxGNPKwPPlW6QD3n3RrNao4cRQzpom4G7rSt8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PasfUVDOOoOGgfSpd4ybhr/CucZGPm5gG+fY+UYRPPqN4CDpDUAZ0B2FZlPU0ZBgp x0xLx/Ind3jixLO3evEi6cpCde/L2W+TL0gTlDEo7gn5cfKfF/hU7qcNqE0bgJe8Qb ah1KUrIwCBVsNv3c1La9tgUrtRNyUA619yWOJBUKllBQZwEdwxNNjqpxqdcSdlfgZm cTbuyDX4KMAMLRe8pnJYaygLtUtfwBiN6eTnyGSY5rjsY0NxK2fIeIPxqWtd95qolG qfAxsd3n27bwhVaX6FNvGueMs1NyFpckaQLTCiETS6E7/zrNxVEoUHKQHw/A9ZLSGB bx5xybH8LXuWg== 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: <20261202123613.1708463-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