From: netdev-bot+sashiko@kernel.org
To: littlesmilingcloud@gmail.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
dsahern@kernel.org, idosch@nvidia.com, andrew+netdev@lunn.ch,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v5 13/14] ip6_gre: add drop reasons to the transmit path
Date: Sun, 04 Oct 2026 21:00:50 +0000 [thread overview]
Message-ID: <179114765080.434549.7267204104417826416@kernel.org> (raw)
In-Reply-To: <20260930183910.3151873-14-littlesmilingcloud@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] On a collect_md ip6gre/ip6gretap device, ip6gre_xmit_ipv6()
(net/ipv6/ip6_gre.c:839-840) still compares the inner IPv6 source…
- [Low] ip6gre_tunnel_xmit() (net/ipv6/ip6_gre.c:901-904) and
ip6erspan_tunnel_xmit() (lines 967-970) label every refusal by…
--
ip6_gre: add drop reasons to the transmit path
ip6gre_tunnel_xmit() and ip6erspan_tunnel_xmit() now free dropped packets
with kfree_skb_reason() instead of a plain kfree_skb(). The handlers' own
drops get specific reasons. For a collect_md ip6gre device, the metadata
check now runs right after skb_tunnel_info_txcheck(), so a packet without
usable IPv6 metadata gets SKB_DROP_REASON_TUNNEL_TXINFO.
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index 9e94ea6b6c20f..dbca782308158 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -889,14 +889,28 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
> enum skb_drop_reason reason;
> __be16 payload_protocol;
>
> - if (!pskb_inet_may_pull(skb))
> + reason = pskb_inet_may_pull_reason(skb);
> + if (reason)
> goto tx_err;
>
> - if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr))
> + if (!t->parms.collect_md && ipv6_addr_any(&t->parms.raddr)) {
> + reason = SKB_DROP_REASON_NO_TX_TARGET;
> goto tx_err;
> + }
>
> - if (t->parms.collect_md)
> + if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr)) {
> + reason = SKB_DROP_REASON_DEV_READY;
> + goto tx_err;
> + }
[Severity: Low]
Is SKB_DROP_REASON_DEV_READY the right label for every refusal by
ip6_tnl_xmit_ctl()? The same mapping is added in ip6erspan_tunnel_xmit().
One of the refusal paths in ip6_tnl_xmit_ctl() is an explicit loop
detection:
net/ipv6/ip6_tunnel.c:ip6_tnl_xmit_ctl() {
...
else if (!(p->flags & IP6_TNL_F_ALLOW_LOCAL_REMOTE) &&
!ipv6_addr_is_multicast(raddr) &&
unlikely(ipv6_chk_addr_and_flags(net, raddr, ldev,
true, 0, IFA_F_TENTATIVE)))
pr_warn_ratelimited("%s xmit: Routing loop! Remote address found on this node!\n",
p->name);
...
}
The kernel-doc for DEV_READY in include/net/dropreason-core.h describes a
device whose data structures are not up/ready/initialized. In the same
transmit path, ip6_tnl_xmit() uses SKB_DROP_REASON_RECURSION_LIMIT for its
own loop case:
net/ipv6/ip6_tunnel.c:ip6_tnl_xmit() {
...
net_warn_ratelimited("%s: Local routing loop detected!\n",
t->parms.name);
reason = SKB_DROP_REASON_RECURSION_LIMIT;
...
}
So a loop through the local node could show up as either reason,
depending on which check catches it.
This happens when the device's non-multicast remote address is configured
on the local node and IP6_TNL_F_ALLOW_LOCAL_REMOTE is not set. The commit
message does acknowledge this choice.
ip6_tnl_xmit_ctl() only returns a boolean, so callers can't tell its
refusal causes apart. Could ip6_tnl_xmit_ctl() return a drop reason
instead, so the loop case is reported like the one in ip6_tnl_xmit()?
> +
> + if (t->parms.collect_md) {
> tun_info = skb_tunnel_info_txcheck(skb);
> + if (IS_ERR(tun_info) ||
> + unlikely(ip_tunnel_info_af(tun_info) != AF_INET6)) {
> + reason = SKB_DROP_REASON_TUNNEL_TXINFO;
> + goto tx_err;
> + }
> + }
[Severity: Medium]
This early check only covers packets without valid IPv6 metadata. What
happens to an inner IPv6 packet from :: that does carry valid IPv6 TX
metadata on a collect_md ip6gre or ip6gretap device?
On such a device, raddr is :: because ip6gre_tap_validate() accepts an
omitted IFLA_GRE_REMOTE. ip6gre_xmit_ipv6() still compares the inner
source address with raddr, even in collect_md mode:
net/ipv6/ip6_gre.c:ip6gre_xmit_ipv6() {
...
if (ipv6_addr_equal(&t->parms.raddr, &ipv6h->saddr))
return SKB_DROP_REASON_RECURSION_LIMIT;
...
}
As a result, every inner IPv6 packet sourced from :: is dropped, even if
key->u.ipv6.dst holds a real endpoint. One example is the DAD Neighbour
Solicitation of a VM behind an OVS collect_md ip6gretap port.
With this patch, that drop goes to kfree_skb_reason() as
SKB_DROP_REASON_RECURSION_LIMIT. dropreason-core.h documents that reason
as a "Dead loop on virtual device", but no loop exists here. Drop
monitoring tools would then report a routing loop for ordinary DAD or
MLD traffic.
The commit message notes this case:
A packet from :: that carries IPv6 metadata still meets the check in
ip6gre_xmit_ipv6().
ip6erspan_tunnel_xmit() in the same file only runs the raddr/saddr test
in native mode. ip6_tnl_start_xmit() in net/ipv6/ip6_tunnel.c applies
ip6_tnl_addr_conflict() to collect_md ip6tnl devices as well, and it now
reports the same RECURSION_LIMIT reason.
The drop itself predates this series. The check came from c12b395a4664,
and 6712abc168eb left it in place for collect_md. The RECURSION_LIMIT
label is new, though, and the last patch in the series only touches
vxlan, so it is still there at the end of the series.
Would it make sense to guard the test in ip6gre_xmit_ipv6() (and in
ip6_tnl_start_xmit()) with !t->parms.collect_md, as
ip6erspan_tunnel_xmit() does?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930183910.3151873-1-littlesmilingcloud%40gmail.com
next prev parent reply other threads:[~2026-10-04 21:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 18:38 [PATCH net-next v5 00/14] tunnels: add core and gre drop reasons Anton Danilov
2026-09-30 18:38 ` [PATCH net-next v5 01/14] vxlan: rename the drop reasons for use by other tunnels Anton Danilov
2026-09-30 18:38 ` [PATCH net-next v5 02/14] ip_tunnel: make __iptunnel_pull_header() return a drop reason Anton Danilov
2026-10-04 21:00 ` netdev-bot+sashiko
2026-09-30 18:38 ` [PATCH net-next v5 03/14] vxlan: report the drop reason of __iptunnel_pull_header() Anton Danilov
2026-09-30 18:39 ` [PATCH net-next v5 04/14] ip_tunnel: add drop reasons to the generic RX path Anton Danilov
2026-10-04 16:06 ` Ido Schimmel
2026-09-30 18:39 ` [PATCH net-next v5 05/14] ip6_tunnel: add drop reasons to the receive path Anton Danilov
2026-10-04 16:47 ` Ido Schimmel
2026-10-04 21:00 ` netdev-bot+sashiko
2026-09-30 18:39 ` [PATCH net-next v5 06/14] gre: make gre_parse_header() report a drop reason Anton Danilov
2026-09-30 18:39 ` [PATCH net-next v5 07/14] ip_gre: add drop reasons to the RX path Anton Danilov
2026-10-04 21:00 ` netdev-bot+sashiko
2026-09-30 18:39 ` [PATCH net-next v5 08/14] ip6_gre: " Anton Danilov
2026-09-30 18:39 ` [PATCH net-next v5 09/14] ip_tunnel: add drop reasons to the transmit path Anton Danilov
2026-10-04 16:08 ` Ido Schimmel
2026-10-04 16:15 ` Ido Schimmel
2026-09-30 18:39 ` [PATCH net-next v5 10/14] ip_gre: " Anton Danilov
2026-09-30 18:39 ` [PATCH net-next v5 11/14] ip6_gre: make prepare_ip6gre_xmit_other() void Anton Danilov
2026-09-30 18:39 ` [PATCH net-next v5 12/14] ip6_tunnel: make ip6_tnl_xmit() return a drop reason Anton Danilov
2026-10-04 21:00 ` netdev-bot+sashiko
2026-09-30 18:39 ` [PATCH net-next v5 13/14] ip6_gre: add drop reasons to the transmit path Anton Danilov
2026-10-04 21:00 ` netdev-bot+sashiko [this message]
2026-09-30 18:39 ` [PATCH net-next v5 14/14] vxlan: report a circular route as SKB_DROP_REASON_RECURSION_LIMIT Anton Danilov
2026-10-04 16:50 ` [PATCH net-next v5 00/14] tunnels: add core and gre drop reasons Ido Schimmel
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=179114765080.434549.7267204104417826416@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=littlesmilingcloud@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®