From 6a64e9d76a794aacbe06f5a3fbf4e5d4542392f7 Mon Sep 17 00:00:00 2001 From: Alessio Faina Date: Mon, 7 Sep 2026 12:06:31 +0200 Subject: [PATCH] selftests/net: skip srv6_end_dt[4/6]_l3vpn_test.sh if vrftable not available In case iproute2 is older than version 5.11.0, released ~Feb 23, 2021, the vrftable support is not available and the tests contained in the following 2 test files - srv6_end_dt4_l3vpn_test.sh - srv6_end_dt6_l3vpn_test.sh are failing in some kernel backports. This is the result of one of those tests in an unsupported environment: ########################################################################## TEST SECTION: SRv6 VPN connectivity test among hosts in the same tenant ########################################################################## TEST: Hosts connectivity: hs-t100-1 -> hs-t100-2 (tenant 100) [FAIL] TEST: Hosts connectivity: hs-t100-2 -> hs-t100-1 (tenant 100) [FAIL] TEST: Hosts connectivity: hs-t200-3 -> hs-t200-4 (tenant 200) [FAIL] TEST: Hosts connectivity: hs-t200-4 -> hs-t200-3 (tenant 200) [FAIL] The test installs a route with the vrftable feature; if this feature is not available, the approach taken is to skip the test rather than failing it. Signed-off-by: Alessio Faina Reviewed-by: Andrea Mayer Link: https://patch.msgid.link/20260907100631.1923148-1-alessio.faina@canonical.com Signed-off-by: Jakub Kicinski --- .../selftests/net/srv6_end_dt4_l3vpn_test.sh | 21 +++++++++++++++++++ .../selftests/net/srv6_end_dt6_l3vpn_test.sh | 21 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh b/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh index a649dba3cb77..037e5fe1da2a 100755 --- a/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh +++ b/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh @@ -469,12 +469,33 @@ if [ ! -x "$(command -v ip)" ]; then exit $ksft_skip fi +test_vrftable_supp_or_ksft_skip() +{ + local nsname + + setup_ns nsname + ip netns exec "${nsname}" sh -c "echo 1 > /proc/sys/net/vrf/strict_mode" + ip -netns "${nsname}" link add vrf-100 type vrf table 100 + ip -netns "${nsname}" link set vrf-100 up + + if ! ip -netns "${nsname}" -6 route add fc00::1/128 \ + encap seg6local action End.DT4 vrftable 100 dev vrf-100 2>/dev/null; then + cleanup_ns "${nsname}" + echo "SKIP: SRv6 End.DT4 vrftable not supported" + exit "${ksft_skip}" + fi + + cleanup_ns "${nsname}" +} + modprobe vrf &>/dev/null if [ ! -e /proc/sys/net/vrf/strict_mode ]; then echo "SKIP: vrf sysctl does not exist" exit $ksft_skip fi +test_vrftable_supp_or_ksft_skip + cleanup &>/dev/null setup diff --git a/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh b/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh index e408406d8489..9a29e0d6c912 100755 --- a/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh +++ b/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh @@ -479,12 +479,33 @@ if [ ! -x "$(command -v ip)" ]; then exit $ksft_skip fi +test_vrftable_supp_or_ksft_skip() +{ + local nsname + + setup_ns nsname + ip netns exec "${nsname}" sh -c "echo 1 > /proc/sys/net/vrf/strict_mode" + ip -netns "${nsname}" link add vrf-100 type vrf table 100 + ip -netns "${nsname}" link set vrf-100 up + + if ! ip -netns "${nsname}" -6 route add fc00::1/128 \ + encap seg6local action End.DT6 vrftable 100 dev vrf-100 2>/dev/null; then + cleanup_ns "${nsname}" + echo "SKIP: SRv6 End.DT6 vrftable not supported" + exit "${ksft_skip}" + fi + + cleanup_ns "${nsname}" +} + modprobe vrf &>/dev/null if [ ! -e /proc/sys/net/vrf/strict_mode ]; then echo "SKIP: vrf sysctl does not exist" exit $ksft_skip fi +test_vrftable_supp_or_ksft_skip + cleanup &>/dev/null setup