[PATCH RFC net-next 3/3] selftests: net: cover IPv6 uncached route device mismatch

From: Chris J Arges

Date: Wed Aug 26 2026 - 16:21:05 EST


Local IPv6 routes through a VRF can use the VRF as dst.dev while
retaining the VRF member interface in rt6i_idev. Exercise device
teardown while such uncached routes are retained by a delayed qdisc.

Reuse the existing VRF topology and msg_zerocopy raw-header sender, and
verify route creation, qdisc retention, and prompt interface deletion.

Signed-off-by: Chris J Arges <carges@xxxxxxxxxxxxxx>
---
tools/testing/selftests/net/vrf-xfrm-tests.sh | 35 +++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/tools/testing/selftests/net/vrf-xfrm-tests.sh b/tools/testing/selftests/net/vrf-xfrm-tests.sh
index b64dd891699d..4f409d135a99 100755
--- a/tools/testing/selftests/net/vrf-xfrm-tests.sh
+++ b/tools/testing/selftests/net/vrf-xfrm-tests.sh
@@ -385,6 +385,37 @@ run_tests()
cleanup_xfrm_dev
}

+test_ipv6_uncached_mismatch()
+{
+ local sender_pid
+ local backlog
+ local rc
+
+ # A local route through a VRF uses the VRF as dst.dev while retaining
+ # the VRF member interface in rt6i_idev. Raw header sends create uncached
+ # routes, and netem keeps them referenced while the interface is deleted.
+ run_cmd_host1 tc qdisc replace dev ${VRF} root netem limit 1 delay 10s
+ ip -6 -netns "$host1" route add local ${HOST1_6}/128 dev eth0
+ ip netns exec "$host1" ./msg_zerocopy -6 \
+ -S ${HOST1_6} -D ${HOST1_6} -s 1200 -t 0 raw_hdrincl \
+ >/dev/null 2>&1 &
+ sender_pid=$!
+ wait "$sender_pid"
+ rc=$?
+ log_test $rc 0 "Create uncached IPv6 routes with mismatched devices"
+ [ $rc -ne 0 ] && return
+
+ backlog=$(ip netns exec "$host1" tc -s qdisc show dev ${VRF})
+ if ! echo "$backlog" | grep -Eq 'backlog .* [1-9][0-9]*p'; then
+ log_test 1 0 "Retain uncached IPv6 routes in VRF qdisc"
+ return
+ fi
+ log_test 0 0 "Retain uncached IPv6 routes in VRF qdisc"
+
+ run_cmd_host1 timeout 2 ip link del eth0
+ log_test $? 0 "Flush uncached IPv6 routes with mismatched devices"
+}
+
################################################################################
# usage

@@ -425,6 +456,10 @@ echo
echo "netem qdisc on VRF device"
run_tests

+echo
+echo "Uncached IPv6 route with mismatched devices"
+test_ipv6_uncached_mismatch
+
printf "\nTests passed: %3d\n" ${nsuccess}
printf "Tests failed: %3d\n" ${nfail}


--
2.43.0