diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index eec1f04d231f59..9e19e3e8d833b0 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -33,7 +33,7 @@ cleanup() { ip netns pids "${ns1}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null - mptcp_lib_ns_exit "${ns1}" + cleanup_all_ns } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index b77fb7065bfb8c..4e2c5dd0de3c48 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -142,7 +142,7 @@ cleanup() rm -f "$sin" "$sout" rm -f "$capout" - mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" "${ns4}" + cleanup_all_ns } mptcp_lib_check_mptcp @@ -271,7 +271,6 @@ check_mptcp_disabled() local err=0 LC_ALL=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ grep -q "^socket: Protocol not available$" && err=1 - mptcp_lib_ns_exit "${disabled_ns}" if [ ${err} -eq 0 ]; then mptcp_lib_pr_fail "New MPTCP socket cannot be blocked via sysctl" diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index fefa9173bdaaab..87a518b8c19f94 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -132,8 +132,6 @@ init_shapers() cleanup_partial() { rm -f "$capout" - - mptcp_lib_ns_exit "${ns1}" "${ns2}" } init() { @@ -166,6 +164,7 @@ cleanup() rm -rf $evts_ns1 $evts_ns2 rm -f "$err" cleanup_partial + cleanup_all_ns } print_check() diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 59eb77e7813db7..bd7d78e4aa83cc 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -424,14 +424,6 @@ mptcp_lib_ns_init() { done } -mptcp_lib_ns_exit() { - local netns - for netns in "${@}"; do - ip netns del "${netns}" - rm -f /tmp/"${netns}".{nstat,out} - done -} - mptcp_lib_events() { local ns="${1}" local evts="${2}" diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 68899a303a1aef..e1026b028739f2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -98,7 +98,7 @@ init() #shellcheck disable=SC2317 cleanup() { - mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns_sbox}" + cleanup_all_ns rm -f "$cin" "$cout" rm -f "$sin" "$sout" } diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 2757378b1b1366..5b4d83c2e28051 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -36,7 +36,7 @@ err=$(mktemp) cleanup() { rm -f "${err}" - mptcp_lib_ns_exit "${ns1}" + cleanup_all_ns } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index d0b39c2e38a3c6..6eddb3bba2e830 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -42,7 +42,7 @@ cleanup() rm -f "$large" "$small" rm -f "$capout" - mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" + cleanup_all_ns } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 9e2981f2d7f5ce..0c089e7f5f0abc 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -107,7 +107,7 @@ cleanup() mptcp_lib_kill_wait $pid done - mptcp_lib_ns_exit "${ns1}" "${ns2}" + cleanup_all_ns rm -rf $file $client_evts $server_evts