@@ -693,3 +693,16 @@ mptcp_lib_pm_nl_change_endpoint() {
ip netns exec "${ns}" ./pm_nl_ctl set id "${id}" flags "${flags}"
fi
}
+
+mptcp_lib_set_path_manager()
+{
+ local ns=$1
+ local pm=$2
+
+ if ! ip netns exec ${ns} sysctl net.mptcp.available_path_managers |
+ grep -wq "${pm}"; then
+ test_fail "path manager ${pm} not found"
+ return 1
+ fi
+ ip netns exec ${ns} sysctl -q net.mptcp.path_manager="${pm}"
+}
@@ -119,19 +119,6 @@ trap cleanup EXIT
# Create and configure network namespaces for testing
mptcp_lib_ns_init ns1 ns2
-set_path_manager()
-{
- local ns=$1
- local pm=$2
-
- if ! ip netns exec ${ns} sysctl net.mptcp.available_path_managers |
- grep -wq "${pm}"; then
- test_fail "path manager ${pm} not found"
- return 1
- fi
- ip netns exec ${ns} sysctl -q net.mptcp.path_manager="${pm}"
-}
-
if [ -f /proc/sys/net/mptcp/path_manager ]; then
ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
pm_name="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
@@ -149,23 +136,22 @@ if [ -f /proc/sys/net/mptcp/path_manager ]; then
exit ${KSFT_FAIL}
fi
- set_path_manager "$ns1" "kernel"
- pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
+ mptcp_lib_set_path_manager "$ns2" "kernel"
+ pm_type="$(ip netns exec "$ns2" sysctl -n net.mptcp.pm_type)"
if [ "${pm_type}" != "0" ]; then
test_fail "unexpected pm_type: ${pm_type}"
mptcp_lib_result_print_all_tap
exit ${KSFT_FAIL}
fi
- set_path_manager "$ns1" "userspace"
- pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
+ mptcp_lib_set_path_manager "$ns2" "userspace"
+ pm_type="$(ip netns exec "$ns2" 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
- set_path_manager "$ns2" "userspace"
print_test "check path_manager and pm_type sysctl mapping"
test_pass
else