Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · 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). - [High] The fix reads the prefix length from rt->from, the route that created the cached exception. - [Low] Baseline decision: false positive. -- ipv6: Use the FIB prefix length when suppressing cached routes This patch changes fib6_rule_suppress() so that suppress_prefixlen is compared against the prefix length of the parent FIB entry (rt->from) instead of rt6i_dst.plen. PMTU and redirect exceptions are /128 even under a default route, so they could slip past suppress_prefixlength 0. If the parent is gone, the old rt6i_dst.plen check is still used. Link: https://lore.kernel.org/netdev/2026…@shredder/
> diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c > index 7efb0515b5c8b..2f43e4e48e0d0 100644 > --- a/net/ipv6/fib6_rules.c > +++ b/net/ipv6/fib6_rules.c
[ ... ]
> @@ -298,10 +300,13 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule, > if (rt->rt6i_idev) > dev = rt->rt6i_idev->dev; > > + from = rcu_dereference(rt->from); > + plen = from ? from->fib6_dst.plen : rt->rt6i_dst.plen; > +
[Severity: High] Is rt->from always the fib6_info that was matched in the table this rule is evaluating? When routes use nexthop objects, the exception bucket lives in the nexthop's shared fib6_nh. Every fib6_info that references the same nhid shares that bucket, across tables. fib6_check_nexthop() says as much: net/ipv4/nexthop.c:fib6_check_nexthop() { /* fib6_src is unique to a fib6_info and limits the ability to cache * routes in fib6_nh within a nexthop that is potentially shared * across multiple fib entries. ... } ip6_pol_route()->rt6_find_cached_rt() finds the bucket through res->nh. It then matches only on daddr, plus saddr when subtrees are enabled: net/ipv6/route.c:rt6_find_cached_rt() { ... bucket = fib6_nh_get_excptn_bucket(res->nh, NULL); rt6_ex = __rt6_find_exception_rcu(&bucket, daddr, src_key); ... } Nothing checks that rt6_ex->rt6i->from == res->f6i. One bucket can hold exceptions with different parents, which is why fib6_nh_flush_exceptions() filters on ->from: net/ipv6/route.c:fib6_nh_flush_exceptions() { ... if (!from || rcu_access_pointer(rt6_ex->rt6i->from) == from) rt6_remove_exception(bucket, rt6_ex); ... } Can the bypass still happen with a setup like this? ip -6 rule add fwmark 1 lookup 200 ip -6 rule add lookup main suppress_prefixlength 0 ip -6 rule add lookup 100 (VPN table) table 200: 2001:db8::/32 via nhid 1 main: default via nhid 1 1. A remote ICMPv6 Packet Too Big arrives for a marked flow to D. __ip6_rt_update_pmtu() sets res.f6i to the /32 route and res.nh to the shared fib6_nh, then calls rt6_insert_exception(). 2. An unmarked flow to D matches the default route in main. rt6_find_cached_rt() returns the exception from step 1. 3. fib6_rule_suppress() computes plen as 32. That is greater than 0, so the route is not suppressed. The traffic then leaves via main instead of falling through to table 100. The opposite direction looks like a new regression. Suppose the exception was created through a default route (from->fib6_dst.plen == 0), and another table matches a more specific route on the same nexthop: - The old code saw plen 128 and accepted the route. - With this patch, plen is 0, so the specific route is suppressed and the lookup falls through to later rules. The fib6_table_lookup branch above already uses res->f6i->fib6_dst.plen, which is the entry matched in this table. On the rt6_info path, the matched res.f6i in ip6_pol_route() is dropped before fib6_rule_suppress() runs. Could the matched entry be passed through instead? Another option would be for rt6_find_cached_rt() to skip exceptions whose ->from does not match res->f6i. The selftest added later in the series does not use nexthop objects, so it would not catch this case.
> /* do not accept result if the route does > * not meet the required prefix length > */ > - if (rt->rt6i_dst.plen <= rule->suppress_prefixlen) > + if (plen <= rule->suppress_prefixlen) > goto suppress_route;
[Severity: Low] This isn't a bug, but with only this patch applied, no in-tree test reaches the rt6_info branch of fib6_rule_suppress() with a cached /128 exception under suppress_prefixlength 0. The IPv6 suppression cases in nft_fib.sh go through fib6_lookup() with lookup_ptr == fib6_table_lookup. fib_suppress_test() in fib_tests.sh only checks that nothing crashes. The next patch in the series closes this gap. It is "selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception" and adds a "suppress cached default route" case to nft_fib.sh. That case creates an MTU 1280 exception under the default route. It then checks the device returned by: ip -6 route get dead:1::99 from dead:1::1 That lookup goes through ip6_pol_route() and reaches the new rt->from logic.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40lausen.nl