Skip to content

Commit

Permalink
Squash to "selftests/bpf: Add mptcp subflow subtest"
Browse files Browse the repository at this point in the history
Add pm_nl_ctl.
Use SYS_NOFAIL in _ss_search().

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed May 11, 2024
1 parent 8354b36 commit d419065
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \
test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \
xskxceiver xdp_redirect_multi xdp_synproxy veristat xdp_hw_metadata \
xdp_features bpf_test_no_cfi.ko
xdp_features bpf_test_no_cfi.ko pm_nl_ctl

TEST_GEN_FILES += liburandom_read.so urandom_read sign-file uprobe_multi

Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/pm_nl_ctl.c
15 changes: 4 additions & 11 deletions tools/testing/selftests/bpf/prog_tests/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ static int endpoint_init(char *flags)
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);
if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags))
SYS(fail, "ip netns exec %s ./pm_nl_ctl add %s flags %s", NS_TEST, ADDR_2, flags);

return 0;
fail:
Expand All @@ -355,16 +356,8 @@ static int endpoint_init(char *flags)

static int _ss_search(char *src, char *dst, char *port, char *keyword)
{
char cmd[128];
int n;

n = snprintf(cmd, sizeof(cmd),
"ip netns exec %s ss -Menita src %s dst %s %s %d | grep -q '%s'",
NS_TEST, src, dst, port, PORT_1, keyword);
if (n < 0 || n >= sizeof(cmd))
return -1;

return system(cmd);
return SYS_NOFAIL("ip netns exec %s ss -Menita src %s dst %s %s %d | grep -q '%s'",
NS_TEST, src, dst, port, PORT_1, keyword);
}

static int ss_search(char *src, char *keyword)
Expand Down

0 comments on commit d419065

Please sign in to comment.