From: liamsmith827 <liamsmith827@grapheneos.org>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
liamsmith827 <liamsmith827@proton.me>,
stable@vger.kernel.org
Subject: [PATCH net v2 3/4] selftests: net: test restricted on-link fallback
Date: Tue, 10 Nov 2026 06:15:35 +0000 [thread overview]
Message-ID: <20261110061536.10811-4-liamsmith827@grapheneos.org> (raw)
In-Reply-To: <20261110061536.10811-1-liamsmith827@grapheneos.org>
From: liamsmith827 <liamsmith827@proton.me>
Update tests now that the on-link fallback has been restricted to
routing lookup misses for non-vrf unicast.
Cc: stable@vger.kernel.org
Signed-off-by: liamsmith827 <liamsmith827@proton.me>
---
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
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
+
+ setup_cmd ip route add unreachable default metric 8192
+
#
# ip rule blocks reachability to remote address
#
@@ -643,10 +655,9 @@ 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
+ run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
+ log_test_addr ${a} $? 2 "ping out, device bind, blocked by rule"
a=${NSA_LO_IP}
log_start
@@ -671,10 +682,9 @@ ipv4_ping_novrf()
run_cmd ping -c1 -w1 ${a}
log_test_addr ${a} $? 2 "ping out, blocked by route"
- # 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 not having a route for the address
- # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
+ log_start
+ run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
+ log_test_addr ${a} $? 2 "ping out, device bind, blocked by route"
a=${NSA_LO_IP}
log_start
@@ -692,10 +702,9 @@ ipv4_ping_novrf()
run_cmd ping -c1 -w1 ${a}
log_test_addr ${a} $? 2 "ping out, unreachable default route"
- # 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 not having a route for the address
- # run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
+ log_start
+ run_cmd ping -c1 -w1 -I ${NSA_DEV} ${a}
+ log_test_addr ${a} $? 2 "ping out, device bind, unreachable default route"
}
ipv4_ping_vrf()
@@ -1602,10 +1611,6 @@ ipv4_udp_novrf()
run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U
log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()"
-
- # IPv4 with device bind has really weird behavior - it overrides the
- # fib lookup, generates an rtable and tries to send the packet. This
- # causes failures for local traffic at different places
for a in ${NSA_LO_IP} 127.0.0.1
do
log_start
@@ -1613,7 +1618,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"
log_start
show_hint "Should fail since addresses on loopback are out of device scope"
--
2.47.3
next prev parent reply other threads:[~2026-11-10 6:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 6:15 [PATCH net v2 0/4] ipv4: restrict on-link fallback to lookup misses liamsmith827
2026-11-10 6:15 ` [PATCH net v2 1/4] ipv4: add FIB_LOOKUP_REPORT_MISS liamsmith827
2026-11-10 6:15 ` [PATCH net v2 2/4] ipv4: restrict on-link fallback to lookup misses liamsmith827
2026-11-10 6:15 ` liamsmith827 [this message]
2026-11-10 6:15 ` [PATCH net v2 4/4] ipv4: replace obsolete routing comment liamsmith827
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=20261110061536.10811-4-liamsmith827@grapheneos.org \
--to=liamsmith827@grapheneos.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=liamsmith827@proton.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=stable@vger.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
all inboxes | Powered by JetHome®