From: netdev-bot+sashiko@kernel.org
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, pablo@netfilter.org, fw@strlen.de,
phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
jiri@resnulli.us, victor@mojatatu.com, sashiko-bot@kernel.org
Subject: Re: [PATCH net-next v3 3/4] netfilter: nft_fwd_netdev: drop the stale dst when steering to a device
Date: Mon, 16 Nov 2026 10:48:16 +0000 [thread overview]
Message-ID: <179482609603.3136.17659916489453837940@kernel.org> (raw)
In-Reply-To: <CORE-9NOG.v3.r0.20261115050625-3@mojatatu.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] The commit message justifies the change by saying "the route
dst is never consulted", but that only holds for the neighbour lookup.
- [Low] This patch fixes a user-visible bug but has no Fixes: tag.
--
netfilter: nft_fwd_netdev: drop the stale dst when steering to a device
This patch makes the neighbour variant of the nft fwd expression release
the skb's dst before switching skb->dev to the configured device. Without
this, a packet parked on an incomplete neighbour's arp_queue could later
be sent with the link-layer header of the device it was originally routed
through. The release goes through skb_dst_drop_keep_metadata(), so
LWT/tunnel metadata is kept, and the packet is dropped if that copy fails.
Link: https://lore.kernel.org/netdev/QDISC-6HS9.v3.r0.20261103062649-2@mojatatu.com/
Link: https://lore.kernel.org/netdev/avTfQjFQYR2NNdRg@chamomile/
> diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
> index 7447da931a957..f486c7be385cf 100644
> --- a/net/netfilter/nft_fwd_netdev.c
> +++ b/net/netfilter/nft_fwd_netdev.c
[ ... ]
> @@ -160,6 +161,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
> goto out;
> }
>
> + if (!skb_dst_drop_keep_metadata(skb)) {
> + verdict = NF_DROP;
> + goto out;
> + }
> +
[Severity: Low]
Should this have a Fixes: tag? The skb->dev = dev switch and the
neigh_xmit() call in nft_fwd_neigh_eval() both come from:
d32de98ea70f ("netfilter: nft_fwd_netdev: allow to forward packets via neighbour layer")
That commit changed the device without releasing the dst, which is the
behaviour fixed here. Something like this would help stable pick it up:
Fixes: d32de98ea70f ("netfilter: nft_fwd_netdev: allow to forward packets via neighbour layer")
This patch also needs skb_dst_drop_keep_metadata(), which is added by the
earlier patch in this series, "net: dst: keep the LWT metadata of a
dropped route". Could that dependency be stated for backporters?
[Severity: Medium]
The commit message says:
Both lookup inputs the neighbour transmission needs, the device and the
nexthop, are supplied by the rule, so the route dst is never consulted.
Is that true beyond the neighbour lookup? This call runs for every packet
the neighbour variant of fwd handles, not only for packets that end up on
an incomplete neighbour's arp_queue. For a plain route,
skb_dst_drop_keep_metadata() ends up in skb_dst_drop(). After that, code on
the configured device's transmit path sees skb_dst(skb) == NULL.
One example is an NBMA ipip/gre device (tnl_params->daddr == 0) used as
the fwd target:
nft_fwd_neigh_eval()
skb_dst_drop_keep_metadata()
neigh_xmit()
... dev_queue_xmit()
ip_tunnel_xmit()
net/ipv4/ip_tunnel.c:ip_tunnel_xmit() {
...
dst = tnl_params->daddr;
if (dst == 0) {
/* NBMA tunnel */
if (!skb_dst(skb)) {
DEV_STATS_INC(dev, tx_fifo_errors);
goto tx_error;
}
...
rt = skb_rtable(skb);
dst = rt_nexthop(rt, inner_iph->daddr);
...
}
Before this patch, "fwd ip to X device tunX" on such a tunnel picked the
destination with rt_nexthop() of the old route. Now the packet would be
dropped and counted in tx_fifo_errors.
The ip6_tnl/sit NBMA paths that call dst_neigh_lookup(skb_dst(skb), ...)
look like they are affected the same way. So does route realm (tclassid)
classification on the target device's qdisc.
The change may well be correct overall. Could the commit message describe
this effect on the resolved-neighbour path too, and not only the arp_queue
drain?
> local_bh_disable();
> if (nf_dev_xmit_recursion()) {
> local_bh_enable();
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/CORE-9NOG.v3.r0.20261115050625%40mojatatu.com
next prev parent reply other threads:[~2026-11-16 10:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 10:19 [PATCH net-next v3 0/4] net: drop the stale dst when steering to another device Jamal Hadi Salim
2026-11-15 10:19 ` [PATCH net-next v3 1/4] net: xfrm: interface: restore dst_orig on every xfrm interface Jamal Hadi Salim
2026-11-16 10:48 ` netdev-bot+sashiko
2026-11-15 10:19 ` [PATCH net-next v3 2/4] net: dst: keep the LWT metadata of a dropped route Jamal Hadi Salim
2026-11-16 10:48 ` netdev-bot+sashiko
2026-11-15 10:19 ` [PATCH net-next v3 3/4] netfilter: nft_fwd_netdev: drop the stale dst when steering to a device Jamal Hadi Salim
2026-11-16 10:48 ` netdev-bot+sashiko [this message]
2026-11-15 10:19 ` [PATCH net-next v3 4/4] bpf: drop the stale dst when redirecting to an explicit nexthop Jamal Hadi Salim
2026-11-16 10:48 ` netdev-bot+sashiko
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=179482609603.3136.17659916489453837940@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=sashiko-bot@kernel.org \
--cc=victor@mojatatu.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