🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25777

[PATCH net-next v8 0/5] ip6_gre, erspan: fix inner header handling for VLAN-tagged and short frames

#25777
From: Anton Danilov
Date: Wed, 02 Dec 2026 12:36
83 lines
15311 bytes
ip6gre can check the length of one header and read another when
transmitting a VLAN-tagged frame. Parsing the frame again after pushing
GRE can also lose the inner protocol. This series extends Eric
Dumazet's original fix and targets net-next because it changes the
ip6_tnl_xmit() interface.

Patches 1 and 2 bound the ERSPAN VLAN and DS-field reads and derive COS
from the mirrored frame. For a VLAN protocol, the IP version nibble is
a heuristic: a non-IP payload such as MPLS can still give nonzero COS.
Patches 3 and 4 classify the payload once, before encapsulation, and
use that result for header inheritance, truncation and PMTU handling.
Patch 5 tests hop limit, traffic class and COS with and without VLAN.
The IPv4 GRE transmit path, tunnel receive paths, ip6gre header_ops
and VXLAN/Geneve remain follow-ups.

In KVM the new selftest passed 24/24 with the series (14/24 on the
base). On both kernels 16 existing selftests passed and the
264-case functional matrix matched the previous results. A separate
iperf3 check passed BIG TCP traffic over gre, gretap, ip6gre and
ip6gretap; the upstream BIG TCP selftest skipped for lack of netperf.
All five intermediate kernels and the final CONFIG_INET=n kernel built.
The earlier KMSAN results are from 5eb53a1fbf80.

I used Claude Code and Codex for development, testing and review and
take responsibility for the submission.

Changes since v7:
 - Rebase onto net-next 3a3cf3118f1f, which enables BIG TCP on GRE
   devices.
 - In patch 4, check for IPv6 before sending ICMPv6 Packet Too Big on
   -EMSGSIZE, as Sashiko suggested. In KVM, oversized ARP frames now
   drop without calling either ICMP handler. IPv4 and IPv6 senders
   still receive the expected MTU errors, with and without an 802.1Q
   tag. Patches 1-3 and 5 are unchanged.

Changes since v6 (introduced in v7):
 - Expand the single patch for net into a five-patch series for
   net-next following the scope discussion [1].
 - Replace skb_vlan_inet_prepare() in the IPv6 GRE transmit path.
   Preserve the network header when skb->protocol already identifies
   the payload, including on VLAN devices with reorder_hdr off.
 - When skb->protocol is a VLAN type on an Ethernet device, read the
   EtherType from the frame and walk the tags. Set the network header
   only if the tags lead to IPv4 or IPv6.
 - Pass the classified protocol to ip6_tnl_xmit() so it can use it
   after the GRE header has been pushed.
 - Put the two ERSPAN header fixes first (patches 1 and 2), use the
   classified protocol in ip6erspan (patch 4), and add a selftest
   for tagged and untagged traffic (patch 5).

[1] https://lore.kernel.org/netdev/20261014005308.1606362-1-littlesmilingcloud@gmail.com/

v7: https://lore.kernel.org/netdev/20261201005941.1536429-1-littlesmilingcloud@gmail.com/
v6: https://lore.kernel.org/netdev/20261008012554.202925-1-littlesmilingcloud@gmail.com/
v5: https://lore.kernel.org/netdev/20261005231414.932997-1-littlesmilingcloud@gmail.com/
v4: https://lore.kernel.org/netdev/20261004145205.226974-1-littlesmilingcloud@gmail.com/
v3: https://lore.kernel.org/netdev/20260119112512.28196-1-fw@strlen.de/
v2: https://lore.kernel.org/netdev/20260106144529.1424886-1-edumazet@google.com/
v1: https://lore.kernel.org/netdev/20260105100330.2258612-1-edumazet@google.com/

Anton Danilov (5):
  erspan: bound the VLAN tag read in erspan_build_header{,_v2}()
  erspan: take the COS from the mirrored frame, not from the tunnel
    family
  ip6_gre: classify the inner packet once on transmit
  ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
  selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags

 include/net/erspan.h                          |  68 +++++--
 include/net/ip6_tunnel.h                      |   3 +-
 net/ipv4/ip_gre.c                             |  13 +-
 net/ipv6/ip6_gre.c                            |  97 +++++++---
 net/ipv6/ip6_tunnel.c                         |  11 +-
 tools/testing/selftests/net/Makefile          |   1 +
 .../selftests/net/ip6_gre_vlan_inherit.sh     | 172 ++++++++++++++++++
 7 files changed, 309 insertions(+), 56 deletions(-)
 create mode 100755 tools/testing/selftests/net/ip6_gre_vlan_inherit.sh


