From: Anton Danilov <littlesmilingcloud@gmail.com>
To: netdev@vger.kernel.org
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
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 [thread overview]
Message-ID: <20261202123613.1708463-1-littlesmilingcloud@gmail.com> (raw)
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
next reply other threads:[~2026-12-02 12:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:36 Anton Danilov [this message]
2026-12-02 12:36 ` [PATCH net-next v8 1/5] erspan: bound the VLAN tag read in erspan_build_header{,_v2}() Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 2/5] erspan: take the COS from the mirrored frame, not from the tunnel family Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 3/5] ip6_gre: classify the inner packet once on transmit Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan Anton Danilov
2026-12-02 12:36 ` [PATCH net-next v8 5/5] selftests: net: add a test for ip6gretap and ip6erspan with VLAN tags Anton Danilov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202123613.1708463-1-littlesmilingcloud@gmail.com \
--to=littlesmilingcloud@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=matthias.may@westermo.com \
--cc=mazin@getstate.dev \
--cc=mvohra@vmware.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=u9012063@gmail.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.