From: Hangbin Liu <liuhangbin@xxxxxxxxx> commit b6925b4ed57cccf42ca0fb46c7446f0859e7ad4b 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@xxxxxxxxx> Link: https://lore.kernel.org/r/20231213060856.4030084-2-liuhangbin@xxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Po-Hsu Lin <po-hsu.lin@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/net/lib.sh | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -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" } Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are queue-6.6/swiotlb-enforce-page-alignment-in-swiotlb_alloc.patch queue-6.6/selftests-net-add-lib.sh.patch queue-6.6/xfs-shrink-failure-needs-to-hold-agi-buffer.patch queue-6.6/xfs-fix-scrub-stats-file-permissions.patch queue-6.6/swiotlb-extend-buffer-pre-padding-to-alloc_align_mask-if-necessary.patch queue-6.6/xfs-fix-imprecise-logic-in-xchk_btree_check_block_owner.patch queue-6.6/xfs-ensure-submit-buffers-on-lsn-boundaries-in-error-handlers.patch queue-6.6/xfs-fix-seek_hole-data-for-regions-with-active-cow-extents.patch queue-6.6/xfs-don-t-use-current-journal_info.patch queue-6.6/xfs-allow-cross-linking-special-files-without-project-quota.patch queue-6.6/xfs-allow-sunit-mount-option-to-repair-bad-primary-sb-stripe-values.patch queue-6.6/swiotlb-reinstate-page-alignment-for-mappings-page_size.patch queue-6.6/selftests-net-add-variable-ns_list-for-lib.sh.patch