Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: florian.fainelli@broadcom.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, yoshfuji@linux-ipv6.org,
	dsahern@kernel.org, shuah@kernel.org, kuniyu@google.com,
	jiayuan.chen@linux.dev, angus.peng@broadcom.com,
	maoyi.xie@ntu.edu.sg, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH net-next 2/2] selftests: net: add test for ipv6 strict_router_selection
Date: Fri, 04 Dec 2026 04:27:12 +0000	[thread overview]
Message-ID: <179635843244.3146.11978347577706164720@kernel.org> (raw)
In-Reply-To: <20261130222631.1786545-3-florian.fainelli@broadcom.com>

Thank you for your contribution! Sashiko AI review found 8 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 5 · Low: 3

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] dut_has_lladdr() in
  tools/testing/selftests/net/ipv6_strict_router_select.sh (line 115)…
- [Medium] reset_state() (lines 135/137) creates the two default routes
  with `ip -6 route append default via fe80::N dev rN`.
- [Medium] The strict-mode ranking added by commit "net: ipv6: add strict
  RFC 4861 6.3.6 default router selection" does not hold for ECMP…
- [Medium] pref_supported() and the positive control in
  test_enabled_no_probing() infer the kernel config from runtime…
- [Medium] setup() writes net.ipv6.conf.default.router_probe_interval=1
  in the same sysctl command as the required…
- [Low] The setup() comment (line 83) says router_probe_interval=1 second
  is "the smallest the sysctl allows".
- [Low] ip-sysctl.rst and the RT6_STRICT_RANK_* constants (VALID 0x200 >
  PROBING 0x100 > UNREACH 0) define three reachability tiers.
- [Low] test_enabled_incomplete_sticky() starts the resolver with `dut
  ping -6 -c 1 -W 1 -I r2 "$GW2" &>/dev/null &` (line 364).

--

selftests: net: add test for ipv6 strict_router_selection

This adds a selftest for net.ipv6.route.strict_router_selection. It builds
a namespace with two same-metric default routes via fe80::1 and fe80::2
and sets the neighbour entries by hand. It then reads back the selected
router with "ip route get" on the output and input paths.

> diff --git a/tools/testing/selftests/net/ipv6_strict_router_select.sh b/tools/testing/selftests/net/ipv6_strict_router_select.sh
> new file mode 100755
> index 0000000000000..54500b25c9674
> --- /dev/null
> +++ b/tools/testing/selftests/net/ipv6_strict_router_select.sh
> @@ -0,0 +1,507 @@

[ ... ]

> +setup()
> +{
> +	setup_ns DUT PEER || exit $ksft_skip
> +
> +	# No DAD, no RA/RS, no autoconf: the only NS sent on r1/r2 must be the
> +	# ones we trigger ourselves. Shorten the router probe interval (in
> +	# seconds, the smallest the sysctl allows) so that probing can be

[Severity: Low]
This isn't a bug, but is "the smallest the sysctl allows" accurate? The
router_probe_interval entry in net/ipv6/addrconf.c uses
proc_dointvec_jiffies with no extra1/extra2 bounds, so 0 is also accepted.
1 is only the smallest non-zero value the seconds interface can express.

> +	# observed without waiting a minute. Set the defaults before the devices are
> +	# created or moved so that they apply to them.
> +	dut sysctl -qw net.ipv6.conf.default.dad_transmits=0 \
> +		       net.ipv6.conf.default.accept_ra=0 \
> +		       net.ipv6.conf.default.router_solicitations=0 \
> +		       net.ipv6.conf.default.autoconf=0 \
> +		       net.ipv6.conf.default.router_probe_interval=1 || exit $ksft_skip

[Severity: Medium]
Will this skip the whole suite on kernels without CONFIG_IPV6_ROUTER_PREF?

In net/ipv6/addrconf.c the router_probe_interval ctl_table entry is only
registered under #ifdef CONFIG_IPV6_ROUTER_PREF. On those kernels this
sysctl write fails and setup() exits with $ksft_skip.

That also skips the sysctl range, prefers-reachable, round-robin and
incomplete-sticky tests, none of which need ROUTER_PREF. Strict mode on
ROUTER_PREF=n kernels, where the non-strict rt6_check_neigh() behaviour
is different, is never tested either.

The commit message says:

    The preference and probing tests need CONFIG_IPV6_ROUTER_PREF and are
    skipped at runtime when it is not enabled.

Those per-test skips can't be reached in that configuration. Could the
router_probe_interval write be done separately, without the exit?

[ ... ]

> +	# Make sure link-local addresses are in place before routes use them
> +	slowwait 5 dut_has_lladdr r1 || exit $ksft_skip
> +	slowwait 5 dut_has_lladdr r2 || exit $ksft_skip
> +}
> +
> +dut_has_lladdr()
> +{
> +	dut ip -6 addr show dev "$1" scope link | grep -q "inet6 fe80:.*scope link$" &&

[Severity: Medium]
Can the "scope link$" pattern ever match? iproute2 prints the scope as
"scope %s ", which leaves a trailing space. The kernel also sets
IFAPROT_KERNEL_LL on autoconfigured link-local addresses and emits it:

net/ipv6/addrconf.c:inet6_fill_ifaddr() {
    ...
	if (proto && nla_put_u8(skb, IFA_PROTO, proto))
    ...
}

So the line reads "inet6 fe80::x/64 scope link proto kernel_ll ", or
"... scope link " with older iproute2. Neither ends in "scope link".

If that's right, slowwait 5 dut_has_lladdr r1 always times out. setup()
then exits with $ksft_skip before strict_supported() or any test in
ALL_TESTS runs.

Doesn't that mean the script always reports a skip without giving a
reason, so none of the new cases ever run?

> +	! dut ip -6 addr show dev "$1" scope link | grep -q tentative
> +}

