Commit 394aea6e authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Geliang Tang
Browse files

selftests: mptcp: stop forcing iptables-legacy

mainline inclusion
from mainline-v6.9-rc1
commit 7c2eac649054c04007f61fcc90a42f6800727efc
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9VYQ9
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=7c2eac649054c04007f61fcc90a42f6800727efc

--------------------------------

Commit 0c4cd3f8 ("selftests: mptcp: join: use 'iptables-legacy' if
available") and commit a5a5990c ("selftests: mptcp: sockopt: use
'iptables-legacy' if available") forced using iptables-legacy if
available.

This was needed because of some issues that were visible when testing
the kselftests on a v5.15.x with iptables-nft as default backend. It
looks like these errors are no longer present. As mentioned by Pablo [1],
the errors were maybe due to missing kernel config. We can then use
iptables-nft if it is the default one, instead of using a legacy tool.

We can then check the variables iptables and ip6tables are valid. We can
keep the variables to easily change it later or add options.

Link: https://lore.kernel.org/netdev/ZbFiixyMFpQnxzCH@calendula/

 [1]
Suggested-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-1-bc79e6e5e6a0@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
parent 8a039651
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -167,15 +167,11 @@ check_tools()
		exit $ksft_skip
	fi

	# Use the legacy version if available to support old kernel versions
	if iptables-legacy -V &> /dev/null; then
		iptables="iptables-legacy"
		ip6tables="ip6tables-legacy"
	elif ! iptables -V &> /dev/null; then
		echo "SKIP: Could not run all tests without iptables tool"
	if ! "${iptables}" -V &> /dev/null; then
		echo "SKIP: Could not run all tests without ${iptables} tool"
		exit $ksft_skip
	elif ! ip6tables -V &> /dev/null; then
		echo "SKIP: Could not run all tests without ip6tables tool"
	elif ! "${ip6tables}" -V &> /dev/null; then
		echo "SKIP: Could not run all tests without ${ip6tables} tool"
		exit $ksft_skip
	fi
}
+4 −8
Original line number Diff line number Diff line
@@ -96,15 +96,11 @@ if [ $? -ne 0 ];then
	exit $ksft_skip
fi

# Use the legacy version if available to support old kernel versions
if iptables-legacy -V &> /dev/null; then
	iptables="iptables-legacy"
	ip6tables="ip6tables-legacy"
elif ! iptables -V &> /dev/null; then
	echo "SKIP: Could not run all tests without iptables tool"
if ! "${iptables}" -V &> /dev/null; then
	echo "SKIP: Could not run all tests without ${iptables} tool"
	exit $ksft_skip
elif ! ip6tables -V &> /dev/null; then
	echo "SKIP: Could not run all tests without ip6tables tool"
elif ! "${ip6tables}" -V &> /dev/null; then
	echo "SKIP: Could not run all tests without ${ip6tables} tool"
	exit $ksft_skip
fi