diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 7409f7c8b1f699..f84c74b87d23ec 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -536,28 +536,22 @@ static struct nstoken *sched_init(char *flags, char *sched) nstoken = create_netns(); if (!ASSERT_OK_PTR(nstoken, "create_netns")) + return NULL; + + if (!ASSERT_OK(endpoint_init("subflow"), "endpoint_init")) goto fail; - SYS(fail, "ip -net %s link add veth1 type veth peer name veth2", NS_TEST); - SYS(fail, "ip -net %s addr add %s/24 dev veth1", NS_TEST, ADDR_1); - SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST); - SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST, ADDR_2); - SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST); - SYS(fail, "ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags); SYS(fail, "ip netns exec %s sysctl -qw net.mptcp.scheduler=%s", NS_TEST, sched); return nstoken; fail: + cleanup_netns(nstoken); return NULL; } -static int has_bytes_sent(char *addr) +static int has_bytes_sent(char *dst) { - char cmd[128]; - - snprintf(cmd, sizeof(cmd), "ip netns exec %s ss -it src %s sport %d dst %s | %s", - NS_TEST, ADDR_1, PORT_1, addr, "grep -q bytes_sent:"); - return system(cmd); + return _ss_search(ADDR_1, dst, "sport", "bytes_sent:"); } static void send_data_and_verify(char *sched, bool addr1, bool addr2)