aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKui-Feng Lee <[email protected]>2024-08-14 22:32:53 -0700
committerMartin KaFai Lau <[email protected]>2024-08-15 12:26:57 -0700
commitb407b52b18505a7c09a77cbab022ec6cf82dc5f0 (patch)
tree69563713da4ca72d73324699259fcee23e23293f
parent52a5b8a30fa882c4d363f7679b7db4a093550ac1 (diff)
selftests/bpf: Monitor traffic for sockmap_listen.
Enable traffic monitor for each subtest of sockmap_listen. Acked-by: Stanislav Fomichev <[email protected]> Signed-off-by: Kui-Feng Lee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sockmap_listen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
index 9ce0e0e0b7da..ebb5f6336052 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -1925,6 +1925,7 @@ static void test_udp_unix_redir(struct test_sockmap_listen *skel, struct bpf_map
int family)
{
const char *family_name, *map_name;
+ struct netns_obj *netns;
char s[MAX_TEST_NAME];
family_name = family_str(family);
@@ -1932,8 +1933,15 @@ static void test_udp_unix_redir(struct test_sockmap_listen *skel, struct bpf_map
snprintf(s, sizeof(s), "%s %s %s", map_name, family_name, __func__);
if (!test__start_subtest(s))
return;
+
+ netns = netns_new("sockmap_listen", true);
+ if (!ASSERT_OK_PTR(netns, "netns_new"))
+ return;
+
inet_unix_skb_redir_to_connected(skel, map, family);
unix_inet_skb_redir_to_connected(skel, map, family);
+
+ netns_free(netns);
}
static void run_tests(struct test_sockmap_listen *skel, struct bpf_map *map,