[ ... ]

> +	# "append" is needed to get two same-metric default routes
> +	# shellcheck disable=SC2086
> +	dut ip -6 route append default via "$GW1" dev r1 $r1_opts || return 1
> +	# shellcheck disable=SC2086
> +	dut ip -6 route append default via "$GW2" dev r2 $r2_opts || return 1
> +}

[Severity: Medium]
Do these two routes become ECMP siblings instead of independent routes in
leaf order? Both are static gateway routes with the same metric and no
nexthop object. So rt6_qualify_for_ecmp() is true and fib6_add_rt2node()
links them:

net/ipv6/ip6_fib.c:fib6_add_rt2node() {
    ...
			if (rt_can_ecmp &&
			    rt6_qualify_for_ecmp(iter))
				WRITE_ONCE(rt->fib6_nsiblings,
					   rt->fib6_nsiblings + 1);
    ...
}

In ip6_pol_route(), have_oif_match is false on both the output path and
the iif path. fib6_select_path() therefore hashes the flow with a seed
picked at random once per boot. Whenever the hashed sibling's score is
non-negative, it replaces the rt6_select() choice:

net/ipv6/route.c:fib6_select_path() {
    ...
		if (rt6_score_route(nh, sibling->fib6_flags, oif, strict) < 0)
			break;
		match = sibling;
    ...
}

With this, the following expectations depend on the hash and not on
leaf order:

  test_disabled_forwarding_ignores_neigh(): GW1, and GW1 four times
  test_enabled_prefers_reachable(): "permanent permanent $GW1"
  pref_supported(): the out path must return GW2
  test_enabled_preference_tiebreak(): GW2 on both paths, both valid

The out flow and the in flow each land in one half for the whole boot.
The disabled test needs both flows in r1's half, and the preference tests
need both in r2's half.

On a CONFIG_IPV6_ROUTER_PREF=y kernel, wouldn't the suite fail on most
boots? On the others, it would pass only because pref_supported() skips
the preference test.

Strict-mode cases with one unreachable sibling are not affected, because
RT6_NUD_FAIL_DO_RR is negative and keeps the rt6_select() result.

The commit message says:

    The test builds a single namespace with two same-metric default
    routes, via fe80::1 on r1 and fe80::2 on r2, with r1 first in FIB leaf
    order.

and:

     - disabled: with forwarding on, neighbour state is ignored, FIB leaf
       order decides and there is no round-robin

Neither seems to hold for this topology. The topology also doesn't model
the RA-learned (RTF_ADDRCONF) routes the feature targets, since those
never become ECMP siblings.

Could the routes be built so that they can't coalesce, for example with
separate nhid nexthop objects, or as RA-learned routes?

[ ... ]

> +	# Start resolving r2's address: NS goes out, nobody answers
> +	dut ping -6 -c 1 -W 1 -I r2 "$GW2" &>/dev/null &
> +	ping_pid=$!

[Severity: Low]
Is ping_pid really ping's PID? dut is a shell function, so backgrounding
it forks a bash subshell that runs the function body. $! is that
subshell's PID, and ip netns exec (and then ping) runs as its child.

If so, the kill "$ping_pid" calls on the skip path, on the normal path
and in cleanup() only signal the subshell. The cleanup() comment "Kill
any background ping before dropping the namespaces" would then be
inaccurate.

