Netdev List
 help / color / mirror / Atom feed
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 v3 3/3] selftests: netfilter: cover IPv6 FIB prefix suppression
Date: Thu, 19 Nov 2026 06:03:35 +0000	[thread overview]
Message-ID: <179506821586.3136.4378259243876110125@kernel.org> (raw)
In-Reply-To: <20261116150132.9594-4-leonard@lausen.nl>

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] In the "suppress cached default route" case, the nftables check
  cannot see the PMTU exception, so it adds no coverage beyond "suppress…
- [Low] If the PMTU exception is not created, the new block runs `exit 1`
  (nft_fib.sh lines 920-924).
- [Low] The new comment "The router's logging RPF rules have already been
  removed here." (nft_fib.sh line 894) is incomplete, and so is the…

--

selftests: netfilter: cover IPv6 FIB prefix suppression

This extends nft_fib.sh to check that IPv6 policy rules with
suppress_prefixlength 0 suppress a default route but keep a more-specific
route. It also checks that blackhole, unreachable and prohibit routes,
including a blackhole nexthop object, stay terminal. Each check needs a
positive nftables fib counter that agrees with an ordinary route lookup,
and one case seeds a PMTU exception to check that its parent default route
is still suppressed.

> diff --git a/tools/testing/selftests/net/netfilter/nft_fib.sh b/tools/testing/selftests/net/netfilter/nft_fib.sh
> index 04544905c2164..175bdfa825c9e 100755
> --- a/tools/testing/selftests/net/netfilter/nft_fib.sh
> +++ b/tools/testing/selftests/net/netfilter/nft_fib.sh

[ ... ]

> @@ -845,6 +889,71 @@ 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? The commit message makes the same claim:

  "The router's logging RPF rules have already been removed by then,
  allowing neighbour discovery during intentionally different
  reverse-route states."

The prerouting RPF rule from load_ruleset() is gone by this point. But
after the earlier nft flush ruleset, the script calls
load_pbr_ruleset "$nsrouter", which installs:

table inet filter {
	chain forward {
		type filter hook forward priority raw;
		fib saddr . iif oif gt 0 accept
		log drop
	}
}

After that, only the ip filter and ip6 filter tables are deleted. Nothing
removes inet filter until test_fib_vrf()->load_ruleset_vrf() runs flush
ruleset. So this logging RPF check on the forward hook is still loaded for
all of the new suppression checks.

None of the new probes are forwarded by nsrouter, so nothing breaks today.

Should the comment and the commit message say that the forward-hook RPF
rule is still in place? A later change that adds forwarded probes here
would have them logged and dropped.

> +if ip -net "$nsrouter" -6 rule add pref 100 to dead:1::99 table 128 \
> +	suppress_prefixlength 0; then

[ ... ]

> +	# 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

[Severity: Low]
Does a failure here need to abort the whole selftest?

Creating the exception depends on more than a plain route add. The ping
binary must support -6 -I <addr> -M do -s, which busybox ping may not.
ns2 must forward the packet and send an ICMPv6 Packet Too Big. nsrouter
must then handle it via icmpv6_err()->ip6_update_pmtu() into the table 128
default route.

If any of those steps fails, the exit 1 skips the later blackhole,
unreachable, prohibit and nexthop checks. It also skips test_fib_vrf, which
is unrelated. The /128 mtu 1280 route and forwarding=1 in ns2 also stay set
until namespace cleanup.

The rest of this block records failures with || ret=1 and keeps going, and
the later checks don't depend on the exception. Could this path set ret=1
and skip only the "suppress cached default route" check?

> +	fi
> +	ip -net "$nsrouter" -6 rule del pref 99
> +	test_fib_suppress "suppress cached default route" veth0 || ret=1

[Severity: Low]
Can the nftables part of this check see the PMTU exception at all?

The fib expression goes through nft_fib6_lookup():

net/ipv6/netfilter/nft_fib_ipv6.c:nft_fib6_lookup() {
	return fib6_lookup(net, fl6->flowi6_oif, fl6, res, flags);
}

With custom rules, this resolves through
fib6_rule_action_alt()->fib6_table_lookup(). That function only uses
fib6_node_lookup() and rt6_select() to fill res->f6i, and never looks up
cached exceptions.

The fib6_table_lookup branch of fib6_rule_suppress() reads
res->f6i->fib6_dst.plen. That is the parent /0 entry whether or not an
exception exists.

So the nft counter here behaves the same as in "suppress default route",
with or without the fix from "ipv6: Use the FIB prefix length when
suppressing cached routes".

Only the ordinary lookup in test_fib_suppress() tests that fix:

	ip -net "$nsrouter" -6 route get dead:1::99 from dead:1::1 |
		grep -q "dev $expected " || err=1

That lookup goes through
ip6_route_output()->ip6_pol_route()->rt6_find_cached_rt().

This makes it a core IPv6 routing regression test inside nft_fib.sh.
nft_fib.sh is skipped entirely when nft is missing
(checktool "nft --version"). fib_tests.sh already has fib_suppress_test,
but that test doesn't cover cached exceptions.

Would fib_tests.sh be a better home for the cached-route case? If it stays
here, could the label say that only the ordinary lookup covers the cached
route?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116150132.9594-1-leonard%40lausen.nl

  reply	other threads:[~2026-11-19  6:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:01 [PATCH net v3 0/3] ipv6: Honor prefix suppression for FIB lookups and cached routes Leonard Lausen
2026-11-16 15:01 ` [PATCH net v3 1/3] ipv6: Use the FIB prefix length when suppressing " Leonard Lausen
2026-11-16 15:01 ` [PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen
2026-11-19  6:03   ` netdev-bot+sashiko
2026-11-16 15:01 ` [PATCH net v3 3/3] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen
2026-11-19  6:03   ` netdev-bot+sashiko [this message]
2026-11-17  9:13 ` [PATCH net v3 0/3] ipv6: Honor prefix suppression for FIB lookups and cached routes Ido Schimmel
2026-11-17 11:10   ` Leonard Lausen

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=179506821586.3136.4378259243876110125@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