From: Anton Danilov <littlesmilingcloud@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH net-next 00/11] tunnels: add core and gre drop reasons
Date: Tue, 1 Sep 2026 00:51:26 +0300 [thread overview]
Message-ID: <20260831215137.549324-1-littlesmilingcloud@gmail.com> (raw)
Only vxlan reports drop reasons among the tunnel drivers today.
Everything else, on both the receive and the transmit side, ends in a
plain kfree_skb(), so a packet that a tunnel throws away is invisible
to dropwatch, drop_monitor and perf trace -e skb:kfree_skb. The device
counters group the failures coarsely: rx_errors and tx_errors each
cover half a dozen unrelated conditions.
This series covers the generic paths shared by ipip, sit, vti, gre and
their IPv6 counterparts, plus the GRE specific parsing, on both
directions. A later series will do the same for geneve, bareudp, fou
and the remaining IP in IP drivers.
Patches 1-3 convert the generic receive paths, ip_tunnel_rcv() and
__ip6_tnl_rcv(), and add a test for them. Two reasons are added:
IP_TUNNEL_CFG_OPTS_MISMATCH the options a packet carries do not
match the tunnel configuration
IP_TUNNEL_OLD_SEQ the sequence number is older than the
one the tunnel expects, next to the
existing TCP_OLD_SEQUENCE
The second one has a failure mode worth naming: when a peer reboots,
its outgoing sequence number restarts at zero and the receiver drops
everything until its own counter catches up. That is indistinguishable
from a misconfiguration by the counters alone.
Patches 4-7 do the GRE specific receive path. gre_parse_header()
returns -EINVAL for six different reasons, and the only detail its
callers could get was a csum_err flag that none of them read: both
ip_gre and ip6_gre declared it, passed it in and ignored it. It is
replaced by a drop reason. Three reasons are added, mirroring vxlan:
GRE_INVALID_HDR, GRE_CSUM and GRE_TUNNEL_NOT_FOUND.
Patches 8-11 do the transmit side, about forty failure paths across
ip_tunnel, ip_gre, ip6_tunnel and ip6_gre. One reason is added,
IP_TUNNEL_ENCAP, for a failure to build the encapsulation header.
The transmit side has its own case worth naming: tnl_update_pmtu()
returns -E2BIG after it has already sent an ICMP fragmentation needed
back, which is path MTU discovery working exactly as intended, yet the
drop lands in tx_errors next to genuine failures. An MTU black hole
cannot be told from a broken route by looking at the counters.
Drop reasons on transmit are not new: vxlan already reports several
from its xmit path, and ip_tunnel_core.c reports RECURSION_LIMIT.
Tested under virtme-ng. The selftest checks twelve cases by the end
of the series and passes, with no DEBUG_NET splat from the
SKB_NOT_DROPPED_YET check in sk_skb_reason_drop(). Breaking the new
mechanisms on purpose makes exactly the corresponding cases fail.
Not covered by the test: GRE_CSUM, which veth cannot trigger since it
hands the skb over with CHECKSUM_UNNECESSARY, and the NOMEM paths.
Anton Danilov (11):
ip_tunnel: add drop reasons to the generic RX path
ip6_tunnel: add drop reasons to the generic RX path
selftests: net: add a test for the tunnel RX drop reasons
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
selftests: net: cover the GRE specific drop reasons
ip_tunnel: add drop reasons to the transmit path
ip_gre: add drop reasons to the transmit path
ip6_tunnel: add drop reasons to the transmit path
selftests: net: cover the tunnel transmit drop reasons
include/net/dropreason-core.h | 38 ++
include/net/gre.h | 2 +-
include/net/ip6_tunnel.h | 3 +-
net/ipv4/gre_demux.c | 51 ++-
net/ipv4/ip_gre.c | 144 +++++---
net/ipv4/ip_tunnel.c | 60 ++-
net/ipv6/ip6_gre.c | 163 ++++++---
net/ipv6/ip6_tunnel.c | 95 +++--
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/config | 1 +
.../selftests/net/tunnel_drop_reasons.sh | 346 ++++++++++++++++++
11 files changed, 762 insertions(+), 142 deletions(-)
create mode 100755 tools/testing/selftests/net/tunnel_drop_reasons.sh
--
2.47.3
next reply other threads:[~2026-08-31 21:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 21:51 Anton Danilov [this message]
2026-08-31 21:51 ` [PATCH net-next 01/11] ip_tunnel: add drop reasons to the generic RX path Anton Danilov
2026-09-03 1:47 ` Jakub Kicinski
2026-09-13 3:31 ` Anton Danilov
2026-09-03 1:47 ` Jakub Kicinski
2026-09-13 3:31 ` Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 02/11] ip6_tunnel: " Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 03/11] selftests: net: add a test for the tunnel RX drop reasons Anton Danilov
2026-09-03 1:45 ` Jakub Kicinski
2026-09-13 3:31 ` Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 04/11] gre: make gre_parse_header() report a drop reason Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 05/11] ip_gre: add drop reasons to the RX path Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 06/11] ip6_gre: " Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 07/11] selftests: net: cover the GRE specific drop reasons Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 08/11] ip_tunnel: add drop reasons to the transmit path Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 09/11] ip_gre: " Anton Danilov
2026-08-31 21:51 ` [PATCH net-next 10/11] ip6_tunnel: " Anton Danilov
2026-09-03 1:43 ` Jakub Kicinski
2026-08-31 21:51 ` [PATCH net-next 11/11] selftests: net: cover the tunnel transmit drop reasons 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=20260831215137.549324-1-littlesmilingcloud@gmail.com \
--to=littlesmilingcloud@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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.