The impact is small, since ping exits on its own after -W 1 and
cleanup_ns() kills any processes left in the namespace.

> +
> +	if ! busywait "$BUSYWAIT_TIMEOUT" dut_neigh_incomplete r2 "$GW2"; then

[ ... ]

> +	# r1 (first in leaf order) has no neighbour entry, r2 is being resolved:
> +	# r2 must be selected every time, not rotated away.
> +	for path in $PATHS; do
> +		seq=$(selected_gws "$path" 4)
> +		if [ "$seq" != "$GW2 $GW2 $GW2 $GW2 " ]; then

[Severity: Low]
This only compares a missing entry with an INCOMPLETE one. No case in the
script puts a valid router against an INCOMPLETE one. Would the test still
pass if RT6_STRICT_RANK_PROBING were ranked equal to or above
RT6_STRICT_RANK_VALID?

A case with r1 INCOMPLETE and r2 permanent, expecting r2, would cover the
middle rank.

[Severity: Medium]
Related to the ECMP question above: does the strict-mode ranking from
"net: ipv6: add strict RFC 4861 6.3.6 default router selection" hold for
sibling routes? rt6_score_route() gives an INCOMPLETE neighbour a
non-negative score:

net/ipv6/route.c:rt6_score_route() {
    ...
			if (!rank)
				return RT6_NUD_FAIL_DO_RR;
			return m | rank;
    ...
}

fib6_select_path() only rejects the hashed sibling when the score is
negative. With r1 valid and r2 INCOMPLETE as siblings, rt6_select() picks
r1. Wouldn't every flow that hashes into r2's half still go to the
unresolved r2?

That seems to contradict Documentation/networking/ip-sysctl.rst:

    Candidate routers are ranked by neighbour state first: routers
    with a valid neighbour entry come first, then routers whose
    address resolution is in progress

RFC 4191 preference between two valid siblings is also ignored, because
the hash decides. The wrong choice only lasts until resolution completes
or fails. It also needs a static ECMP setup, since RA-learned routes are
not ECMP-eligible.

Neither the commit message nor ip-sysctl.rst mentions this limitation.
Should it be handled in fib6_select_path(), or at least be documented?

[ ... ]

> +test_enabled_preference_tiebreak()
> +{
> +	local path
> +
> +	RET=0
> +
> +	if ! pref_supported; then
> +		log_test_skip "strict_router_selection: enabled, preference breaks ties only" \
> +			"CONFIG_IPV6_ROUTER_PREF not enabled"
> +		return
> +	fi

[Severity: Medium]
Does a pref_supported() failure always mean the config is missing? Any
lookup that doesn't return GW2 is reported as a skip with this reason.
That includes a real regression in preference scoring, or the ECMP hash
landing on r1.

The positive control in test_enabled_no_probing() has the same problem:

	if ! slowwait 3 ns_nsol_increased r1 "$before"; then
		log_test_skip "strict_router_selection: enabled, router probing suppressed" \
			"router probing not available (CONFIG_IPV6_ROUTER_PREF)"

Here, if no NS goes out within 3 seconds for any reason, including an
rt6_probe() regression, the test reports a skip.

tools/testing/selftests/net/config sets CONFIG_IPV6_ROUTER_PREF=y, so on
CI kernels these real failures would show up as skips. The code also
doesn't match the commit message, which says these tests are skipped only
when CONFIG_IPV6_ROUTER_PREF is not enabled.

Could these checks report a failure when the config is enabled?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130222631.1786545-1-florian.fainelli%40broadcom.com

  reply	other threads:[~2026-12-04  4:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 22:26 [PATCH net-next 0/2] net: ipv6: add strict RFC 4861 6.3.6 default router selection Florian Fainelli
2026-11-30 22:26 ` [PATCH net-next 1/2] " Florian Fainelli
2026-12-04  4:27   ` netdev-bot+sashiko
2026-11-30 22:26 ` [PATCH net-next 2/2] selftests: net: add test for ipv6 strict_router_selection Florian Fainelli
2026-12-04  4:27   ` netdev-bot+sashiko [this message]
2026-12-02  8:29 ` [PATCH net-next 0/2] net: ipv6: add strict RFC 4861 6.3.6 default router selection Ido Schimmel
2026-12-02 23:37   ` Florian Fainelli
2026-12-03  8:08     ` Ido Schimmel
2026-12-03 17:25       ` Florian Fainelli
2026-12-03 22:37         ` Nicolai Buchwitz

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=179635843244.3146.11978347577706164720@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=angus.peng@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maoyi.xie@ntu.edu.sg \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=yoshfuji@linux-ipv6.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