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

From
netdev-bot+sashiko@kernel.org
Date
2026-11-16 22:08:38
Also in
linux-kselftest, lkml
Reply to
liamsmith827, 2026-11-15
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] In ipv4_ping_novrf() (tools/testing/selftests/net/fcnal-
  test.sh, lines 659-662), the new case "ping out, blocked by…
- [Low] Even with the missing ping added, the unreachable-rule case in
  ipv4_ping_novrf() (fcnal-test.sh lines 659-662) has no device bind…

--

selftests: net: test restricted on-link fallback

This patch updates the IPv4 cases in fcnal-test.sh to match the new
on-link fallback behaviour. The fallback is no longer taken when the FIB
lookup hits an unreachable, blackhole or prohibit route or rule. It
changes the expected return codes, adds a route miss variant and an
unreachable rule case, and enables the device bind cases that were
previously commented out.
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index a50609535fedc..9722d7dcad085 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
[ ... ]
quoted hunk ↗ jump to hunk
@@ -643,10 +656,14 @@ 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
+	log_test_addr ${a} $? 2 "ping out, blocked by unreachable rule"
[Severity: Medium]
Is a ping missing here? Nothing runs between the rule add and
log_test_addr, so $? is the exit status of setup_cmd.

setup_cmd() exits the whole script if the command fails:

setup_cmd()
{
	...
	run_cmd ${cmd}
	rc=$?
	if [ $rc -ne 0 ]; then
		...
		exit $rc
	fi
}

So when it returns here, $? is always 0. log_test_addr() then compares
0 against the expected value of 2. That means this case reports FAIL on
every run, and no packet is ever sent while the pref 49 unreachable rule
is installed.

The commit message says this case will "demonstrate ping fails as
expected with an unreachable rule" and that it "ensures
FIB_LOOKUP_REPORT_MISS does not break this behavior". As written, the
case checks neither.

Would adding run_cmd ping -c1 -w1 ${a} before log_test_addr fix this?
At this point a is still ${NSB_LO_IP}.
quoted hunk ↗ jump to hunk
+	setup_cmd ip rule del pref 49 to ${NSB_LO_IP} unreachable
+
+	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]
Even with the ping added, can the unreachable rule case catch a
FIB_LOOKUP_REPORT_MISS regression without a device bind?

In ip_route_output_key_hash_rcu(), the on-link fallback is only taken
when oif is set and err == -ESRCH. In every other case a miss is mapped
back:

	err = err == -ESRCH ? -ENETUNREACH : err;

fib4_rule_action() returns -ENETUNREACH for FR_ACT_UNREACHABLE. With oif
unset, two cases give the same ping exit code of 2:

  - the unreachable rule is correctly reported as -ENETUNREACH
  - the rule is wrongly reported as a miss (-ESRCH), which is then
    remapped to -ENETUNREACH

So a non-bound ping cannot tell them apart.

The device bind case that follows runs after the pref 49 rule has been
deleted. It hits the pref 50 prohibit rule (-EACCES), which never goes
through the -ESRCH vs -ENETUNREACH distinction.

Should there also be a run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a} case,
expecting 2, while the pref 49 unreachable rule is still installed?
 
 	a=${NSA_LO_IP}
 	log_start
[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115215640.18728-1-liamsmith827%40grapheneos.org
Thread (9 messages) 9 messages, 3 authors, last reply 45m ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help