Article View: linux.kernel.netdev
Article #25781[PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
From: Anton Danilov
Date: Wed, 02 Dec 2026 12:36
Date: Wed, 02 Dec 2026 12:36
86 lines
14686 bytes
14686 bytes
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.
Use the payload protocol classified on entry to the tunnel. For IPv4
and IPv6 the classifier has pulled the header and set or preserved the
network header offset. On -EMSGSIZE, send Fragmentation Needed for
IPv4 and Packet Too Big for IPv6. Other payloads have no inner IP
source to notify, so let them take the usual transmit error path.
An AI review of an earlier version identified the traffic class issue.
In VM tests with tclass inherit, a tagged IPv4 packet with TOS 0xb8
had outer traffic class 0 on ip6erspan v1 and v2. With this change it
has traffic class 0xb8, as it does without a tag.
On native ip6erspan v1, an oversized ARP frame took the ICMPv6 error
path with the old unconditional else, both with and without an 802.1Q
tag. With the IPv6 check both frames were dropped without calling
either ICMP handler. For both tag layouts the IPv4 sender received
Fragmentation Needed and the IPv6 sender received Packet Too Big.
Each error quoted the original Echo Request and advertised MTU 1338.
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
net/ipv6/ip6_gre.c | 10 +++++-----
net/ipv6/ip6_tunnel.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index c413e47c6ceb..0ecee2271bbd 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;
- if (skb->protocol == htons(ETH_P_IPV6)) {
+ if (payload_protocol == htons(ETH_P_IPV6)) {
int thoff;
if (skb_transport_header_was_set(skb))
@@ -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,
@@ -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);
}
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 931911b5e8a8..3d8b2d5851ef 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);
skb_dst_update_pmtu_no_confirm(skb, mtu);
--
2.47.3
Technical Details
Message-ID:
<20261202123613.1708463-5-littlesmilingcloud@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375780-linux-kernel-netdev=dewy.ruReferences:
<20261202123613.1708463-1-littlesmilingcloud@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375780-linux-kernel-netdev=dewy.ru
From: littlesmilingcloud@gmail.com (Anton Danilov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
Date: Wed, 2 Dec 2026 15:36:12 +0300
Organization: Usenet Network
Message-ID: <20261202123613.1708463-5-littlesmilingcloud@gmail.com>
References: <20261202123613.1708463-1-littlesmilingcloud@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1970528"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:G3jtDD1J2745soydIsimTU2r2qw= sha256:4OlCLE2s0xrmodsd+BxSnPws+mqcui3Vx/BoY+gV/TY=
sha1:3oXcpjnGmBSx5Li19Vb2takpDXA= sha256:vr6eb8ezJwoTMP71TKkpPTuspDpQ9tvQ1BNiq4GLAXE=
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 10E73117635; Wed, 2 Dec 2026 15:37:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
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=gmail.com
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 R9fCc2GOs7J7;
Wed, 2 Dec 2026 15:37:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375780-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 01A6111762C; Wed, 2 Dec 2026 15:37:01 +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 289A33958A; Wed, 2 Dec 2026 12:36:31 +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=1796214986;
b=K7H6eXzNf8fdAizm2qX07W27rMJvciWFARlV/UeH9g2A/GGu6fLqIII64e1clUJa7KmV
suBnAasC3YMzsqFV7X0yf1zEiEnEmWy1zM/fmo3rAid3h2/ExWnEG32ydzVpJncch8rqp
dP5zZAI1T0B+Mc06/MXyPucXUmNzP7Wftf3nJBv0OiXCBxviyuu+sTQr7lppkE0jV/T3+
RF3V5okxCkITs7ELt30QjO3mfTFJdEM65lKtMbDO3JHDR1dNMSblBOISa7HvxYsjb5Yei
Z4t1j1D1CB9e65Z0hbQNZwWRLfcv9uXKB5HLj4RQIWOh582+N/E3NV9RNMCBulc+AhQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796214986;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=2Ls9zHQ/SVff8H3sLo/TFA45hZultTjaEws8Var6Vu8=;
b=cRHZQZH28EhoL0JOb4Tjyb1DCKcBgQo+mqoMNQNKakfv8yBxlh6oX8MbfAgUp4gwjEz4
BtewMFwfGUNLhBctTkScqZuMAPdSjPeLmsOvgRtla4rTYBA69xgM0Al6Mcxf/dokLQ/MW
bDui7AfbUZSqtlxPHC/Xo0swnojFWzTM2P2Scu5So0ltSQ8g87aBFFMgOPCtcajbW8+8X
0v2tFUwRJFi5/ghf70RzlBbIFQfmBfhVCPz7mHo3VgJFi9uhGJ85WFYbSBb6Fl1Pc2JLo
3W1Zb8r0U45MpsGs4qzqclIRPs/y1UqeCZc+IRQcc/yNqEcgTeGTxl5s7P8GxyaSdQw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Dd7OYADa;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 0C3E1606A6B4;
Wed, 2 Dec 2026 12:36:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Dd7OYADa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796214985;
b=G4PLKriqmgv6IobDyMf3NB2hXJy7ZV8FwTpNwAdyN7FTrvpSCyzkLdAeSpZr4MxgQLO+
YRP6c67JgiZgEx4L67WCQ0s3JxqbuO3uC1SlC1j2s671cQ+1RhDa+nx/6fEGfbTs1iwwB
MfRj2uQzbn0PCL1xEGwNstXr7fXEc4XDkGUOPLf4rCFnC+2X29F9dzjztI/6P/ap36pV0
rexzCT5EiPGxVplzSBTK4qpTk+V2cnz3fmETaQFVs5Gce4u7rMfqB+zX/kwQwH/Tg/91U
zvPetmXy/D/pzGbuWLPUaMUz6MOPG8RUeS/jFUoXh40YjMsfvzRwFEmNn8xcK0ox0fQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796214985;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=2Ls9zHQ/SVff8H3sLo/TFA45hZultTjaEws8Var6Vu8=;
b=CtUu6mfxkSufFB5+Ts5aydxdHKZ7c15oSw69KUd50ZR7eLHJL1Lw4yfKPWP8CB43nxi8
6FqHbepTgcR0OfKoLDchh6hU37+bB6pPshHy5a/H+nSpWSCGmqURtuNrjz9LCtv85R9ab
6TkMxa/FRtxjx5x1YvxHgVLGSOaNOaB4KBS3SYjpDZZ197Ng1fJ6y/WcpEys+QiqZlmIn
PJjXo3fQNtXvoKsrtSCQcUOheokEeIGE2J8bPQpEIvTiktuHYwDbZGycjn0hvmkEtFcZw
EdVpM06CFjeK2CwufXTzteEI6nnHfpZjIQIlHGDD2NzaecPHHM5YPvz+gLfW7HqAESw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Dd7OYADa;
arc=none smtp.remote-ip=209.85.208.182
X-Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id D36BB606A692
for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 12:36:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D36BB606A692
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-3ae0a5c1715so121948861fa.1
for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 04:36:24 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796214983; x=1796819783; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=2Ls9zHQ/SVff8H3sLo/TFA45hZultTjaEws8Var6Vu8=;
b=Dd7OYADa1SNOFHmAaQ5I65SB4IzB6EcWIM5xLMMnAWhavTmqbLFvaQZmMF6dN/NtnX
V6+nzt/mJFKMryhwp5WvxkZtcShRT7h8qLA4GU/Itzs0PZnhIqKT45hjB+LZstQTK9t6
PekC0mXYdXenVfrmiyVutKpomhnECJgDTJH2mAoVpJ7HGQUfl7lpHmo9mZBkg2FJRfpO
1jmRi6nEkOjcYnJ/7sHv0iYmEeF37T9BCa5ciqXUqt/X7SxYNM8P4ym3hki4Sp2XiSRX
fRfsokkNCwTMmLCy4Yewfhvj3a3q8S+z1Mfs7LvnKbRhdVL4qYi/e/vbN/3IrYBSWRDC
oYfQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796214983; x=1796819783;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=2Ls9zHQ/SVff8H3sLo/TFA45hZultTjaEws8Var6Vu8=;
b=wQFWtiGDKQ0nZcw8VnsBjETKv95RbsSem9ObjQyUynEhxs77Zx9h3zBl5sMzuMQe56
xgaMHiXAFY0VIQAsBk2kjFlGSbvVvwPj7HfKrs55Tmz6htEWNI4KuiHVsNOeYISRQ0cB
922xbtkzAjtmksUHf791iu2WF34p9X0mgWU4iXSW7l1+r/ZYYz3FC9MnIJmLGH7mf3zR
vctKN7f8om1exNAqpfoFXvi6Q19cl4Ym6+aQ9mpJWMK5qixHM2/SkEw/hMZrz+chwJ8r
KnsrSpF3XCkRg8BdIJI/Ek+UtNfCMm7/ELLocVTYjZMClZJdKCKsfLcD/doidvrYLhWg
Zfog==
X-Gm-Message-State: APuU4Z+bpsl7BwL9FTIYM1YYmFAFnyGVRkj0mgKYu9EKxCZaVumkgYSH
Q+sTn6P67BjynkZyiAgnQD16XVcQPFP9n/3pe2x7r38q8WRMsHpoduQbucjWHffvzxeSjg==
X-Gm-Gg: AZFdTZdCF2we6L+VQ4urGf3+cMsfS+GiosD5VjmOIvFfkLdCZfh7Nsl/6qrsrGC+Smu
rQNJuavU8GKEn2YayQfgLPAsViA8BGWHYtSKLdY+dPU1nbom2p5k3BajY/wgMufIDBrAAiQmpNA
6kEoFZZYo7x1q3NGkRRamjmVl+mVXQPTS1msChLGKRvRRcT4OFmaM25f1ZTL2R1UPHRP/zacn9x
z1WYgiZ0mLMyqOX/rjybFG0K5PIzguCWidj+Ug61J7ur+8FYH1tyIr22ybPjRtOSK2xrDUyU2Ql
nApVlQDhMlEkD6lff/OFHbXm2UesoaeTZnvsOcdRVTTolYCmHiaTP83RCJ5mBg2u8ch6S79Pa6b
Kx6SecZjQAfWUa8Pn2OmELpxt3HsW9PvuL6xQzhIQOx2sT9DqmPRacc+YCONjITTS/7bJL+CdHu
G3D5enCAZgcSpSXWiXBfcZIFxUpPR2YWBVEW9u0QVlXeq+OoH3oWmWafn7+HQ1+KA593RA0AfLl
BPfvuArJBU/UF3iN2cjUz9/js4Eg4AwIOyVEzQ8mz8HK14HChBvdkgDNTazKAY4g/ZpbAxJlYLP
fpLkPrkrLUfDQTKt916tJ9EQ+68zzA7k9/G999Nd/gwrA3Q+PtIMMd+wlqa81ErIs0ULe4dbqRk
nHS/Qu5bLJ4apiQE=
X-Received: by 2002:a05:6512:3a8b:b0:5bf:b96b:89f4 with SMTP id 2adb3069b0e04-5c1b7c00ae6mr11249985e87.19.1796214983101;
Wed, 02 Dec 2026 04:36:23 -0800 (PST)
X-Received: from dau-home-pc.megasoftware.org ([94.28.149.75])
by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c1bd0171c7sm9529553e87.31.2026.12.02.04.36.21
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 02 Dec 2026 04:36:22 -0800 (PST)
X-Cc: Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Simon Horman <horms@kernel.org>,
David Ahern <dsahern@kernel.org>,
Willem de Bruijn <willemb@google.com>,
Ido Schimmel <idosch@nvidia.com>,
Florian Westphal <fw@strlen.de>,
William Tu <u9012063@gmail.com>,
Meenakshi Vohra <mvohra@vmware.com>,
Matthias May <matthias.may@westermo.com>,
Mazin Al Haddad <mazin@getstate.dev>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.47.3
X-In-Reply-To: <20261202123613.1708463-1-littlesmilingcloud@gmail.com>
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