Commit deee2cae authored by Li Zhijian's avatar Li Zhijian Committed by Daniel Borkmann

kselftests/bpf: use ping6 as the default ipv6 ping binary if it exists

ping binary on some distros doesn't support "ping -6" anymore.
Signed-off-by: default avatarLi Zhijian <lizhijian@cn.fujitsu.com>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 27b31e68
...@@ -10,7 +10,7 @@ wait_for_ip() ...@@ -10,7 +10,7 @@ wait_for_ip()
echo -n "Wait for testing link-local IP to become available " echo -n "Wait for testing link-local IP to become available "
for _i in $(seq ${MAX_PING_TRIES}); do for _i in $(seq ${MAX_PING_TRIES}); do
echo -n "." echo -n "."
if ping -6 -q -c 1 -W 1 ff02::1%${TEST_IF} >/dev/null 2>&1; then if $PING6 -c 1 -W 1 ff02::1%${TEST_IF} >/dev/null 2>&1; then
echo " OK" echo " OK"
return return
fi fi
...@@ -58,5 +58,6 @@ BPF_PROG_OBJ="${DIR}/test_skb_cgroup_id_kern.o" ...@@ -58,5 +58,6 @@ BPF_PROG_OBJ="${DIR}/test_skb_cgroup_id_kern.o"
BPF_PROG_SECTION="cgroup_id_logger" BPF_PROG_SECTION="cgroup_id_logger"
BPF_PROG_ID=0 BPF_PROG_ID=0
PROG="${DIR}/test_skb_cgroup_id_user" PROG="${DIR}/test_skb_cgroup_id_user"
type ping6 >/dev/null 2>&1 && PING6="ping6" || PING6="ping -6"
main main
...@@ -4,7 +4,8 @@ set -eu ...@@ -4,7 +4,8 @@ set -eu
ping_once() ping_once()
{ {
ping -${1} -q -c 1 -W 1 ${2%%/*} >/dev/null 2>&1 type ping${1} >/dev/null 2>&1 && PING="ping${1}" || PING="ping -${1}"
$PING -q -c 1 -W 1 ${2%%/*} >/dev/null 2>&1
} }
wait_for_ip() wait_for_ip()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment