Message ID | 20240607-upstream-net-next-20240607-selftests-mptcp-net-lib-v1-3-e36986faac94@kernel.org |
---|---|
State | Accepted |
Commit | 577db6bd5750b6de70f7017dfa2ad98d8934993b |
Headers | show |
Series | selftests: mptcp: use net/lib.sh to manage netns | expand |
diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index c7a8cfb477cc..114b927fee25 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -172,11 +172,11 @@ setup_ns() local ns_list=() for ns_name in "$@"; do # Some test may setup/remove same netns multi times - if unset ${ns_name} 2> /dev/null; then + if [ -z "${!ns_name}" ]; then ns="${ns_name,,}-$(mktemp -u XXXXXX)" - eval readonly ${ns_name}="$ns" + eval "${ns_name}=${ns}" else - eval ns='$'${ns_name} + ns="${!ns_name}" cleanup_ns "$ns" fi