In case iproute2 is older than version 5.14.0, released ~Sept 1, 2021,
the End.DT4/DT6/DX4/DX6 support are not available and the tests
contained in the following 4 test files
 - srv6_end_dt4_l3vpn_test.sh
 - srv6_end_dt6_l3vpn_test.sh
 - srv6_end_dx4_netfilter_test.sh
 - srv6_end_dx6_netfilter_test.sh
are failing in some kernel backports.
This is the result of one 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]
\

To amend this, check the current running iproute2 supports the required
feature and, if not, just skip the entire test to avoid a failure.

This is similar to what have been done for srv6_end_dt46_l3vpn_test.sh in
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Signed-off-by: Alessio Faina <[email protected]>
---
 tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh      | 10 ++++++++++
 tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh      | 10 ++++++++++
 tools/testing/selftests/net/srv6_end_dx4_netfilter_test.sh  | 10 ++++++++++
 tools/testing/selftests/net/srv6_end_dx6_netfilter_test.sh  | 10 ++++++++++
 4 files changed, 40 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..50e8c733cf9f 100755
--- a/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh
+++ b/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh
@@ -459,6 +459,14 @@ host_vpn_isolation_tests()
        done
 }
 
+test_iproute2_supp_or_ksft_skip()
+{
+       if ! ip route help 2>&1 | grep -qo "End.DT4"; then
+               echo "SKIP: Missing SRv6 End.DT4 support in iproute2"
+               exit "${ksft_skip}"
+       fi
+}
+
 if [ "$(id -u)" -ne 0 ];then
        echo "SKIP: Need root privileges"
        exit $ksft_skip
@@ -469,6 +477,8 @@ if [ ! -x "$(command -v ip)" ]; then
        exit $ksft_skip
 fi
 
+test_iproute2_supp_or_ksft_skip
+
 modprobe vrf &>/dev/null
 if [ ! -e /proc/sys/net/vrf/strict_mode ]; then
         echo "SKIP: vrf sysctl does not exist"
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..9ed985559c6b 100755
--- a/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh
+++ b/tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh
@@ -469,6 +469,14 @@ host_vpn_isolation_tests()
        done
 }
 
+test_iproute2_supp_or_ksft_skip()
+{
+       if ! ip route help 2>&1 | grep -qo "End.DT6"; then
+               echo "SKIP: Missing SRv6 End.DT6 support in iproute2"
+               exit "${ksft_skip}"
+       fi
+}
+
 if [ "$(id -u)" -ne 0 ];then
        echo "SKIP: Need root privileges"
        exit $ksft_skip
@@ -479,6 +487,8 @@ if [ ! -x "$(command -v ip)" ]; then
        exit $ksft_skip
 fi
 
+test_iproute2_supp_or_ksft_skip
+
 modprobe vrf &>/dev/null
 if [ ! -e /proc/sys/net/vrf/strict_mode ]; then
         echo "SKIP: vrf sysctl does not exist"
diff --git a/tools/testing/selftests/net/srv6_end_dx4_netfilter_test.sh 
b/tools/testing/selftests/net/srv6_end_dx4_netfilter_test.sh
index e23210aa547f..b0bc85db8353 100755
--- a/tools/testing/selftests/net/srv6_end_dx4_netfilter_test.sh
+++ b/tools/testing/selftests/net/srv6_end_dx4_netfilter_test.sh
@@ -311,6 +311,14 @@ router_netfilter_tests()
        check_and_log_hs_connectivity 2 1 100
 }
 
+test_iproute2_supp_or_ksft_skip()
+{
+       if ! ip route help 2>&1 | grep -qo "End.DX4"; then
+               echo "SKIP: Missing SRv6 End.DX4 support in iproute2"
+               exit "${ksft_skip}"
+       fi
+}
+
 if [ "$(id -u)" -ne 0 ];then
        echo "SKIP: Need root privileges"
        exit $ksft_skip
@@ -321,6 +329,8 @@ if [ ! -x "$(command -v ip)" ]; then
        exit $ksft_skip
 fi
 
+test_iproute2_supp_or_ksft_skip
+
 cleanup &>/dev/null
 
 setup
diff --git a/tools/testing/selftests/net/srv6_end_dx6_netfilter_test.sh 
b/tools/testing/selftests/net/srv6_end_dx6_netfilter_test.sh
index 9e69a2ed5bc3..9bfbc5bbbdeb 100755
--- a/tools/testing/selftests/net/srv6_end_dx6_netfilter_test.sh
+++ b/tools/testing/selftests/net/srv6_end_dx6_netfilter_test.sh
@@ -316,6 +316,14 @@ router_netfilter_tests()
        check_and_log_hs_connectivity 2 1 100
 }
 
+test_iproute2_supp_or_ksft_skip()
+{
+       if ! ip route help 2>&1 | grep -qo "End.DX6"; then
+               echo "SKIP: Missing SRv6 End.DX6 support in iproute2"
+               exit "${ksft_skip}"
+       fi
+}
+
 if [ "$(id -u)" -ne 0 ];then
        echo "SKIP: Need root privileges"
        exit $ksft_skip
@@ -326,6 +334,8 @@ if [ ! -x "$(command -v ip)" ]; then
        exit $ksft_skip
 fi
 
+test_iproute2_supp_or_ksft_skip
+
 cleanup &>/dev/null
 
 setup
-- 
2.43.0


Reply via email to