@@ -175,12 +175,9 @@ void test_assign_reuse(void)
{
struct nstoken *tok = NULL;
- SYS(out, "ip netns add %s", NS_TEST);
- SYS(cleanup, "ip -net %s link set dev lo up", NS_TEST);
-
- tok = open_netns(NS_TEST);
+ tok = create_netns(NS_TEST);
if (!ASSERT_OK_PTR(tok, "netns token"))
- return;
+ goto cleanup;
if (test__start_subtest("tcpv4"))
run_assign_reuse(AF_INET, SOCK_STREAM, "127.0.0.1", PORT);
@@ -194,6 +191,4 @@ void test_assign_reuse(void)
cleanup:
close_netns(tok);
SYS_NOFAIL("ip netns delete %s", NS_TEST);
-out:
- return;
}
@@ -315,9 +315,7 @@ void test_fib_lookup(void)
return;
prog_fd = bpf_program__fd(skel->progs.fib_lookup);
- SYS(fail, "ip netns add %s", NS_TEST);
-
- nstoken = open_netns(NS_TEST);
+ nstoken = create_netns(NS_TEST);
if (!ASSERT_OK_PTR(nstoken, "open_netns"))
goto fail;
@@ -204,10 +204,7 @@ static void test_in_netns(int (*fn)(void *), void *arg)
{
struct nstoken *nstoken = NULL;
- SYS(cleanup, "ip netns add ns_current_pid_tgid");
- SYS(cleanup, "ip -net ns_current_pid_tgid link set dev lo up");
-
- nstoken = open_netns("ns_current_pid_tgid");
+ nstoken = create_netns("ns_current_pid_tgid");
if (!ASSERT_OK_PTR(nstoken, "open_netns"))
goto cleanup;
@@ -193,10 +193,7 @@ void test_sock_destroy(void)
if (!ASSERT_OK_PTR(skel->links.sock_connect, "prog_attach"))
goto cleanup;
- SYS(cleanup, "ip netns add %s", TEST_NS);
- SYS(cleanup, "ip -net %s link set dev lo up", TEST_NS);
-
- nstoken = open_netns(TEST_NS);
+ nstoken = create_netns(TEST_NS);
if (!ASSERT_OK_PTR(nstoken, "open_netns"))
goto cleanup;
@@ -112,11 +112,7 @@ void test_sock_iter_batch(void)
{
struct nstoken *nstoken = NULL;
- SYS_NOFAIL("ip netns del " TEST_NS);
- SYS(done, "ip netns add %s", TEST_NS);
- SYS(done, "ip -net %s link set dev lo up", TEST_NS);
-
- nstoken = open_netns(TEST_NS);
+ nstoken = create_netns(TEST_NS);
if (!ASSERT_OK_PTR(nstoken, "open_netns"))
goto done;