* [PATCH net-next 0/2] ipv6: Use the FIB prefix length to suppress cached routes
@ 2026-12-02 17:30 Leonard Lausen
2026-12-02 17:30 ` [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing " Leonard Lausen
2026-12-02 17:30 ` [PATCH net-next 2/2] selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception Leonard Lausen
0 siblings, 2 replies; 4+ messages in thread
From: Leonard Lausen @ 2026-12-02 17:30 UTC (permalink / raw)
To: netdev
Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan,
netfilter-devel, coreteam, linux-kselftest
This is the cached-exception follow-up requested during review of the
previous prefix-suppression series. It targets net-next now that
94df5595e31b ("ipv6: Honor suppress_prefixlength in fib6_lookup()") and
its selftests are present in that tree.
The dst-based suppression callback still compares the /128 prefix of a
PMTU or redirect exception with suppress_prefixlength. A cached exception
can therefore bypass suppression of its parent default route. Patch 1
uses the parent FIB prefix when available. Patch 2 extends nft_fib.sh's
existing fixture with one PMTU regression case. Interface-group handling
and the fib6_lookup() path are unchanged.
The issue was raised by Ido and in automated review. These changes were
removed from the earlier net series at review; the implementation is
unchanged here. Review:
https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/
The new PMTU case fails on the pre-fix kernel. On the rebuilt net-next
kernel, all seven checks pass in normal and eight-second-delayed runs.
An independent ICMPv6 Packet Too Big reproducer confirms that both lookup
paths select the later table. Terminal-reject controls also pass.
The changed unit compiles with W=1 without warnings. Automated kernel-log
checks were unavailable in the test namespace; full W=1 allyesconfig and
allmodconfig builds remain unchecked.
OpenAI Codex assisted with reproduction, implementation, testing and
wording. Prompts asked it to investigate the routing mismatch, address
review feedback and prepare this separate net-next follow-up. Ido's
review identified the cached-exception problem.
Leonard Lausen (2):
ipv6: Use the FIB prefix length when suppressing cached routes
selftests: netfilter: cover IPv6 prefix suppression with a PMTU
exception
net/ipv6/fib6_rules.c | 7 ++++++-
.../selftests/net/netfilter/nft_fib.sh | 21 ++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
base-commit: 19c484e12ed269c1ce734f049cc5ccf12cb93a20
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing cached routes
2026-12-02 17:30 [PATCH net-next 0/2] ipv6: Use the FIB prefix length to suppress cached routes Leonard Lausen
@ 2026-12-02 17:30 ` Leonard Lausen
2026-12-03 9:02 ` Ido Schimmel
2026-12-02 17:30 ` [PATCH net-next 2/2] selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception Leonard Lausen
1 sibling, 1 reply; 4+ messages in thread
From: Leonard Lausen @ 2026-12-02 17:30 UTC (permalink / raw)
To: netdev
Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan,
netfilter-devel, coreteam, linux-kselftest
fib6_rule_suppress() compares suppress_prefixlen with rt6i_dst.plen.
PMTU and redirect exception routes have a /128 destination prefix even
when their parent FIB route is a default route. Consequently, a cached
exception bypasses suppress_prefixlength 0 and stops the rule lookup
instead of continuing to a later table.
Use the parent FIB entry's destination prefix length when available.
The rule lookup already holds the RCU read lock needed to read rt->from.
Retain the existing prefix check if the destination has lost its parent.
Interface-group checks and destination reference handling are unchanged.
Identified during maintainer review and reproduced using an ICMPv6
Packet Too Big in network namespaces, without kernel instrumentation
or error injection. The reproducer and nft_fib.sh pass on a rebuilt
net-next-based kernel.
Fixes: 7764a45a8f1f ("fib_rules: add .suppress operation")
Link: https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/
Signed-off-by: Leonard Lausen <leonard@lausen.nl>
---
Previously included in v3 of the prefix-suppression series, then removed
at review to be sent separately to net-next after the prerequisite fix.
The implementation is unchanged; the message records current validation.
Review:
https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/
net/ipv6/fib6_rules.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 7efb0515b5c8..2f43e4e48e0d 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -285,6 +285,8 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
struct fib6_result *res = arg->result;
struct rt6_info *rt = res->rt6;
struct net_device *dev = NULL;
+ struct fib6_info *from;
+ int plen;
if (arg->lookup_ptr == fib6_table_lookup) {
/* fib6_table_lookup() returns 0 for reject routes. */
@@ -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;
+
/* 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;
/* do not accept result if the route uses a device
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception
2026-12-02 17:30 [PATCH net-next 0/2] ipv6: Use the FIB prefix length to suppress cached routes Leonard Lausen
2026-12-02 17:30 ` [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing " Leonard Lausen
@ 2026-12-02 17:30 ` Leonard Lausen
1 sibling, 0 replies; 4+ messages in thread
From: Leonard Lausen @ 2026-12-02 17:30 UTC (permalink / raw)
To: netdev
Cc: leonard, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan,
netfilter-devel, coreteam, linux-kselftest
Create a PMTU exception for the first table's default route using the
existing peer namespace and an MTU-1280 route. Temporarily bypass
suppression while sending an oversized echo request, and require an
ordinary route lookup to show the resulting MTU before removing the
bypass rule.
Reuse test_fib_suppress() to check that both nftables and an ordinary
route lookup then select the later table. On the pre-fix kernel, this
new case fails while the other six suppression checks pass.
Signed-off-by: Leonard Lausen <leonard@lausen.nl>
---
This adds the PMTU case deferred from the earlier series, using the
suppression helper and six checks already merged in a0bf14e17fb2.
.../selftests/net/netfilter/nft_fib.sh | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/netfilter/nft_fib.sh b/tools/testing/selftests/net/netfilter/nft_fib.sh
index 25e13197f057..175bdfa825c9 100755
--- a/tools/testing/selftests/net/netfilter/nft_fib.sh
+++ b/tools/testing/selftests/net/netfilter/nft_fib.sh
@@ -893,7 +893,8 @@ ip netns exec "$nsrouter" nft delete table ip6 filter
# 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 128 default \
+ via dead:2::99 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 \
@@ -907,6 +908,24 @@ if ip -net "$nsrouter" -6 rule add pref 100 to dead:1::99 table 128 \
ip -net "$nsrouter" -6 route del table 128 dead:1::/64 \
dev veth1 || exit 1
+ # Seed a PMTU exception while bypassing suppression of its parent route.
+ ip -net "$ns2" -6 route add dead:1::99/128 via dead:2::1 \
+ dev eth0 mtu 1280 || exit 1
+ ip netns exec "$ns2" sysctl -qw net.ipv6.conf.all.forwarding=1
+ ip -net "$nsrouter" -6 rule add pref 99 to dead:1::99 \
+ table 128 || exit 1
+ ip netns exec "$nsrouter" ping -6 -I dead:2::1 -M do -s 1400 -c 1 -W 1 \
+ dead:1::99 > /dev/null 2>&1
+ if ! ip -net "$nsrouter" -6 route get dead:1::99 from dead:1::1 |
+ grep -q 'mtu 1280'; then
+ echo "FAIL: could not create PMTU exception"
+ exit 1
+ fi
+ ip -net "$nsrouter" -6 rule del pref 99
+ test_fib_suppress "suppress cached default route" veth0 || ret=1
+ ip -net "$ns2" -6 route del dead:1::99/128
+ ip netns exec "$ns2" sysctl -qw net.ipv6.conf.all.forwarding=0
+
for type in blackhole unreachable prohibit; do
ip -net "$nsrouter" -6 route replace "$type" default \
table 128 || exit 1
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing cached routes
2026-12-02 17:30 ` [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing " Leonard Lausen
@ 2026-12-03 9:02 ` Ido Schimmel
0 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2026-12-03 9:02 UTC (permalink / raw)
To: Leonard Lausen
Cc: netdev, David Ahern, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Pablo Neira Ayuso, Florian Westphal, Phil Sutter, Shuah Khan,
netfilter-devel, coreteam, linux-kselftest
On Wed, Dec 02, 2026 at 05:30:21PM +0000, Leonard Lausen wrote:
> fib6_rule_suppress() compares suppress_prefixlen with rt6i_dst.plen.
> PMTU and redirect exception routes have a /128 destination prefix even
> when their parent FIB route is a default route. Consequently, a cached
> exception bypasses suppress_prefixlength 0 and stops the rule lookup
> instead of continuing to a later table.
>
> Use the parent FIB entry's destination prefix length when available.
> The rule lookup already holds the RCU read lock needed to read rt->from.
> Retain the existing prefix check if the destination has lost its parent.
> Interface-group checks and destination reference handling are unchanged.
>
> Identified during maintainer review and reproduced using an ICMPv6
> Packet Too Big in network namespaces, without kernel instrumentation
> or error injection. The reproducer and nft_fib.sh pass on a rebuilt
> net-next-based kernel.
>
> Fixes: 7764a45a8f1f ("fib_rules: add .suppress operation")
No need for a Fixes tag. This was always broken.
> Link: https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/
> Signed-off-by: Leonard Lausen <leonard@lausen.nl>
> ---
> Previously included in v3 of the prefix-suppression series, then removed
> at review to be sent separately to net-next after the prerequisite fix.
> The implementation is unchanged; the message records current validation.
>
> Review:
> https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/
>
> net/ipv6/fib6_rules.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
> index 7efb0515b5c8..2f43e4e48e0d 100644
> --- a/net/ipv6/fib6_rules.c
> +++ b/net/ipv6/fib6_rules.c
> @@ -285,6 +285,8 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
> struct fib6_result *res = arg->result;
> struct rt6_info *rt = res->rt6;
> struct net_device *dev = NULL;
> + struct fib6_info *from;
> + int plen;
>
> if (arg->lookup_ptr == fib6_table_lookup) {
> /* fib6_table_lookup() returns 0 for reject routes. */
> @@ -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;
This scheme of deriving the FIB entry from the dst entry doesn't work
correctly with nexthop objects. The dst entry is cached in the nexthop
and it can be shared by multiple FIB entries with nexthop objects.
Therefore, the FIB entry that created a returned cached dst entry (i.e.,
rt->from) is not necessarily the FIB entry that the lookup matched [1].
I have a patchset that fixes the current users of this scheme
(RTM_GETROUTE + source address selection) and I would prefer if your set
came as a follow-up.
My solution is to align the IPv6 route lookup API with IPv4 and add a
result argument that encodes the matched FIB entry. Therefore, there's
no longer a need to derive it from rt->from.
Note that while fib6_rule_suppress() already has the FIB result
available ('res'), it doesn't have the FIB entry filled (i.e., res->f6i
is NULL). My patchset fills it for input and output route lookups, but
ip6_pol_route_lookup() and __ip6_route_redirect() will need to fill it
as well before fib6_rule_suppress() can use res->f6i->fib6_dst.plen.
> +
> /* 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;
>
> /* do not accept result if the route uses a device
[1]
# ip link add name dummy1 up type dummy
# ip nexthop add id 1 via fe80::1 dev dummy1
# ip -6 route add 2001:db8:1::/64 nhid 1 metric 100
# ip -6 route add 2001:db8:2::/64 nhid 1 metric 200
# taskset -c 0 ip -6 route get 2001:db8:1::1
2001:db8:1::1 via fe80::1 dev dummy1 src fe80::b8a6:3fff:fea5:f139 metric 100 pref medium
# taskset -c 0 ip -6 route get 2001:db8:2::1
2001:db8:2::1 via fe80::1 dev dummy1 src fe80::b8a6:3fff:fea5:f139 metric 100 pref medium
# taskset -c 0 ip -6 route get fibmatch 2001:db8:2::1
2001:db8:1::/64 nhid 1 via fe80::1 dev dummy1 metric 100 pref medium
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-03 9:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 17:30 [PATCH net-next 0/2] ipv6: Use the FIB prefix length to suppress cached routes Leonard Lausen
2026-12-02 17:30 ` [PATCH net-next 1/2] ipv6: Use the FIB prefix length when suppressing " Leonard Lausen
2026-12-03 9:02 ` Ido Schimmel
2026-12-02 17:30 ` [PATCH net-next 2/2] selftests: netfilter: cover IPv6 prefix suppression with a PMTU exception Leonard Lausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox