[PATCH mptcp-next v2 4/9] selftests: mptcp: mptcp_connect.sh don't fail because of nft rules in IPV6-less kernel

Gang Yan posted 9 patches 1 month, 3 weeks ago
[PATCH mptcp-next v2 4/9] selftests: mptcp: mptcp_connect.sh don't fail because of nft rules in IPV6-less kernel
Posted by Gang Yan 1 month, 3 weeks ago
From: Gang Yan <yangang@kylinos.cn>

run_test_transparent() loads an nft "table inet mangle" ruleset to
tproxy matching traffic to the listener. "table inet" requires
CONFIG_NF_TABLES_IPV6, which in turn depends on CONFIG_IPV6=y.

In a kernel with full MPTCP IPv6 support, mptcp_lib_is_v6_enabled
returns true and the original CI hard-fail behaviour is preserved
(this is what makes a real "nft is broken on a full kernel" bug
visible to EXPECT_ALL_FEATURES CI). In a CONFIG_IPV6=m kernel the
test is reported as a SKIP and mptcp_connect.sh continues with the
rest of its v4 tests.

Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 0e5690d6f68c..9f93924c5d91 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -714,7 +714,11 @@ table inet mangle {
 EOF
 	then
 		mptcp_lib_pr_skip "$msg, could not load nft ruleset"
-		mptcp_lib_fail_if_expected_feature "nft rules"
+		if mptcp_lib_is_v6_enabled; then
+			mptcp_lib_fail_if_expected_feature "nft rules"
+		else
+			mptcp_lib_pr_info "nft inet table needs CONFIG_IPV6=y"
+		fi
 		mptcp_lib_result_skip "${TEST_GROUP}"
 		return
 	fi
-- 
2.43.0