Article View: linux.kernel.netdev
Article #24885[PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
From: Anton Danilov
Date: Tue, 01 Dec 2026 00:59
Date: Tue, 01 Dec 2026 00:59
78 lines
14183 bytes
14183 bytes
ip6erspan_tunnel_xmit() picks the traffic class and the flow label to
inherit, the ERSPAN truncation bit and the ICMP error to send for a
packet that is too big by skb->protocol, and ip6_tnl_xmit() picks its
minimum MTU the same way. A VLAN-tagged frame therefore gets none of
that: its outer traffic class is 0 where ip6gretap inherits it, the
truncation bit is not set from its IP length, and an IPv4 packet behind
a tag gets an ICMPv6 Packet Too Big built from its IPv4 header.
Use the protocol that the previous patch works out on entry, behind the
tags. The header it stands for has been pulled and the network header
is on it.
Found by an AI code review agent on an earlier version of the previous
patch and confirmed in a VM on an unmodified kernel: an IPv4 packet
with TOS 0xb8 behind a VLAN tag, sent to ip6erspan v1 and v2 with
tclass inherit in each of the ways listed in the previous patch, goes
out with traffic class 0 before this patch and with 0xb8 after it;
untagged packets go out with 0xb8 before and after. The truncation
bit, the ICMP error and the minimum MTU were not measured.
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
net/ipv6/ip6_gre.c | 8 ++++----
net/ipv6/ip6_tunnel.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index d7d7fd478200..698cf1cdd4ab 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,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
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 868c49b97a8f..8ccc90333c99 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:
<20261201005941.1536429-5-littlesmilingcloud@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374585-linux-kernel-netdev=dewy.ruReferences:
<20261201005941.1536429-1-littlesmilingcloud@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374585-linux-kernel-netdev=dewy.ru
From: littlesmilingcloud@gmail.com (Anton Danilov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
Date: Tue, 1 Dec 2026 03:59:40 +0300
Organization: Usenet Network
Message-ID: <20261201005941.1536429-5-littlesmilingcloud@gmail.com>
References: <20261201005941.1536429-1-littlesmilingcloud@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1579662"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nY18UGRtAXCqs8HjV5dt4rJZglA= sha256:7A3muy2ICNWAMocdTBafF0MmzPhDyU1TqDhfnrlTxJE=
sha1:o3i+04Da/5kqh4fuVChnODkpqgo= sha256:b7ytT8/wxU4b3oejAfgprP6QxgPtpJe1IocUWfPNSBM=
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 8FD45126018; Tue, 1 Dec 2026 04:00:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[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 jsNXwDFal1NU;
Tue, 1 Dec 2026 04:00:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374585-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id A139B126013; Tue, 1 Dec 2026 04:00:00 +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 69F5125C7D; Tue, 1 Dec 2026 00:59:57 +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=1796086792;
b=tGamHrG4Ssn/a+aLr5B+jJYPkxfJq70qjkpXbEMulj5W6TzbnMFz0/OIQrzBYiYaKb9S
6KzAB14oddZL3FlGSmBJHKsLqL2C60Iyb6VxN8Skv7XUaSBHQka/tavUweljkTbcMlVB3
Fzla2/x+Kpj/8eFcoHajpvSIqpmLIOaIYasp2A8wbQ8sXjYZMHrlFOn318JP1UTXdZq3d
2KPoai7WsXW2HpE5zX8jglp3PIJe1ArxqTtofXd2sZCArlO4JYBg+w37lqVnrxItcZHDM
jrwRmzb4ZEbk1sjnDi8g64vAhkTdX7a5ZT4gHKNWeGGsnV4rZPvp7dd1oDAQuFgTKzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796086792;
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=YI6QzyshgCnAiQAi0cMKDIcSabKCHc2xzycllpG1rm8=;
b=UQ6BOoHVSrCnZk96zp2MXx665qdIi+Rre6AlCkyvQZrujfk4jiH3ddUfQXbUCBiro/Fg
7vQCYUl4h4sbDQK2eSLKcwRD0FWKJYSiUdO2ip05RoA+e3hv8BMEcGaC+SLyJYk2oo29g
WK/sxnOiZ0u00Ih5MtpTz/4kAw1kPNDme3kwGdel0VU0x/cYoycsJ7on0P1v9EtWTP/OH
XwgjNHIjuywG4jqLMNOC+iQikDli7tzi9g1IAnRkCnkFvoZYY+PyJbCiZ1o/5iUOehGqC
tFx2t6EO+p0xvY48B/RBY/kP66chNu1RUO1YvLU1lypNvynOLMgW4TBmG0WpMzzRupg==
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=G6VwrcPU;
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 B049460A2605;
Tue, 1 Dec 2026 00:59:52 +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=G6VwrcPU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.177
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796086791;
b=kVaLFiDoF86z8O+hffclzEteqGa2I6cDewRNltEKLuXns9RzqMWFoLT7395vR8bTsTgk
kojYw6mVjUe3qzIGXUvJHMtq5ndknwX7Qj8CcvT7kQ5XyENyO5FrXPizTbxos931USmqZ
dgn7OpjhpvIK+WQoPXslFPWSi5WX6KydE6a+lvTAtQJRI3oTWdoH8jizCe9A19WR6bLIV
KvOHikrBDkjsmaRnhtVaE9tJdcbCAY1PVIJ+pYqKn6KYNq1rx882Q8aDOIqzjIhjg31a3
fTUDEQFILzf3emC64PoPihqHQ7sGyKK1QHZZPsDLKmng9yf6TkhG+zmvcrV/VSFVbEw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796086791;
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=YI6QzyshgCnAiQAi0cMKDIcSabKCHc2xzycllpG1rm8=;
b=0XPuCUxPIHr/a/KDWB1m1LDKsV1Zh+noG0/Hq+TfvIja0njwqiC7oXIvHhP2sFK5FwSH
27pQE/Ql6hUwyR0oJOJb+gWyPOZU0tj4FVKUYvXAgqqcxqTlLwEQ1AbHUV/Bq7dUe9ZAu
XvaWn2AjOvGGAF9kvYR+yegzrsrPzmg8pC3l3IXEmvm8+/0dAWI0PbfQIv15sAnfI46Rm
olbFxTmBJF0qvi/ENUc1aznqTvNcgFv8pEmujfCvTYifyF9SicGU+CSTSdyGxAdByioqz
34RfFw+N1QAiPyoWsLHdB6s+CoKBiiy6C3x2SDn++uXvpXBi2QbFkkFoRNV5pQD/Dvg==
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=G6VwrcPU;
arc=none smtp.remote-ip=209.85.208.177
X-Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177])
(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 7FFAF606A6AF
for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 00:59:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7FFAF606A6AF
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-f177.google.com with SMTP id 38308e7fff4ca-3adfed9a887so103056881fa.3
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 16:59:51 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796086790; x=1796691590; 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=YI6QzyshgCnAiQAi0cMKDIcSabKCHc2xzycllpG1rm8=;
b=G6VwrcPUZL7datofQrtDLWOcH3pW0hb1i0FL4L5fMwpGkAu3YrTeCGDkzvy7OX7nF0
lDXaISNZrmPRhsUo4cmeDBDUoKaS+BO44Rdm+6eGRbbF+Gd5eUrqpjToEyxwlacsEbss
zP7zo3jBRANOr48MaO4urRPYdBnDVoQL40EgkCJbA/t4mwn/SQmgkwi2DDfbUqzqfHkU
HJSYYmZWhXl/8+raq/oo4iCd3MKn/SczsMARVz85LypNb01XtB1UyNL5BXTx3pTt2pMF
WiPW8YMvwjTJovt2CDXDL6cEkhKGjxewXgOa6B5kC/w/hdosY7Y0Vky4Ywogqbh7LASv
sHBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796086790; x=1796691590;
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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lfO66Bq/akNg8LXzz70PhHsslO5la+G27cAn9um9vLHcrWWNlN68PBOM625oqBjLBvk
uIbQ+gKki2naEF8f7I5ZttXYpXmSrT2X4e87HSO8ju8E60KsA2Kohf5FHjJRrcMCNsFpQqROpmR
keVzK79HoNYDL41A=
X-Received: by 2002:a05:6512:39d4:b0:5c1:57d7:d9f4 with SMTP id 2adb3069b0e04-5c1bc7b4c5bmr11128621e87.16.1796086789600;
Mon, 30 Nov 2026 16:59:49 -0800 (PST)
X-Received: from dau-home-pc.megasoftware.org ([94.28.149.75])
by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c1bd040a9bsm8895709e87.48.2026.11.30.16.59.48
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 30 Nov 2026 16:59:49 -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: <20261201005941.1536429-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