Re: [PATCH net-next v5 3/4] selftests: net: test restricted on-link fallback

From: netdev-bot+sashiko

Date: Wed Nov 18 2026 - 18:28:38 EST


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 updated fcnal-test.sh does not exercise much of the behaviour
that the commit message and the preceding kernel patch claim.
- [Low] The patch says it adjusts the IPv4 tests to the new behaviour,
but a stale hint is left in ipv4_tcp_novrf().
- [Low] In ipv4_ping_novrf(), the new case "ping out, device bind,
blocked by unreachable rule" (lines 659-663) adds `ip rule add pref 49…

--

selftests: net: test restricted on-link fallback

This commit updates the IPv4 tests in fcnal-test.sh for the kernel change
that skips the on-link fallback when the FIB lookup hits an unreachable,
blackhole or prohibit route or rule. It changes the expected return codes
for device bound pings and UDP sends to loopback addresses. It also adds
route miss and unreachable rule variants, and re-enables the device bind
cases that had been commented out.

> diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
> index a50609535fedc..7d51fdcc8fdad 100755
> --- a/tools/testing/selftests/net/fcnal-test.sh
> +++ b/tools/testing/selftests/net/fcnal-test.sh

[ ... ]

> @@ -643,10 +656,15 @@ ipv4_ping_novrf()
> run_cmd ping -c1 -w1 ${a}
> log_test_addr ${a} $? 2 "ping out, blocked by rule"
>
> - # NOTE: ipv4 actually allows the lookup to fail and yet still create
> - # a viable rtable if the oif (e.g., bind to device) is set, so this
> - # case succeeds despite the rule
> - # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> + log_start
> + setup_cmd ip rule add pref 49 to ${NSB_LO_IP} unreachable
> + run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> + log_test_addr ${a} $? 2 "ping out, device bind, blocked by unreachable rule"
> + setup_cmd ip rule del pref 49 to ${NSB_LO_IP} unreachable

[Severity: Low]
Does this case show that the unreachable rule blocks the ping by itself?

The rule from earlier in ipv4_ping_novrf() is still installed here:

setup_cmd ip rule add pref 50 to ${NSB_LO_IP} prohibit

It is only removed after the "blocked by route" block. ping exits with 2
for both ENETUNREACH and EACCES.

Suppose a later change made the pref 49 rule non-terminating, for example
by returning -EAGAIN so that fib_rules_lookup() moves on to the next rule.
The pref 50 prohibit rule would then return -EACCES. Since that is not
-ESRCH, the fallback would not run and the test would still pass.

The test does catch -ENETUNREACH being remapped to -ESRCH. Would it be
cleaner to run this case before the pref 50 rule is added, or to drop
pref 50 while it runs? That would make it self-contained, as the test
name and item 3 of the commit message suggest.

> +
> + log_start
> + run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> + log_test_addr ${a} $? 2 "ping out, device bind, blocked by rule"

[Severity: Low]
Should the coverage here be wider? The commit message says:

the on-link fallback is no longer taken when the FIB lookup hits an
unreachable, blackhole or prohibit route/ rule.

The device bind cases added or re-enabled in this patch cover only an
unreachable route, an unreachable default route, a prohibit rule and an
unreachable rule. All of them go through ping -I (SO_BINDTODEVICE).

fcnal-test.sh has no blackhole route or rule anywhere, and no prohibit
route. The only prohibit cases use ip rule.

The IP_UNICAST_IF and IP_PKTINFO loopback cases in ipv4_udp_novrf() also
expected 1 before this patch and still do:

run_cmd nettest -D -r ${a} -d ${NSA_DEV} -C
log_test_addr ${a} $? 1 "Global server, device send via cmsg, local connection"
...
run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S
log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection"

So they pass whether or not the fallback runs. The preceding kernel patch
names IP_UNICAST_IF and IP_PKTINFO as the paths used to get around a
prohibit rule VPN kill switch.

Could cases for blackhole, a prohibit route, and IP_UNICAST_IF/IP_PKTINFO
against a prohibit rule be added? Without them, the suite would not fail
if the fallback came back on any of those paths.

[ ... ]

> @@ -1613,7 +1625,7 @@ ipv4_udp_novrf()
> run_cmd nettest -D -s &
> wait_local_port_listen ${NSA} 12345 udp
> run_cmd nettest -D -r ${a} -d ${NSA_DEV}
> - log_test_addr ${a} $? 2 "Global server, device client, local connection"
> + log_test_addr ${a} $? 1 "Global server, device client, local connection"

[Severity: Low]
Item 5 of the commit message says:

5. ipv4_udp_novrf(): Connecting to a loopback address while bound to a
device now fails with an error instead of timing out.

This nettest call has no -U, so it never calls connect(). In nettest.c,
connectsock() returns early for datagram sockets:

if (args->type != SOCK_STREAM && !args->datagram_connect)
goto out;

The failure therefore comes from sendto(). Could the wording be made more
precise?

Also, is the hint in ipv4_tcp_novrf() now out of date?

tools/testing/selftests/net/fcnal-test.sh:ipv4_tcp_novrf() {
...
for a in ${NSA_LO_IP} 127.0.0.1
do
log_start
show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
run_cmd nettest -s &
wait_local_port_listen ${NSA} 12345 tcp
run_cmd nettest -r ${a} -d ${NSA_DEV}
...
}

With the kernel change, the lookup hits the unreachable default metric
8192 route and the fallback is skipped. connect() then fails with
"Network is unreachable" rather than "No route to host". The expected
return code is still 1, so only the verbose mode hint is affected.

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116202741.13106-1-liamsmith827%40grapheneos.org