On 7/31/24 14:09, Stanislav Fomichev wrote:
On 07/31, Kui-Feng Lee wrote:
Enable traffic monitor for each subtest of sockmap_listen.
Signed-off-by: Kui-Feng Lee <thinker.li@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
index 9ce0e0e0b7da..2030472fb8e8 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -1926,14 +1926,23 @@ static void test_udp_unix_redir(struct test_sockmap_listen *skel, struct bpf_map
{
const char *family_name, *map_name;
char s[MAX_TEST_NAME];
+ struct netns_obj *netns;
family_name = family_str(family);
map_name = map_type_str(map);
snprintf(s, sizeof(s), "%s %s %s", map_name, family_name, __func__);
if (!test__start_subtest(s))
return;
+
+ netns = netns_new("test", true);
+ if (!ASSERT_OK_PTR(netns, "netns_new"))
+ return;
[..]
+ system("ip link set lo up");
Let's do this in netns_new? We almost always want it in a new ns. The
tests that don't need a loopback can do "lo down".
Agree!