selftests: mptcp: join: skip userspace PM tests if not supported

Selftests are supposed to run on any kernels, including the old ones not
supporting all MPTCP features.

One of them is the support of the userspace PM introduced by commit
4638de5aef ("mptcp: handle local addrs announced by userspace PMs")
and the following ones.

It is possible to look for the MPTCP pm_type's sysctl knob to know in
advance if the userspace PM is available.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: 5ac1d2d634 ("selftests: mptcp: Add tests for userspace PM type")
Cc: stable@vger.kernel.org
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Matthieu Baerts 2023-06-10 18:11:47 +02:00 committed by Jakub Kicinski
parent 9db34c4294
commit f2b492b04a

View File

@ -84,7 +84,7 @@ init_partial()
ip netns add $netns || exit $ksft_skip
ip -net $netns link set lo up
ip netns exec $netns sysctl -q net.mptcp.enabled=1
ip netns exec $netns sysctl -q net.mptcp.pm_type=0
ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0
ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0
if [ $checksum -eq 1 ]; then
@ -3191,7 +3191,8 @@ fail_tests()
userspace_tests()
{
# userspace pm type prevents add_addr
if reset "userspace pm type prevents add_addr"; then
if reset "userspace pm type prevents add_addr" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1
pm_nl_set_limits $ns1 0 2
pm_nl_set_limits $ns2 0 2
@ -3202,7 +3203,8 @@ userspace_tests()
fi
# userspace pm type does not echo add_addr without daemon
if reset "userspace pm no echo w/o daemon"; then
if reset "userspace pm no echo w/o daemon" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 2
pm_nl_set_limits $ns2 0 2
@ -3213,7 +3215,8 @@ userspace_tests()
fi
# userspace pm type rejects join
if reset "userspace pm type rejects join"; then
if reset "userspace pm type rejects join" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
@ -3223,7 +3226,8 @@ userspace_tests()
fi
# userspace pm type does not send join
if reset "userspace pm type does not send join"; then
if reset "userspace pm type does not send join" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
@ -3233,7 +3237,8 @@ userspace_tests()
fi
# userspace pm type prevents mp_prio
if reset "userspace pm type prevents mp_prio"; then
if reset "userspace pm type prevents mp_prio" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
@ -3244,7 +3249,8 @@ userspace_tests()
fi
# userspace pm type prevents rm_addr
if reset "userspace pm type prevents rm_addr"; then
if reset "userspace pm type prevents rm_addr" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1
set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1
@ -3256,7 +3262,8 @@ userspace_tests()
fi
# userspace pm add & remove address
if reset_with_events "userspace pm add & remove address"; then
if reset_with_events "userspace pm add & remove address" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns1
pm_nl_set_limits $ns2 1 1
run_tests $ns1 $ns2 10.0.1.1 0 userspace_1 0 slow
@ -3267,7 +3274,8 @@ userspace_tests()
fi
# userspace pm create destroy subflow
if reset_with_events "userspace pm create destroy subflow"; then
if reset_with_events "userspace pm create destroy subflow" &&
continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
set_userspace_pm $ns2
pm_nl_set_limits $ns1 0 1
run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow