mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-13 12:49:35 +02:00
selftests/net: add variable NS_LIST for lib.sh
commit b6925b4ed5
upstream.
Add a global variable NS_LIST to store all the namespaces that setup_ns
created, so the caller could call cleanup_all_ns() instead of remember
all the netns names when using cleanup_ns().
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20231213060856.4030084-2-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
04f7b9b4d7
commit
2a969959b9
|
@ -6,6 +6,8 @@
|
|||
|
||||
# Kselftest framework requirement - SKIP code is 4.
|
||||
ksft_skip=4
|
||||
# namespace list created by setup_ns
|
||||
NS_LIST=""
|
||||
|
||||
##############################################################################
|
||||
# Helpers
|
||||
|
@ -56,6 +58,11 @@ cleanup_ns()
|
|||
return $ret
|
||||
}
|
||||
|
||||
cleanup_all_ns()
|
||||
{
|
||||
cleanup_ns $NS_LIST
|
||||
}
|
||||
|
||||
# setup netns with given names as prefix. e.g
|
||||
# setup_ns local remote
|
||||
setup_ns()
|
||||
|
@ -82,4 +89,5 @@ setup_ns()
|
|||
ip -n "$ns" link set lo up
|
||||
ns_list="$ns_list $ns"
|
||||
done
|
||||
NS_LIST="$NS_LIST $ns_list"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user