Commit 9cf0128e authored by Geliang Tang's avatar Geliang Tang Committed by Paolo Abeni
Browse files

selftests: mptcp: add pm sysctl mapping tests



This patch checks if the newly added net.mptcp.path_manager is mapped
successfully from or to the old net.mptcp.pm_type in userspace_pm.sh.

Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250313-net-next-mptcp-pm-ops-intro-v1-12-f4e4a88efc50@kernel.org


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent fa3ee9dd
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -117,7 +117,36 @@ cleanup()
trap cleanup EXIT

# Create and configure network namespaces for testing
print_title "Init"
mptcp_lib_ns_init ns1 ns2

# check path_manager and pm_type sysctl mapping
if [ -f /proc/sys/net/mptcp/path_manager ]; then
	ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=userspace
	pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
	if [ "${pm_type}" != "1" ]; then
		test_fail "unexpected pm_type: ${pm_type}"
		mptcp_lib_result_print_all_tap
		exit ${KSFT_FAIL}
	fi

	ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=error 2>/dev/null
	pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
	if [ "${pm_type}" != "1" ]; then
		test_fail "unexpected pm_type after error: ${pm_type}"
		mptcp_lib_result_print_all_tap
		exit ${KSFT_FAIL}
	fi

	ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
	pm_name="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
	if [ "${pm_name}" != "kernel" ]; then
		test_fail "unexpected path-manager: ${pm_name}"
		mptcp_lib_result_print_all_tap
		exit ${KSFT_FAIL}
	fi
fi

for i in "$ns1" "$ns2" ;do
	ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
done
@@ -152,7 +181,6 @@ mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid
sleep 0.5
mptcp_lib_subtests_last_ts_reset

print_title "Init"
print_test "Created network namespaces ns1, ns2"
test_pass