From: Geliang Tang <tanggeliang@xxxxxxxxxx> This patchset addresses Alexei's comment for commit "Handle SIGINT when creating netns" [1]. Export local helpers create_netns() and cleanup_netns() defined in mptcp.c into network_helpers.c as generic ones. For this another helper unshare_netns() is added to replace the existing local helpers create_netns(). v2: - drop patch 9, it breaks CI - delete netns first before adding it in patch 4 - move cleanup_netns behind create_netns in patch 6 [1] https://patchwork.kernel.org/project/mptcp/patch/20240507-upstream-bpf-next-20240506-mptcp-subflow-test-v1-1-e2bcbdf49857@xxxxxxxxxx/ Geliang Tang (8): selftests/bpf: Add unshare_netns helper selftests/bpf: Use unshare_netns helper selftests/bpf: Drop duplicate create_netns selftests/bpf: Export create_netns helper selftests/bpf: Use create_netns helper selftests/bpf: Export cleanup_netns helper selftests/bpf: Use cleanup_netns helper selftests/bpf: Use netns helpers in lwt tests tools/testing/selftests/bpf/network_helpers.c | 68 +++++++++++++++++++ tools/testing/selftests/bpf/network_helpers.h | 3 + .../selftests/bpf/prog_tests/assign_reuse.c | 12 +--- .../selftests/bpf/prog_tests/bind_perm.c | 11 +-- .../bpf/prog_tests/bpf_iter_setsockopt.c | 13 +--- .../bpf/prog_tests/btf_skc_cls_ingress.c | 6 +- .../selftests/bpf/prog_tests/crypto_sanity.c | 3 +- .../selftests/bpf/prog_tests/decap_sanity.c | 6 +- .../selftests/bpf/prog_tests/fib_lookup.c | 8 +-- .../selftests/bpf/prog_tests/lwt_helpers.h | 26 ++----- .../selftests/bpf/prog_tests/lwt_redirect.c | 2 - .../selftests/bpf/prog_tests/lwt_reroute.c | 2 - .../testing/selftests/bpf/prog_tests/mptcp.c | 22 +----- .../bpf/prog_tests/ns_current_pid_tgid.c | 9 +-- .../selftests/bpf/prog_tests/setget_sockopt.c | 10 +-- .../selftests/bpf/prog_tests/sk_assign.c | 4 +- .../selftests/bpf/prog_tests/sock_destroy.c | 9 +-- .../selftests/bpf/prog_tests/sock_fields.c | 13 +--- .../bpf/prog_tests/sock_iter_batch.c | 9 +-- .../bpf/prog_tests/tcp_custom_syncookie.c | 5 +- .../bpf/prog_tests/tcp_hdr_options.c | 13 +--- .../bpf/prog_tests/xdp_dev_bound_only.c | 3 +- .../bpf/prog_tests/xdp_do_redirect.c | 4 +- 23 files changed, 106 insertions(+), 155 deletions(-) -- 2.43.0