diff options
author | 2024-08-14 22:32:51 -0700 | |
---|---|---|
committer | 2024-08-15 12:26:40 -0700 | |
commit | 1e115a58be0ffca63727dc0495dae924a19f8cd4 (patch) | |
tree | c6d021e2ea2064fab121c5130ee7b1ab5ed047e9 /tools/testing/selftests/bpf/test_progs.h | |
parent | selftests/bpf: Add the traffic monitor option to test_progs. (diff) | |
download | wireguard-linux-1e115a58be0ffca63727dc0495dae924a19f8cd4.tar.xz wireguard-linux-1e115a58be0ffca63727dc0495dae924a19f8cd4.zip |
selftests/bpf: netns_new() and netns_free() helpers.
netns_new()/netns_free() create/delete network namespaces. They support the
option '-m' of test_progs to start/stop traffic monitor for the network
namespace being created for matched tests.
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Link: https://lore.kernel.org/r/20240815053254.470944-4-thinker.li@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index 966011eb7ec8..3ad131de14c6 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -430,6 +430,10 @@ int write_sysctl(const char *sysctl, const char *value); int get_bpf_max_tramp_links_from(struct btf *btf); int get_bpf_max_tramp_links(void); +struct netns_obj; +struct netns_obj *netns_new(const char *name, bool open); +void netns_free(struct netns_obj *netns); + #ifdef __x86_64__ #define SYS_NANOSLEEP_KPROBE_NAME "__x64_sys_nanosleep" #elif defined(__s390x__) |