From: Anton Danilov <littlesmilingcloud@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next 4/4] vxlan: report a circular route as SKB_DROP_REASON_RECURSION_LIMIT
Date: Mon, 5 Oct 2026 23:14:17 +0300 [thread overview]
Message-ID: <20261005201417.906344-5-littlesmilingcloud@gmail.com> (raw)
In-Reply-To: <20261005201417.906344-1-littlesmilingcloud@gmail.com>
udp_tunnel_dst_lookup() and udp_tunnel6_dst_lookup() return -ELOOP
when the route to the remote end goes out of the vxlan device itself,
and vxlan_xmit_one() counts that in collisions, apart from the
-ENETUNREACH of a failed lookup. The drop reason does not tell them
apart: both are reported as SKB_DROP_REASON_IP_OUTNOROUTES, which
describes a failed route lookup.
Such a route would send the encapsulated packet back into the device
it leaves, which is the dead loop on a virtual device that
SKB_DROP_REASON_RECURSION_LIMIT describes. Report the -ELOOP case with
that reason, and add the tunnel case to the description of the reason
as an example. ip_tunnel and ip6_tunnel make the same check,
rt->dst.dev == dev in ip_tunnel_xmit() and ip_md_tunnel_xmit() and
tdev == dev in ip6_tnl_xmit(), and can report it with the same reason.
Assisted-by: LLM
Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---
drivers/net/vxlan/vxlan_core.c | 10 ++++++++--
include/net/dropreason-core.h | 6 +++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 0d98e29e2d72..7c94a630d184 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -2547,7 +2547,10 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
tos, use_cache ? dst_cache : NULL);
if (IS_ERR(rt)) {
err = PTR_ERR(rt);
- reason = SKB_DROP_REASON_IP_OUTNOROUTES;
+ if (err == -ELOOP)
+ reason = SKB_DROP_REASON_RECURSION_LIMIT;
+ else
+ reason = SKB_DROP_REASON_IP_OUTNOROUTES;
goto tx_error;
}
@@ -2633,7 +2636,10 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
if (IS_ERR(ndst)) {
err = PTR_ERR(ndst);
ndst = NULL;
- reason = SKB_DROP_REASON_IP_OUTNOROUTES;
+ if (err == -ELOOP)
+ reason = SKB_DROP_REASON_RECURSION_LIMIT;
+ else
+ reason = SKB_DROP_REASON_IP_OUTNOROUTES;
goto tx_error;
}
diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index 40a27d8887af..664249924219 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -613,7 +613,11 @@ enum skb_drop_reason {
SKB_DROP_REASON_PSP_INPUT,
/** @SKB_DROP_REASON_PSP_OUTPUT: PSP output checks failed */
SKB_DROP_REASON_PSP_OUTPUT,
- /** @SKB_DROP_REASON_RECURSION_LIMIT: Dead loop on virtual device. */
+ /**
+ * @SKB_DROP_REASON_RECURSION_LIMIT: Dead loop on virtual device, e.g. a
+ * tunnel whose route to its remote end goes out of the tunnel device
+ * itself.
+ */
SKB_DROP_REASON_RECURSION_LIMIT,
/**
* @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
--
2.47.3
next prev parent reply other threads:[~2026-10-05 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 20:14 [PATCH net-next 0/4] vxlan: generalize and refine drop reasons Anton Danilov
2026-10-05 20:14 ` [PATCH net-next 1/4] vxlan: rename the drop reasons for use by other tunnels Anton Danilov
2026-10-05 20:14 ` [PATCH net-next 2/4] ip_tunnel: make __iptunnel_pull_header() return a drop reason Anton Danilov
2026-10-05 20:14 ` [PATCH net-next 3/4] vxlan: report the drop reason of __iptunnel_pull_header() Anton Danilov
2026-10-05 20:14 ` Anton Danilov [this message]
2026-10-06 12:51 ` [PATCH net-next 0/4] vxlan: generalize and refine drop reasons Ido Schimmel
2026-10-08 18:00 ` patchwork-bot+netdevbpf
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=20261005201417.906344-5-littlesmilingcloud@gmail.com \
--to=littlesmilingcloud@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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.