* [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup()
@ 2026-11-17 11:08 Leonard Lausen
2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Leonard Lausen @ 2026-11-17 11:08 UTC (permalink / raw)
To: netdev
Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Pablo Neira Ayuso,
Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann,
netfilter-devel, coreteam, linux-kselftest, linux-kernel
This revision removes the cached-exception patch and its PMTU test, as
requested. The series fixes the nftables regression introduced by
1c32b24c234b and leaves dst-based prefix suppression unchanged. The
cached-exception work is deferred to net-next after the fib6_lookup()
fix is present there. Interface-group suppression also remains deferred.
Patch 1 makes fib6_lookup() honor suppress_prefixlength while preserving
terminal reject results, including blackhole nexthop objects. Patch 2
adds six checks to nft_fib.sh using its existing fixture.
Changes since v3:
- Drop the cached-exception fix and its PMTU regression case.
- Remove the PMTU-only gateway and peer setup from the test fixture.
- Renumber the remaining fix and test patches as a two-patch series.
V3 review:
https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/T/#t
The rebuilt v7.4-rc2-based laptop kernel now contains the v4 series,
without the deferred cached-exception fix. All six added selftest checks
pass in normal and eight-second-delayed runs; both full runs exit 0.
Twelve separate reject-route controls also pass. The changed source
compiles without warnings and passes 17 focused ASan/UBSan callback
checks. Automated kernel-log checks were unavailable. Target-net runtime
and full W=1 config builds remain unchecked.
OpenAI Codex assisted with investigation, reproduction, implementation,
tests and descriptions. Prompts asked it to investigate VPN failures,
simplify the series and address review feedback.
Leonard Lausen (2):
ipv6: Honor suppress_prefixlength in fib6_lookup()
selftests: netfilter: cover IPv6 FIB prefix suppression
net/ipv6/fib6_rules.c | 6 ++
.../selftests/net/netfilter/nft_fib.sh | 90 +++++++++++++++++++
2 files changed, 96 insertions(+)
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.55.0
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 11:08 [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen @ 2026-11-17 11:08 ` Leonard Lausen 2026-11-17 16:12 ` Ido Schimmel 2026-11-20 11:10 ` netdev-bot+sashiko 2026-11-17 11:08 ` [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen 2026-11-17 12:56 ` [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Pablo Neira Ayuso 2 siblings, 2 replies; 12+ messages in thread From: Leonard Lausen @ 2026-11-17 11:08 UTC (permalink / raw) To: netdev Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel When custom FIB rules are configured, fib6_lookup() performs the lookup via fib6_rule_action_alt() which calls fib6_table_lookup() and only populates the f6i, nh, fib6_flags and fib6_type fields of the FIB result. However, fib6_rule_suppress() only examines the rt6 field, which is only populated when the lookup is performed via one of the callers of fib6_rule_lookup() such as ip6_route_output(). As a result, fib6_lookup() ignores suppress_prefixlength. This was not a problem for nftables until commit 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup") switched the FIB expression from ip6_route_lookup() / nf_ip6_route() to fib6_lookup(). Since then, with a rule that suppresses the default route in the main table before looking up a VPN table (as commonly configured for WireGuard), the FIB expression returns the suppressed default route instead of the VPN route. Strict reverse path filtering then drops replies received over the VPN. Fix by evaluating suppress_prefixlength against the prefix length of the FIB entry when the lookup is performed via fib6_lookup(). fib_rules_lookup() only invokes the suppress callback when the rule action returns 0. Unlike __fib6_rule_action(), fib6_rule_action_alt() returns 0 for reject routes and instead sets RTF_REJECT in the result. Do not suppress such routes so that they continue to terminate the lookup, as with ip6_route_output() and IPv4. Check the flags in the result rather than in the FIB entry so that blackhole nexthop objects are also covered. suppress_ifgroup is not handled since fib6_table_lookup() does not perform multipath selection and the nexthop it returns might not be the one that is eventually used. Observed during WireGuard use and reproduced on unmodified v7.4-rc2, without instrumentation or error injection. Verified with namespace probes and nft_fib.sh on the rebuilt v7.4-rc2-based kernel. Fixes: 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup") Link: https://github.com/firewalld/firewalld/issues/1600 Signed-off-by: Leonard Lausen <leonard@lausen.nl> --- v4: - Drop the preceding cached-exception fix; dst-based suppression remains unchanged. The fib6_lookup() change itself is unchanged from v3. Verified on the rebuilt v4 laptop kernel (7.4.0-rc2+ #6): all six added checks pass in full normal and eight-second-delayed nft_fib.sh runs. Both runs exit 0; twelve separate reject-route controls also pass. V3 review: https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/T/#t net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 0ffd7b47a046..7efb0515b5c8 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -286,6 +286,12 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule, struct rt6_info *rt = res->rt6; struct net_device *dev = NULL; + if (arg->lookup_ptr == fib6_table_lookup) { + /* fib6_table_lookup() returns 0 for reject routes. */ + return !(res->fib6_flags & RTF_REJECT) && + res->f6i->fib6_dst.plen <= rule->suppress_prefixlen; + } + if (!rt) return false; -- 2.55.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen @ 2026-11-17 16:12 ` Ido Schimmel 2026-11-20 11:10 ` netdev-bot+sashiko 1 sibling, 0 replies; 12+ messages in thread From: Ido Schimmel @ 2026-11-17 16:12 UTC (permalink / raw) To: Leonard Lausen Cc: netdev, David Ahern, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel On Tue, Nov 17, 2026 at 11:08:11AM +0000, Leonard Lausen wrote: > When custom FIB rules are configured, fib6_lookup() performs the lookup > via fib6_rule_action_alt() which calls fib6_table_lookup() and only > populates the f6i, nh, fib6_flags and fib6_type fields of the FIB > result. However, fib6_rule_suppress() only examines the rt6 field, which > is only populated when the lookup is performed via one of the callers of > fib6_rule_lookup() such as ip6_route_output(). As a result, > fib6_lookup() ignores suppress_prefixlength. > > This was not a problem for nftables until commit 1c32b24c234b > ("netfilter: nft_fib_ipv6: switch to fib6_lookup") switched the FIB > expression from ip6_route_lookup() / nf_ip6_route() to fib6_lookup(). > Since then, with a rule that suppresses the default route in the main > table before looking up a VPN table (as commonly configured for > WireGuard), the FIB expression returns the suppressed default route > instead of the VPN route. Strict reverse path filtering then drops > replies received over the VPN. > > Fix by evaluating suppress_prefixlength against the prefix length of > the FIB entry when the lookup is performed via fib6_lookup(). > > fib_rules_lookup() only invokes the suppress callback when the rule > action returns 0. Unlike __fib6_rule_action(), fib6_rule_action_alt() > returns 0 for reject routes and instead sets RTF_REJECT in the result. > Do not suppress such routes so that they continue to terminate the > lookup, as with ip6_route_output() and IPv4. Check the flags in the > result rather than in the FIB entry so that blackhole nexthop objects > are also covered. > > suppress_ifgroup is not handled since fib6_table_lookup() does not > perform multipath selection and the nexthop it returns might not be the > one that is eventually used. Simply deriving the 'ifgroup' from the first nexthop device would be consistent with IPv4 and it only matters if someone is not putting all the nexthop devices of a route in the same 'ifgroup', which would be weird. I suspect 'suppress_ifgroup' is hardly used. Anyway, this can be deferred to net-next. > > Observed during WireGuard use and reproduced on unmodified v7.4-rc2, > without instrumentation or error injection. Verified with namespace > probes and nft_fib.sh on the rebuilt v7.4-rc2-based kernel. > > Fixes: 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup") > Link: https://github.com/firewalld/firewalld/issues/1600 > Signed-off-by: Leonard Lausen <leonard@lausen.nl> Reviewed-by: Ido Schimmel <idosch@nvidia.com> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen 2026-11-17 16:12 ` Ido Schimmel @ 2026-11-20 11:10 ` netdev-bot+sashiko 2026-11-20 15:35 ` Ido Schimmel 1 sibling, 1 reply; 12+ messages in thread From: netdev-bot+sashiko @ 2026-11-20 11:10 UTC (permalink / raw) To: leonard Cc: netdev, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, pablo, fw, phil, shuah, daniel, netfilter-devel, coreteam, linux-kselftest, linux-kernel 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 new RTF_REJECT exemption in fib6_rule_suppress() is justified in the commit message by "Do not suppress such routes so… - [Low] The commit message names only the nftables FIB expression as affected. -- ipv6: Honor suppress_prefixlength in fib6_lookup() This patch makes fib6_rule_suppress() check suppress_prefixlength against the prefix length of the FIB entry when the lookup goes through fib6_lookup(). On that path res->rt6 is not populated. Routes with RTF_REJECT set in the result are not suppressed, so they still end the lookup. Link: https://github.com/firewalld/firewalld/issues/1600 > diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c > index 0ffd7b47a0460..7efb0515b5c8b 100644 > --- a/net/ipv6/fib6_rules.c > +++ b/net/ipv6/fib6_rules.c > @@ -286,6 +286,12 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule, > struct rt6_info *rt = res->rt6; > struct net_device *dev = NULL; > > + if (arg->lookup_ptr == fib6_table_lookup) { [Severity: Low] The commit message only mentions the nftables FIB expression. However, every fib6_lookup() caller takes this branch once net->ipv6.fib6_has_custom_rules is set. Should the changelog also mention the other callers whose results change? For example, bpf_ipv6_fib_lookup() in net/core/filter.c calls fib6_lookup() when BPF_FIB_LOOKUP_DIRECT is not set: err = fib6_lookup(net, oif, &fl6, &res, strict); So XDP and tc programs that call bpf_fib_lookup() for AF_INET6 will now get the route from a later table, not the suppressed default route in the main table. Gateway validation in ip6_route_check_nh() in net/ipv6/route.c also goes through fib6_lookup(): err = fib6_lookup(net, cfg->fc_ifindex, &fl6, &res, flags); This path is used for IPv6 nexthop objects. Outside a VRF, nh_create_ipv6() sets fc_table from l3mdev_fib_table(dev), which is 0. It is also used for route adds when the gateway is not found in cfg->fc_table. A gateway that used to resolve through a no-gateway route such as "default dev X" can now resolve to a different device once that route is suppressed. If no later rule finds a route on the requested device, the add fails with -EHOSTUNREACH. This probably brings IPv6 closer to the ip6_route_output() and IPv4 fib4_rule_suppress() behaviour, which is likely what you want. Since the Fixes: tag will take this to stable, could the changelog mention the user-visible changes to bpf_fib_lookup() and to route and nexthop validation? > + /* fib6_table_lookup() returns 0 for reject routes. */ > + return !(res->fib6_flags & RTF_REJECT) && > + res->f6i->fib6_dst.plen <= rule->suppress_prefixlen; [Severity: Medium] Does the RTF_REJECT exemption also catch RTN_THROW routes? The commit message says: Do not suppress such routes so that they continue to terminate the lookup, as with ip6_route_output() and IPv4. But rtm_to_fib6_config() sets RTF_REJECT for throw routes as well: if (rtm->rtm_type == RTN_UNREACHABLE || rtm->rtm_type == RTN_BLACKHOLE || rtm->rtm_type == RTN_PROHIBIT || rtm->rtm_type == RTN_THROW) cfg->fc_flags |= RTF_REJECT; On the fib6_lookup() path, fib6_rule_action_alt() returns 0 for any matched entry other than fib6_null_entry: err = fib6_table_lookup(net, table, *oif, flp6, res, flags); if (!err && res->f6i != net->ipv6.fib6_null_entry) err = fib6_rule_saddr(net, rule, flags, flp6, res->nh->fib_nh_dev); else err = -EAGAIN; So fib_rules_lookup() calls fib6_rule_suppress(). This branch returns false because RTF_REJECT is set, and the rule walk stops with an RTN_THROW result. On the ip6_route_output() path, __fib6_rule_action() returns rt->dst.error, which comes from fib6_prop[RTN_THROW] = -EAGAIN. IPv4 fib_table_lookup() returns fib_props[RTN_THROW].error = -EAGAIN. In both cases fib_rules_lookup() goes on to the next rule, so a throw route never ends the lookup there. For example, take "throw default" in the main table with a "table main suppress_prefixlength 0" rule. ip6_route_output() would continue to the next rule, but fib6_lookup() stops at the throw route. nft_fib6_eval_type() then reports RTN_THROW, and nft_fib6_eval() returns no oif: if (ret || res.fib6_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) return; That can lead to strict RPF drops. bpf_ipv6_fib_lookup() also returns BPF_FIB_LKUP_RET_NOT_FWDED even though a later rule would match. The throw handling in fib6_rule_action_alt() predates this patch. However, before 1c32b24c234b the nft code used ip6_route_lookup() and nf_ip6_route(), which handled throw routes correctly. The reject-route checks described in the notes seem to cover only blackhole, unreachable and prohibit routes. Could fib6_rule_action_alt() return -EAGAIN when res->fib6_type == RTN_THROW? The RTF_REJECT exemption here would then cover only routes that really end the lookup. > + } [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117110813.9894-2-leonard%40lausen.nl ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-20 11:10 ` netdev-bot+sashiko @ 2026-11-20 15:35 ` Ido Schimmel 0 siblings, 0 replies; 12+ messages in thread From: Ido Schimmel @ 2026-11-20 15:35 UTC (permalink / raw) To: netdev-bot+sashiko Cc: leonard, netdev, dsahern, davem, edumazet, kuba, pabeni, horms, pablo, fw, phil, shuah, daniel, netfilter-devel, coreteam, linux-kselftest, linux-kernel On Fri, Nov 20, 2026 at 11:10:50AM +0000, netdev-bot+sashiko@kernel.org wrote: > [Severity: Medium] > > Does the RTF_REJECT exemption also catch RTN_THROW routes? > > The commit message says: > > Do not suppress such routes so that they continue to terminate the > lookup, as with ip6_route_output() and IPv4. > > But rtm_to_fib6_config() sets RTF_REJECT for throw routes as well: > > if (rtm->rtm_type == RTN_UNREACHABLE || > rtm->rtm_type == RTN_BLACKHOLE || > rtm->rtm_type == RTN_PROHIBIT || > rtm->rtm_type == RTN_THROW) > cfg->fc_flags |= RTF_REJECT; > > On the fib6_lookup() path, fib6_rule_action_alt() returns 0 for any > matched entry other than fib6_null_entry: > > err = fib6_table_lookup(net, table, *oif, flp6, res, flags); > if (!err && res->f6i != net->ipv6.fib6_null_entry) > err = fib6_rule_saddr(net, rule, flags, flp6, > res->nh->fib_nh_dev); > else > err = -EAGAIN; > > So fib_rules_lookup() calls fib6_rule_suppress(). This branch returns > false because RTF_REJECT is set, and the rule walk stops with an > RTN_THROW result. > > On the ip6_route_output() path, __fib6_rule_action() returns > rt->dst.error, which comes from fib6_prop[RTN_THROW] = -EAGAIN. IPv4 > fib_table_lookup() returns fib_props[RTN_THROW].error = -EAGAIN. In both > cases fib_rules_lookup() goes on to the next rule, so a throw route never > ends the lookup there. > > For example, take "throw default" in the main table with a "table main > suppress_prefixlength 0" rule. ip6_route_output() would continue to the > next rule, but fib6_lookup() stops at the throw route. > > nft_fib6_eval_type() then reports RTN_THROW, and nft_fib6_eval() returns > no oif: > > if (ret || res.fib6_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) > return; > > That can lead to strict RPF drops. bpf_ipv6_fib_lookup() also returns > BPF_FIB_LKUP_RET_NOT_FWDED even though a later rule would match. > > The throw handling in fib6_rule_action_alt() predates this patch. > However, before 1c32b24c234b the nft code used ip6_route_lookup() and > nf_ip6_route(), which handled throw routes correctly. The reject-route > checks described in the notes seem to cover only blackhole, unreachable > and prohibit routes. > > Could fib6_rule_action_alt() return -EAGAIN when res->fib6_type == > RTN_THROW? The RTF_REJECT exemption here would then cover only routes > that really end the lookup. Already addressed in: https://lore.kernel.org/netdev/20261119165758.GA2050378@shredder/ It's a pre-existing issue and one that is unlikely to bother anyone, unlike the issue being fixed by this patch. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression 2026-11-17 11:08 [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen 2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen @ 2026-11-17 11:08 ` Leonard Lausen 2026-11-20 11:10 ` netdev-bot+sashiko 2026-11-17 12:56 ` [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Pablo Neira Ayuso 2 siblings, 1 reply; 12+ messages in thread From: Leonard Lausen @ 2026-11-17 11:08 UTC (permalink / raw) To: netdev Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel Extend nft_fib.sh using its existing namespaces and counter helper to check that suppress_prefixlength 0 suppresses a default route while retaining a more-specific route. Check that blackhole, unreachable and prohibit routes remain terminal despite a usable route in a later table. Include a blackhole nexthop object to distinguish result reject flags from flags on the FIB entry. Require a positive counter for the expected nftables FIB result. Compare it with the output device or rejection error from an ordinary lookup. Label ruleset-load failures and skip the affected checks when IPv6 prefix suppression or nexthop objects are unavailable. Run these checks after the existing default-table tests so that adding policy rules does not remove coverage of the path without custom IPv6 rules. The router's logging RPF rules have already been removed by then, allowing neighbour discovery during intentionally different reverse-route states. Signed-off-by: Leonard Lausen <leonard@lausen.nl> --- v4: - Drop the cached-default PMTU case and its fixture setup. - Retain the six prefix-suppression and terminal-reject checks from v3. Verified on the rebuilt v4 laptop kernel (7.4.0-rc2+ #6): all six added checks pass in full normal and eight-second-delayed nft_fib.sh runs. Both runs exit 0; twelve separate reject-route controls also pass. V3 review: https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/T/#t .../selftests/net/netfilter/nft_fib.sh | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/tools/testing/selftests/net/netfilter/nft_fib.sh b/tools/testing/selftests/net/netfilter/nft_fib.sh index 04544905c216..25e13197f057 100755 --- a/tools/testing/selftests/net/netfilter/nft_fib.sh +++ b/tools/testing/selftests/net/netfilter/nft_fib.sh @@ -202,6 +202,50 @@ check_fib_counter() { return 0 } +# Count probes matching the expected FIB result, then drop them. +test_fib_suppress() { + local label="$1" expected="$2" + local result="${3:-oifname}" error err=0 + + if ! ip netns exec "$nsrouter" nft -f /dev/stdin <<EOF +flush table ip6 filter +table ip6 filter { + chain prerouting { + type filter hook prerouting priority -1; + ip6 saddr dead:1::99 icmpv6 type echo-request \ + fib saddr . mark $result "$expected" counter drop + } +} +EOF + then + echo "FAIL: $label (could not load ruleset)" + return 1 + fi + ip netns exec "$ns1" ping -6 -c 1 -W 0.1 -q dead:1::1 > /dev/null 2>&1 + if [ "$result" = type ]; then + case "$expected" in + blackhole) error="Invalid argument" ;; + unreachable) error="No route to host" ;; + prohibit) error="Permission denied" ;; + esac + LC_ALL=C ip -net "$nsrouter" -6 route get dead:1::99 \ + from dead:1::1 2>&1 | + grep -Fxq "RTNETLINK answers: $error" || err=1 + else + ip -net "$nsrouter" -6 route get dead:1::99 from dead:1::1 | + grep -q "dev $expected " || err=1 + fi + if check_fib_type_counter_family ip6 1 "$nsrouter" prerouting \ + "$result" "$label" && + [ "$err" -eq 0 ]; then + echo "PASS: $label" + else + echo "FAIL: $label" + ret=1 + return 1 + fi +} + load_ruleset "$nsrouter" load_ruleset "$ns1" load_ruleset "$ns2" @@ -845,6 +889,52 @@ test_fib_type "default table" ip netns exec "$nsrouter" nft delete table ip filter ip netns exec "$nsrouter" nft delete table ip6 filter +# Keep the earlier IPv6 checks on the path without custom rules. +# The router's logging RPF rules have already been removed here. +if ip -net "$nsrouter" -6 rule add pref 100 to dead:1::99 table 128 \ + suppress_prefixlength 0; then + ip -net "$nsrouter" -6 route add table 128 default dev veth1 || exit 1 + ip -net "$nsrouter" -6 route add table 129 dead:1::/64 \ + dev veth0 || exit 1 + ip -net "$nsrouter" -6 rule add pref 101 to dead:1::99 \ + table 129 || exit 1 + ip netns exec "$nsrouter" nft add table ip6 filter || exit 1 + + test_fib_suppress "suppress default route" veth0 || ret=1 + ip -net "$nsrouter" -6 route add table 128 dead:1::/64 \ + dev veth1 || exit 1 + test_fib_suppress "retain non-default route" veth1 || ret=1 + ip -net "$nsrouter" -6 route del table 128 dead:1::/64 \ + dev veth1 || exit 1 + + for type in blackhole unreachable prohibit; do + ip -net "$nsrouter" -6 route replace "$type" default \ + table 128 || exit 1 + test_fib_suppress "retain $type" "$type" type || ret=1 + done + + if ip -net "$nsrouter" -6 nexthop add id 1 blackhole; then + ip -net "$nsrouter" -6 route replace default nhid 1 \ + table 128 || exit 1 + test_fib_suppress "retain blackhole nexthop" \ + blackhole type || ret=1 + ip -net "$nsrouter" -6 route del table 128 default + ip -net "$nsrouter" -6 nexthop del id 1 + else + echo "SKIP: blackhole nexthop objects unavailable" + [ "$ret" -eq 0 ] && ret=$ksft_skip + ip -net "$nsrouter" -6 route del table 128 default + fi + + ip -net "$nsrouter" -6 rule del pref 100 + ip -net "$nsrouter" -6 rule del pref 101 + ip -net "$nsrouter" -6 route flush table 129 + ip netns exec "$nsrouter" nft delete table ip6 filter +else + echo "SKIP: IPv6 prefix suppression unavailable" + [ "$ret" -eq 0 ] && ret=$ksft_skip +fi + test_fib_vrf exit $ret -- 2.55.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression 2026-11-17 11:08 ` [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen @ 2026-11-20 11:10 ` netdev-bot+sashiko 0 siblings, 0 replies; 12+ messages in thread From: netdev-bot+sashiko @ 2026-11-20 11:10 UTC (permalink / raw) To: leonard Cc: netdev, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, pablo, fw, phil, shuah, daniel, netfilter-devel, coreteam, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The new in-tree comment before the IPv6 prefix-suppression block in tools/testing/selftests/net/netfilter/nft_fib.sh says "The router's… -- selftests: netfilter: cover IPv6 FIB prefix suppression This adds IPv6 checks to nft_fib.sh for suppress_prefixlength 0. They verify that a default route is suppressed while a more-specific route is retained, and that blackhole, unreachable and prohibit routes (including a blackhole nexthop object) stay terminal. The checks run after the existing default-table tests. The commit message says: > The router's logging RPF rules have already been removed by then, > allowing neighbour discovery during intentionally different reverse-route > states. The same statement appears as a comment in the patch, covered inline below. > diff --git a/tools/testing/selftests/net/netfilter/nft_fib.sh b/tools/testing/selftests/net/netfilter/nft_fib.sh > index 04544905c2164..25e13197f0578 100755 > --- a/tools/testing/selftests/net/netfilter/nft_fib.sh > +++ b/tools/testing/selftests/net/netfilter/nft_fib.sh [ ... ] > @@ -845,6 +889,52 @@ test_fib_type "default table" > ip netns exec "$nsrouter" nft delete table ip filter > ip netns exec "$nsrouter" nft delete table ip6 filter > > +# Keep the earlier IPv6 checks on the path without custom rules. > +# The router's logging RPF rules have already been removed here. [Severity: Low] Is this comment accurate? Earlier, the script calls load_pbr_ruleset "$nsrouter", and that installs a logging RPF check in table inet filter: load_pbr_ruleset() { ... table inet filter { chain forward { type filter hook forward priority raw; fib saddr . iif oif gt 0 accept log drop } } ... } Between that load and this block, the only deletions are "nft delete table ip filter" and "nft delete table ip6 filter", after each test_fib_type call. Table inet filter is not flushed until the "flush ruleset" in load_ruleset_vrf(). The prerouting nft_rpfilter logging rules from load_ruleset() are gone at this point, since the earlier "nft flush ruleset" removed them. The forward-hook "log drop" chain is still loaded, though. The new probes (ping to dead:1::1) and neighbour discovery are delivered locally and never reach the forward hook, so the checks still pass. Could the comment, and the matching sentence in the commit message, say that it is the prerouting nft_rpfilter rules that have been removed, rather than all of the router's logging RPF rules? > +if ip -net "$nsrouter" -6 rule add pref 100 to dead:1::99 table 128 \ > + suppress_prefixlength 0; then [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117110813.9894-2-leonard%40lausen.nl ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 11:08 [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen 2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen 2026-11-17 11:08 ` [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen @ 2026-11-17 12:56 ` Pablo Neira Ayuso 2026-11-17 13:01 ` Leonard Lausen 2 siblings, 1 reply; 12+ messages in thread From: Pablo Neira Ayuso @ 2026-11-17 12:56 UTC (permalink / raw) To: Leonard Lausen Cc: netdev, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel On Tue, Nov 17, 2026 at 11:08:10AM +0000, Leonard Lausen wrote: > This revision removes the cached-exception patch and its PMTU test, as > requested. The series fixes the nftables regression introduced by > 1c32b24c234b and leaves dst-based prefix suppression unchanged. Is this a LLM finding? Or a real issue in production? > The cached-exception work is deferred to net-next after the > fib6_lookup() fix is present there. Interface-group suppression also > remains deferred. > > Patch 1 makes fib6_lookup() honor suppress_prefixlength while preserving > terminal reject results, including blackhole nexthop objects. Patch 2 > adds six checks to nft_fib.sh using its existing fixture. > > Changes since v3: > - Drop the cached-exception fix and its PMTU regression case. > - Remove the PMTU-only gateway and peer setup from the test fixture. > - Renumber the remaining fix and test patches as a two-patch series. > > V3 review: > https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/T/#t > > The rebuilt v7.4-rc2-based laptop kernel now contains the v4 series, > without the deferred cached-exception fix. All six added selftest checks > pass in normal and eight-second-delayed runs; both full runs exit 0. > Twelve separate reject-route controls also pass. The changed source > compiles without warnings and passes 17 focused ASan/UBSan callback > checks. Automated kernel-log checks were unavailable. Target-net runtime > and full W=1 config builds remain unchecked. > > OpenAI Codex assisted with investigation, reproduction, implementation, > tests and descriptions. Prompts asked it to investigate VPN failures, > simplify the series and address review feedback. > > Leonard Lausen (2): > ipv6: Honor suppress_prefixlength in fib6_lookup() > selftests: netfilter: cover IPv6 FIB prefix suppression > > net/ipv6/fib6_rules.c | 6 ++ > .../selftests/net/netfilter/nft_fib.sh | 90 +++++++++++++++++++ > 2 files changed, 96 insertions(+) > > > base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb > -- > 2.55.0 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 12:56 ` [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Pablo Neira Ayuso @ 2026-11-17 13:01 ` Leonard Lausen 2026-11-17 13:07 ` Pablo Neira Ayuso 0 siblings, 1 reply; 12+ messages in thread From: Leonard Lausen @ 2026-11-17 13:01 UTC (permalink / raw) To: Pablo Neira Ayuso Cc: netdev, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel Am 17.11.26 um 13:56 schrieb Pablo Neira Ayuso: > On Tue, Nov 17, 2026 at 11:08:10AM +0000, Leonard Lausen wrote: >> This revision removes the cached-exception patch and its PMTU test, as >> requested. The series fixes the nftables regression introduced by >> 1c32b24c234b and leaves dst-based prefix suppression unchanged. > > Is this a LLM finding? Or a real issue in production? This is a real issue. Without the fix, Wireguard VPN does not work with IPv6_rpfilter=strict firewalld setting (default setting). See https://github.com/firewalld/firewalld/issues/1600 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 13:01 ` Leonard Lausen @ 2026-11-17 13:07 ` Pablo Neira Ayuso 2026-11-17 15:24 ` Ido Schimmel 0 siblings, 1 reply; 12+ messages in thread From: Pablo Neira Ayuso @ 2026-11-17 13:07 UTC (permalink / raw) To: Leonard Lausen Cc: netdev, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel On Tue, Nov 17, 2026 at 02:01:24PM +0100, Leonard Lausen wrote: > Am 17.11.26 um 13:56 schrieb Pablo Neira Ayuso: > > On Tue, Nov 17, 2026 at 11:08:10AM +0000, Leonard Lausen wrote: > > > This revision removes the cached-exception patch and its PMTU test, as > > > requested. The series fixes the nftables regression introduced by > > > 1c32b24c234b and leaves dst-based prefix suppression unchanged. > > > > Is this a LLM finding? Or a real issue in production? > > This is a real issue. Without the fix, Wireguard VPN does not work with > IPv6_rpfilter=strict firewalld setting (default setting). See > https://github.com/firewalld/firewalld/issues/1600 OK. As Paolo suggests you explore fixing this from nft_fib itself, please keep this link in the cover letter. Thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 13:07 ` Pablo Neira Ayuso @ 2026-11-17 15:24 ` Ido Schimmel 2026-11-17 16:30 ` Paolo Abeni 0 siblings, 1 reply; 12+ messages in thread From: Ido Schimmel @ 2026-11-17 15:24 UTC (permalink / raw) To: Pablo Neira Ayuso Cc: Leonard Lausen, netdev, David Ahern, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel On Tue, Nov 17, 2026 at 02:07:11PM +0100, Pablo Neira Ayuso wrote: > As Paolo suggests you explore fixing this from nft_fib itself, Why? fib6_lookup() is the IPv6 counterpart of fib_lookup() which is used by nft_fib_ipv4. The fact that it's not working with 'suppress_prefixlength' is an oversight, which is being fixed here. Also, it's not like ip6_route_lookup() is working correctly with 'suppress_prefixlength' either. See the exception bug mentioned here [1]. Unlike the issue being fixed here, it's not a regression (always broken) and will be handled in net-next. [1] https://lore.kernel.org/netdev/20261115154639.GA4121811@shredder/ ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() 2026-11-17 15:24 ` Ido Schimmel @ 2026-11-17 16:30 ` Paolo Abeni 0 siblings, 0 replies; 12+ messages in thread From: Paolo Abeni @ 2026-11-17 16:30 UTC (permalink / raw) To: Ido Schimmel, Pablo Neira Ayuso Cc: Leonard Lausen, netdev, David Ahern, David S. Miller, Eric Dumazet, Jakub Kicinski, Simon Horman, Florian Westphal, Phil Sutter, Shuah Khan, Daniel Borkmann, netfilter-devel, coreteam, linux-kselftest, linux-kernel On 11/17/26 16:24, Ido Schimmel wrote: > On Tue, Nov 17, 2026 at 02:07:11PM +0100, Pablo Neira Ayuso wrote: >> As Paolo suggests you explore fixing this from nft_fib itself, > > Why? > > fib6_lookup() is the IPv6 counterpart of fib_lookup() which is used by > nft_fib_ipv4. The fact that it's not working with > 'suppress_prefixlength' is an oversight, which is being fixed here. I must admit I read the previous version as the issue was caused by an API misuse by nft. It looks like I misread it, I'm fine with this fix. /P ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-11-20 15:35 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-17 11:08 [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen 2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen 2026-11-17 16:12 ` Ido Schimmel 2026-11-20 11:10 ` netdev-bot+sashiko 2026-11-20 15:35 ` Ido Schimmel 2026-11-17 11:08 ` [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen 2026-11-20 11:10 ` netdev-bot+sashiko 2026-11-17 12:56 ` [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Pablo Neira Ayuso 2026-11-17 13:01 ` Leonard Lausen 2026-11-17 13:07 ` Pablo Neira Ayuso 2026-11-17 15:24 ` Ido Schimmel 2026-11-17 16:30 ` Paolo Abeni
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.