Skip to content

Commit 3f66120

Browse files
kmaincentakodanev
authored andcommitted
tcp_cmds/ping/ping02: Make it compatible with Busybox
The ping from busybox does not have -f parameter, use -i parameter instead. BusyBox does not accept pattern longer than 2 bytes. BusyBox support -i option since version 1.30 Signed-off-by: Kory Maincent <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Alexey Kodanev <[email protected]>
1 parent a41150d commit 3f66120

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

testcases/network/tcp_cmds/ping/ping02.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,26 @@ do_setup()
1616
PING=ping${TST_IPV6}
1717

1818
tst_require_cmds $PING
19+
20+
ping_opts="-f -p 000102030405060708090a0b0c0d0e0f"
21+
ipaddr=$(tst_ipaddr rhost)
22+
23+
if ! $PING -c 1 -f $ipaddr >/dev/null 2>&1; then
24+
ping_opts="-i 0.01 -p aa"
25+
if $PING -i 2>&1 | grep -q "invalid option"; then
26+
tst_brk TCONF "unsupported ping version (old busybox?)"
27+
fi
28+
fi
1929
}
2030

2131
do_test()
2232
{
23-
local pat="000102030405060708090a0b0c0d0e0f"
24-
25-
tst_res TINFO "flood $PING: ICMP packets filled with pattern '$pat'"
26-
27-
local ipaddr=$(tst_ipaddr rhost)
2833
local s
2934

35+
tst_res TINFO "flood $PING: ICMP packets with options '$ping_opts'"
36+
3037
for s in $PACKETSIZES; do
31-
EXPECT_PASS $PING -c $COUNT -f -s $s $ipaddr -p "$pat" \>/dev/null
38+
EXPECT_PASS $PING -c $COUNT -s $s $ipaddr $ping_opts \>/dev/null
3239
done
3340
}
3441

0 commit comments

Comments
 (0)