Re: [PATCH net-next v3 3/4] selftests: net: test restricted on-link fallback
From: Ido Schimmel
Date: Sun Nov 15 2026 - 03:33:42 EST
On Thu, Nov 12, 2026 at 11:59:31PM +0000, liamsmith827 wrote:
> From: Liam Smith <liamsmith827@xxxxxxxxx>
>
> Update tests now that the on-link fallback has been restricted to
> routing lookup misses for non-vrf unicast.
The commit message is too terse. Which "tests"? Are they aligned with
IPv6 now? Try:
"
Following the previous patch, the on-link fallback is no longer taken
when the FIB lookup hits an unreachable, blackhole or prohibit route /
rule. Adjust the IPv4 tests accordingly:
1. ipv4_ping_novrf(): Pinging a loopback address while bound to a
device now fails with an error instead of timing out, since the lookup
hits the unreachable default route. Adjust the expected return code.
2. ipv4_ping_novrf(): Add a variant of the above without the
unreachable default route, to make sure that the fallback is still
taken upon a route miss.
3. ipv4_ping_novrf(): Enable the device bind test cases that were
commented out because of the fallback (prohibit rule, unreachable route
and unreachable default route).
4. ipv4_udp_novrf(): Connecting to a loopback address while bound to a
device now fails with an error instead of timing out. Adjust the
expected return code.
With the exception of the route miss test case, which is specific to
IPv4, the IPv4 test cases are now aligned with their IPv6 counterparts.
"
>
> Signed-off-by: Liam Smith <liamsmith827@xxxxxxxxx>
> ---
> tools/testing/selftests/net/fcnal-test.sh | 47 +++++++++++++----------
> 1 file changed, 26 insertions(+), 21 deletions(-)
>
> diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
> index a50609535fed..c048d5be139d 100755
> --- a/tools/testing/selftests/net/fcnal-test.sh
> +++ b/tools/testing/selftests/net/fcnal-test.sh
> @@ -619,17 +619,29 @@ ipv4_ping_novrf()
> run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> log_test_addr ${a} $? 0 "ping local, device bind"
>
> - # loopback addresses not reachable from device bind
> - # fails in a really weird way though because ipv4 special cases
> - # route lookups with oif set.
> + # loopback addresses not reachable from device bind, unreachable default route
Avoid going over 80 chars when easily avoided.
> for a in ${NSA_LO_IP} 127.0.0.1
> do
> log_start
> show_hint "Fails since address on loopback device is out of device scope"
> run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> - log_test_addr ${a} $? 1 "ping local, device bind"
> + log_test_addr ${a} $? 2 "ping local, device bind, unreachable default route"
> done
>
> + # loopback addresses not reachable from device bind, route miss
> + log_start
> + setup_cmd ip route del unreachable default metric 8192
> +
> + for a in ${NSA_LO_IP} 127.0.0.1
> + do
> + log_start
> + show_hint "Fails since address on loopback device is out of device scope"
> + run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
> + log_test_addr ${a} $? 1 "ping local, device bind, route miss"
> + done
Add an unreachable rule here and test that ping exits with 2. This
verifies that the new FIB_LOOKUP_REPORT_MISS flag works as intended.
Adjust the commit message accordingly.
> +
> + setup_cmd ip route add unreachable default metric 8192
> +
> #
> # ip rule blocks reachability to remote address
> #