[PATCH net-next v7 0/8] tunnels: add core and gre drop reasons

From: Anton Danilov

Date: Tue Nov 17 2026 - 16:19:12 EST


Several tunnel receive and transmit paths free packets from unrelated
checks at a common drop site. For example, a missing GRE sequence
number and an old sequence number both increment rx_fifo_errors.
Reporting a reason through skb:kfree_skb and drop_monitor lets an
operator distinguish a tunnel configuration mismatch from a reordered
packet or a peer that restarted its sequence numbering.

Patches 1-5 cover the shared IPv4 and IPv6 tunnel receive paths and the
GRE and ip6tnl receive handlers. Patches 6-8 cover IPv4 tunnel and GRE
transmit, including FOU and GUE encapsulation failures. The IPv6
transmit path will follow separately.

The series adds four reasons: TUNNEL_OPT_MISMATCH, TUNNEL_OLD_SEQ,
GRE_CSUM and TUNNEL_ENCAP. It reuses existing reasons for tunnel
lookup, header validation, PMTU and allocation failures. The device
error counters keep their existing meanings.

I used Claude Code and Codex to help develop, test and review the
series and edit the patch descriptions. Testing included virtme-ng
and a local run of the Sashiko review prompts. I take responsibility
for the changes.

Changes since v6:
- Rebase onto net-next a0aa9ceca03f as requested by Jakub.
- In patches 4 and 5, report TUNNEL_INVALID_HDR for the ERSPAN checks
added by 7ccc5e05043b ("erspan: drop packets with an unknown ERSPAN
version"), including the type I check on IPv6.
- Carry Ido's Reviewed-by on patches 1-3 and 6-8. Leave it off 4 and 5
for review of the new drop reasons. Shorten the patch descriptions.

- v6: https://lore.kernel.org/netdev/20261110202021.821224-1-littlesmilingcloud@xxxxxxxxx/

Changes since v5:
- Split out the vxlan patches (now in net-next) and defer IPv6 TX.
- Set a reason on each path to a drop label. Keep NOT_SPECIFIED for
looped-back multicast and ip6_tnl_rcv_ctl() failures.
- Add patch 6 to distinguish allocation failures in ip_tunnel_encap().
Its IPv6 counterpart will follow with ip6_tnl_xmit().
- Mention reordering in the TUNNEL_OLD_SEQ description. The vxlan
series already updated the RECURSION_LIMIT description.
- Describe AI assistance in the cover letter after 1e035297ffda
("docs: remove Assisted-by references").

- v5: https://lore.kernel.org/netdev/20260930183910.3151873-1-littlesmilingcloud@xxxxxxxxx/
- vxlan part of v5: https://lore.kernel.org/netdev/20261005201417.906344-1-littlesmilingcloud@xxxxxxxxx/
- v4: https://lore.kernel.org/netdev/20260922221507.3268127-1-littlesmilingcloud@xxxxxxxxx/
- v3: https://lore.kernel.org/netdev/20260916143717.1875082-1-littlesmilingcloud@xxxxxxxxx/
- v2: https://lore.kernel.org/netdev/20260913034937.875068-1-littlesmilingcloud@xxxxxxxxx/
- v1: https://lore.kernel.org/netdev/20260831215137.549324-1-littlesmilingcloud@xxxxxxxxx/

Anton Danilov (8):
ip_tunnel: add drop reasons to the generic RX path
ip6_tunnel: add drop reasons to the receive path
gre: make gre_parse_header() report a drop reason
ip_gre: add drop reasons to the RX path
ip6_gre: add drop reasons to the RX path
ip_tunnel: make ip_tunnel_encap() return a drop reason
ip_tunnel: add drop reasons to the transmit path
ip_gre: add drop reasons to the transmit path

include/net/dropreason-core.h | 31 +++++-
include/net/gre.h | 5 +-
include/net/ip_tunnels.h | 20 ++--
net/ipv4/gre_demux.c | 64 +++++++----
net/ipv4/ip_gre.c | 199 ++++++++++++++++++++++------------
net/ipv4/ip_tunnel.c | 61 ++++++++---
net/ipv6/ip6_gre.c | 66 ++++++-----
net/ipv6/ip6_tunnel.c | 45 ++++++--
net/ipv6/sit.c | 2 +-
9 files changed, 331 insertions(+), 162 deletions(-)


base-commit: a0aa9ceca03f8eceb58174c9c72d480b2422d199
--
2.47.3