aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_netcnt.c
diff options
context:
space:
mode:
authorLi Zhijian <lizhijian@cn.fujitsu.com>2018-11-05 16:57:48 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2018-11-09 10:55:09 +0100
commitda85d8bfd1512461bcfb64929e8426cf340b3707 (patch)
tree80d3afa80a30dd8c1a82c46eb78dfba71d65c4d1 /tools/testing/selftests/bpf/test_netcnt.c
parenttools: bpftool: update references to other man pages in documentation (diff)
downloadlinux-dev-da85d8bfd1512461bcfb64929e8426cf340b3707.tar.xz
linux-dev-da85d8bfd1512461bcfb64929e8426cf340b3707.zip
kselftests/bpf: use ping6 as the default ipv6 ping binary when it exists
At commit deee2cae27d1 ("kselftests/bpf: use ping6 as the default ipv6 ping binary if it exists"), it fixed similar issues for shell script, but it missed a same issue in the C code. Fixes: 371e4fcc9d96 ("selftests/bpf: cgroup local storage-based network counters") Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> CC: Philip Li <philip.li@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/test_netcnt.c')
-rw-r--r--tools/testing/selftests/bpf/test_netcnt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_netcnt.c b/tools/testing/selftests/bpf/test_netcnt.c
index 7887df693399..44ed7f29f8ab 100644
--- a/tools/testing/selftests/bpf/test_netcnt.c
+++ b/tools/testing/selftests/bpf/test_netcnt.c
@@ -81,7 +81,10 @@ int main(int argc, char **argv)
goto err;
}
- assert(system("ping localhost -6 -c 10000 -f -q > /dev/null") == 0);
+ if (system("which ping6 &>/dev/null") == 0)
+ assert(!system("ping6 localhost -c 10000 -f -q > /dev/null"));
+ else
+ assert(!system("ping -6 localhost -c 10000 -f -q > /dev/null"));
if (bpf_prog_query(cgroup_fd, BPF_CGROUP_INET_EGRESS, 0, NULL, NULL,
&prog_cnt)) {