base-commit: 3a3cf3118f1f4fa3b5a51f5d88b27dd43737c380
-- 
2.47.3
Technical Details
Message-ID: <20261202123613.1708463-1-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-375776-linux-kernel-netdev=dewy.ru

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-375776-linux-kernel-netdev=dewy.ru
From: littlesmilingcloud@gmail.com (Anton Danilov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v8 0/5] ip6_gre, erspan: fix inner header handling for VLAN-tagged and short frames
Date: Wed,  2 Dec 2026 15:36:08 +0300
Organization: Usenet Network
Message-ID: <20261202123613.1708463-1-littlesmilingcloud@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1970298"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:O1lGjg7Kxfi0O9EblFcU2Ho+pxs= sha256:orx+PlSW7cxdmrIjXr0uL8afYYUGJLcyAVUsz/S0C8A=
	sha1:8BmwxVXTHw0jDZnRvXFKq8ah0BE= sha256:QShNop3V48CGJuCgGOq4Aj7HBjTF0da64LjSuY2eSiA=
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 EC9E2117631; Wed,  2 Dec 2026 15:36:39 +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 OjBJ5zZK-2wK;
	Wed,  2 Dec 2026 15:36:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375776-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 34DA011762B; Wed,  2 Dec 2026 15:36:28 +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 37C8C35E50; Wed,  2 Dec 2026 12:36:21 +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=1796214980;
	b=Q8aSziVFyFwekxtUe4mxcDLt6P/kLzECPqIDp/bV2hk5MI2Ae7KfXVQdnmAtg92haqN5
	 fC942SRskSbyjpvVbcu5b+LF4C9MQFDHB2bT455h/jgOt5sbxfbuKJYZRWKoU0j45sfu2
	 J4h2GOt5NEEfKg9iVqSdvP+UxFIzv4z4VHK8i/S7bIiyYzLxDhLvwO8H/cvdfB4HUuZ2k
	 vzXlYTL0jjkTsAcRiax8m3Zh9VetsIa8++DsKuAztAtZXLIt38k04L8M63ZaNQcOTxwlb
	 F5+c9GbABPBwH/MjH8KYi1w5mvCnEgx1TUnBEw+9Gbh+VjZ5dk6a5BZBp76KretWgHA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796214980;
	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:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=1ojoijKTQ/SmFuu4oclOg7BJVv1JPFgS/j/FuFtvPqc=;
	b=RwNrvcR6+a1bL3633sWFg3vPo6vcf4LZMSoV+RAJtLJU6BG5jLoaEBXj2ifkxnLHVCGm
	 5AKPNdCKO716Z/65U7OpeMCMyG0+8agP9dpdakztgfyZoNWOUk0IcC6jlxT0Y/EDuxU+7
	 MU3YUqq+43s/X1K20OCXOammbuwzhGQfjvwmFvlFyUDnM6DY5DDqI6MTrckH8YgQr2BvR
	 +0w5URPgnsg6afQESixp2y723DWMPTfuQVJYJY25iCGtwdQM+7a+7PsEvFo+dJJi4/KdL
	 prt6PKoLavY1/3lDEd3ibV60zB3Mm3kLBeIrNizt/9J8MXrMc8L598co3evwD1VH/mw==
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=tPlQk7gi;
	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 363E4606A335;
	Wed,  2 Dec 2026 12:36:20 +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=tPlQk7gi
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796214979;
	b=BfkKiO2RvkwNhOphjkFHO/v9v/0DusXkG8n8ytbxzXm9AVq+wJ9NQUBvy4StgHfghEUb
	 0qDFzvZUIS8XxPRtJM+bPLqtlhzUhWvweIb7vyAGwp/kydFquZo/XnAx1zxL1xdv19rEp
	 LpOPh6jPBGLujic5LSYFZC9jRv8z7Agh72QC0Zg130dAhrSO/q1DhtzBPT25l6GpeDvP9
	 rr1mLqYtnqijVxx96WpsHbcK443KgLMC+IsKVUNemUR3nNoInhGSr2ybxyC4M/QJJRirY
	 Cn7ZrmreM8VzEjGwaw8JnSa3EJFT276NhtjcKobZ/q+rPcpNyUt4R55nICwC9EdpkIg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796214979;
	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:MIME-Version:Content-Transfer-Encoding;
	bh=1ojoijKTQ/SmFuu4oclOg7BJVv1JPFgS/j/FuFtvPqc=;
	b=FQw+fKbCxMksljRMn/0loFhn0ZztoR8fhVp+qAzo3DojS2PEjpahSKP/vR5cxGrv5O0K
	 SGOt6tJFGQn6i+2Rdn+Gczfn2Xi4EoHu1RTv/Xj/i9VMu4CAqWU+Hyjapm8vZbKRCfiVH
	 hJyC11IgIRMooD+itp1imxU2aBAiKY0RREs5dnefi+sLcHhpTW2k0ifsTHKwnue1wleIy
	 i7rYJBE2V9QqDpRBXplcRqtLYUG9zlnlMkwmP5wiDR216UUeyGx2klOJ6sCAepEKPlvZ3
	 3yX+sIFNFKkKREJuxm3AiSda9I7/D2GxkazT9f/dd5S34Z+3Rx7HTmRfEZssUDg4e2A==
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=tPlQk7gi;
	arc=none smtp.remote-ip=209.85.167.50
