From: netdev-bot+sashiko@kernel.org
To: leonard@lausen.nl
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, pablo@netfilter.org,
fw@strlen.de, phil@nwl.cc, shuah@kernel.org,
daniel@iogearbox.net, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] ipv6: honor prefix-length suppression in raw FIB lookups
Date: Mon, 16 Nov 2026 11:49:41 +0000 [thread overview]
Message-ID: <179482978100.3136.17418106822071501090@kernel.org> (raw)
In-Reply-To: <20261115114434.10343-4-leonard@lausen.nl>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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] After this patch, the two halves of fib6_rule_suppress()
(net/ipv6/fib6_rules.c) take the prefix length from different places,…
--
ipv6: honor prefix-length suppression in raw FIB lookups
Raw IPv6 FIB lookups through fib6_lookup() fill in f6i and nh in
fib6_result but not rt6. Because of that, fib6_rule_suppress() never
applied suppress_prefixlength to them. This patch adds a raw-lookup branch
that compares the FIB entry's destination prefix length against the rule
and skips RTF_REJECT results. The dst-based path is left as it was.
Link: https://github.com/firewalld/firewalld/issues/1600
> diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
> index 0ffd7b47a0460..ceb4180bcf2f8 100644
> --- a/net/ipv6/fib6_rules.c
> +++ b/net/ipv6/fib6_rules.c
> @@ -283,9 +283,16 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
> struct fib_lookup_arg *arg)
> {
> struct fib6_result *res = arg->result;
> - struct rt6_info *rt = res->rt6;
> + struct rt6_info *rt;
> struct net_device *dev = NULL;
>
> + if (arg->lookup_ptr == fib6_table_lookup) {
> + /* Raw lookups report reject routes without an error. */
> + return !(res->fib6_flags & RTF_REJECT) &&
> + res->f6i->fib6_dst.plen <= rule->suppress_prefixlen;
> + }
[Severity: Medium]
Can the raw and dst paths now disagree for a destination that has a
cached exception route?
The new raw branch checks res->f6i->fib6_dst.plen, which is the FIB
entry's prefix length. The unchanged dst branch further down in
fib6_rule_suppress() checks the clone's prefix length instead:
if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
goto suppress_route;
For RTF_CACHE exception clones, ip6_rt_cache_alloc() always sets a /128
prefix:
net/ipv6/route.c:ip6_rt_cache_alloc() {
...
rt->rt6i_flags |= RTF_CACHE;
rt->rt6i_dst.addr = *daddr;
rt->rt6i_dst.plen = 128;
...
}
When a clone exists, ip6_pol_route() returns it directly, and
ip6_pol_route_lookup() does the same:
net/ipv6/route.c:ip6_pol_route() {
...
rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr);
if (rt) {
goto out;
...
}
Take a rule like "table main suppress_prefixlength 0", and a destination D
with a PMTU or redirect exception on the main-table default route.
An ordinary dst lookup for D does not suppress (128 > 0), so it keeps the
main default. With this patch, fib6_lookup() for D does suppress (0 <= 0)
and moves on to the next rule, for example the VPN table. Before the
patch, both paths returned the main default for D.
In a wg-quick style setup this could look like:
1. Unmarked traffic to D is routed out eth0.
2. Replies from D arrive on eth0.
3. nft_fib6_eval() runs "fib saddr . iif oif". The raw lookup now
resolves to the VPN table's wg0 route.
4. nft_fib6_info_nh_uses_dev() fails, and strict rpfilter drops the
replies, which passed before this patch.
bpf_fib_lookup and ip6_route_check_nh also go through fib6_lookup(), so
they could return a different egress than the stack in the same case.
A remote ICMPv6 Packet Too Big can create such an exception via
__ip6_rt_update_pmtu()->ip6_rt_cache_alloc()->rt6_insert_exception(). A
redirect can do the same. The mismatch then lasts until the exception
expires.
The commit message says "Keep the dst-based path unchanged" and treats the
ordinary lookup as the reference. However, that path already ignores
suppression for exception routes.
Should the dst branch use the parent FIB entry's prefix length for
RTF_CACHE routes (via rt->from), so that both paths agree? That would also
be closer to what fib4_rule_suppress() does for IPv4. If not, could the
commit message document this divergence?
> +
> + rt = res->rt6;
> if (!rt)
> return false;
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115114434.10343-2-leonard%40lausen.nl
next prev parent reply other threads:[~2026-11-16 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 11:44 [PATCH net v2 0/2] " Leonard Lausen
2026-11-15 11:44 ` [PATCH net v2 1/2] " Leonard Lausen
2026-11-15 15:46 ` Ido Schimmel
2026-11-16 11:49 ` netdev-bot+sashiko [this message]
2026-11-15 11:44 ` [PATCH net v2 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen
2026-11-16 11:49 ` 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=179482978100.3136.17418106822071501090@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=coreteam@netfilter.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonard@lausen.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.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=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 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®