Skip to content

Commit 9cf0128

Browse files
Geliang TangPaolo Abeni
authored andcommitted
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: Geliang Tang <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/20250313-net-next-mptcp-pm-ops-intro-v1-12-f4e4a88efc50@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent fa3ee9d commit 9cf0128

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tools/testing/selftests/net/mptcp/userspace_pm.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,36 @@ cleanup()
117117
trap cleanup EXIT
118118

119119
# Create and configure network namespaces for testing
120+
print_title "Init"
120121
mptcp_lib_ns_init ns1 ns2
122+
123+
# check path_manager and pm_type sysctl mapping
124+
if [ -f /proc/sys/net/mptcp/path_manager ]; then
125+
ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=userspace
126+
pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
127+
if [ "${pm_type}" != "1" ]; then
128+
test_fail "unexpected pm_type: ${pm_type}"
129+
mptcp_lib_result_print_all_tap
130+
exit ${KSFT_FAIL}
131+
fi
132+
133+
ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=error 2>/dev/null
134+
pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
135+
if [ "${pm_type}" != "1" ]; then
136+
test_fail "unexpected pm_type after error: ${pm_type}"
137+
mptcp_lib_result_print_all_tap
138+
exit ${KSFT_FAIL}
139+
fi
140+
141+
ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
142+
pm_name="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
143+
if [ "${pm_name}" != "kernel" ]; then
144+
test_fail "unexpected path-manager: ${pm_name}"
145+
mptcp_lib_result_print_all_tap
146+
exit ${KSFT_FAIL}
147+
fi
148+
fi
149+
121150
for i in "$ns1" "$ns2" ;do
122151
ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
123152
done
@@ -152,7 +181,6 @@ mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid
152181
sleep 0.5
153182
mptcp_lib_subtests_last_ts_reset
154183

155-
print_title "Init"
156184
print_test "Created network namespaces ns1, ns2"
157185
test_pass
158186

0 commit comments

Comments
 (0)