From patchwork Wed May 15 05:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 797390 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DABE3D541; Wed, 15 May 2024 06:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752808; cv=none; b=hMqsszsQ/Wn+XUSz6FF8DkMPYTScHzpeltGPCY0RjYDnYYsnJMXlVY7cnpVAyUquMu5EorhDXv3uBq0siJkcUnEWtjEAk+0gFWGUhyvwWzX5k88+J8WhlOslvVZoi+p5J0HoKGIHfcn7Gkme2utmaDXXzRf6iq7MPK6+UHeUHEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752808; c=relaxed/simple; bh=AQ3tkiONemRilHkmlqquV+TjmIQLfUDgsuuM0Tf2bCk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QuhQ9GXdmCBvrOvjLxxOoiU06KBrswLxWMJAljDW+DN6ysWTTmGfCyRmbE9tp09EyUi87UJxKGJtK1G1satno1aiiyFe8F3wWtIA4hIPNcpp3cukdnmU4dfIVlAV+gARHZr69UzOjAAB99DGh80CTzzOHLXCZl4wwAq9ropI3xc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fxmBmR1I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fxmBmR1I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1FBC116B1; Wed, 15 May 2024 06:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715752808; bh=AQ3tkiONemRilHkmlqquV+TjmIQLfUDgsuuM0Tf2bCk=; h=From:To:Cc:Subject:Date:From; b=fxmBmR1IJ80bdF0JfJhMKEigeOYplQSs1LMYxRQ3XHy/7ttki/1fYBwhrEkADErP7 x/lriRh0i41gL1HjzK/KL+MuCqF4l/+Yz0GdRlJ6UPTI7JRAY1qLOR06WXYgnnUwMq hw9pcEJMYKgZUHx58Z5PeqY4cBEwOtFYiA6NtAs8WsTfa9Fgsw9WkEU1Ab6CCm5OkA wK7Tz8wmXlIEypkePJpiaaGCyy+weRmRzukKUoo9yOVLFFi2oEz7WI3sYx4h1uLpSF eQBMJiA8H84DG20Y9F0yqnhhZGu50lz4aClVGeZn93orjlXEUHyHd2Z0VLAGOFKTMB AWqlNFGsFYBjg== From: Geliang Tang To: Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: Geliang Tang , bpf@vger.kernel.org, mptcp@lists.linux.dev, linux-kselftest@vger.kernel.org, Geliang Tang Subject: [PATCH bpf-next 0/9] add netns helpers Date: Wed, 15 May 2024 13:59:27 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang 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(). [1] https://patchwork.kernel.org/project/mptcp/patch/20240507-upstream-bpf-next-20240506-mptcp-subflow-test-v1-1-e2bcbdf49857@kernel.org/ Geliang Tang (9): 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 selftests/bpf: Use netns helpers in test_tunnel tools/testing/selftests/bpf/network_helpers.c | 67 +++++++++++++++++++ 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 | 7 +- .../bpf/prog_tests/tcp_custom_syncookie.c | 5 +- .../bpf/prog_tests/tcp_hdr_options.c | 13 +--- .../selftests/bpf/prog_tests/test_tunnel.c | 19 +++--- .../bpf/prog_tests/xdp_dev_bound_only.c | 3 +- .../bpf/prog_tests/xdp_do_redirect.c | 4 +- 24 files changed, 114 insertions(+), 163 deletions(-)