X-Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50])
	(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 0D384606A325
	for <netdev@vger.kernel.org>; Wed,  2 Dec 2026 12:36:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0D384606A325
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-lf1-f50.google.com with SMTP id 2adb3069b0e04-5bfa65c8617so4383130e87.0
        for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 04:36:18 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796214977; x=1796819777; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=1ojoijKTQ/SmFuu4oclOg7BJVv1JPFgS/j/FuFtvPqc=;
        b=tPlQk7gi/tvXydRiAY+qf4MJsvYOqoEnYtuPWATSezYGhtE5bPxSquDJYgb44SOCgB
         GgS3Z8cD05YFgETMQQ6DJ6Vv/MQm34hH8XogsMBSNqtut0i4crq4m0x34aLFx9k/t6IM
         Gmdjebk1bfdjCV/FKhOh8m11gVFzwoQHwY4BEuYvXOs+r6OknTixDnK0KBAGJ3ssgAMs
         +JX5eG+apecMQjzwBjhB/jSZrUhT4Pd7Ty2FF2BR3sOzmn0UUIXZFlMcaIP8bwhCG4/C
         ZDHUsmQ/SwcahL2CVerr1DyDZQdsS47NP9IHPxLWYfaaP6YCvpaYo78SV0wDg/B38AR/
         Z5UQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796214977; x=1796819777;
        h=content-transfer-encoding:mime-version: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=1ojoijKTQ/SmFuu4oclOg7BJVv1JPFgS/j/FuFtvPqc=;
        b=jJQwFPViUr4dO2kZPV6HyPYlo5qk91piaNJhU8V37fnslMwJKiYN/ka76MtEmODxa6
         Y0jmcG9UTvTyAlPEQoQyQVXCw7EMw369QQhQ0zVj6atj3INLEI9uikKwHXg3VotbkIbq
         QWpOIFD3Ct2sU/q3uYnuoD5SdiPsUNqrmRqCKJrHER9yjw9IRs4stoqKCV1iAvNEKOMA
         nmxs0B5DP/+5zjSZMW2zvSKbNlrk/x48EHj4q4uKfM/UKTGA454h0J3iE1iHLwbc8TKX
         PFvl1i9H83wXunQ2hXmSCO+MpCCtbvd1jsX4tTVZt1isR0eK3fB21Ncy9k5KD7UvUa72
         8/og==
X-Gm-Message-State: APuU4Z+Aca2FA+V51VETQmZSfHOs8gkLr23FitkmRPDCPwqgjCxHgqDy
	OPnXAJ5gw88DOVp7WQYU3H8d4W5vdsGN2NSTJs/mBr15aFxFwdvfvW6FN+K+Z5NazNpHOg==
X-Gm-Gg: AZFdTZdTWUb4SFZo6RGXu5gcb0tZn9X40YZeIs54IHOlkQpNoU9NoudVxusXwfsyxfn
	FfFzOqt44SkXJrTcpEoK9VjYQHqDgdzfLppsTvTCyujZbxCE8FFSxIulOm+e2tqh5eg7Fu0SkAo
	uLCm4JiTdSRyhaXE6xeA1Hl1yyQs88gSyGNIS2AyOejjBNyKumRJbs1u8ba3u726g94tc2II2S/
	lpt4rBBYCYcdQIAdaKn9d2XtSaogJwGsDWSd15YyKdzRrBDVfsBn7UfkidSf7QOfZZJUKf2KlmU
	rP8TZ39n74YL4KmHk7Wj6xRXcR2gj/0AUWl892HAkqt1iANbGsD94s0mQIiL89JQPplAeSY+Cdj
	yUn/PIbK1SFAzwA5O2aqLrP3cJdPyNKJHAztEzynl97DeoQaEiqy4H+ts2ZNrdsO2xHZDA+yeVz
	+8zwKT6eqQv0NrM3NfdldA+vpebMt8ZKuUsGoMTpHTLPv/NTVNBb/OOk4pun/9WCNqa5wjR05i2
	H8OQCQ00Guv/Bu3chJnDJlkFxe9LXE8wo8PXQ81zt7NnBeWVqB84It8pPgr6Evr1K7GsR2dd6/j
	T4nbUwxtFjWqPsazhzexz/SvDHt6HZFYq5r76bv9qCVaK/hhiBZEh+QwZurO3cH3A6Mr58P8HLK
	vMgcvGK0kUk7maLM=
X-Received: by 2002:a05:6512:b08:b0:5c1:4cab:2d03 with SMTP id 2adb3069b0e04-5c1bc84a147mr12681833e87.63.1796214976875;
        Wed, 02 Dec 2026 04:36:16 -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.14
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 02 Dec 2026 04:36:14 -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-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