diff mbox series

[v2] selftests: net: udpgro_fwd.sh: Use ping6 on systems where ping doesn't handle IPv6

Message ID a2295ebf-0734-a480-e908-caf5c02cb6a9@163.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2] selftests: net: udpgro_fwd.sh: Use ping6 on systems where ping doesn't handle IPv6 | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Jianguo Wu Dec. 31, 2021, 1:10 a.m. UTC
From: Jianguo Wu <wujianguo@chinatelecom.cn>

In CentOS7(iputils-20160308-10.el7.x86_64), udpgro_fwd.sh output
following message:
  ping: 2001:db8:1::100: Address family for hostname not supported

Use ping6 on systems where ping doesn't handle IPv6.

v1 -> v2:
 - explicitly checking the available ping feature, as e.g. do the
   bareudp.sh self-tests.(Paolo)

Fixes: a062260a9d5f ("selftests: net: add UDP GRO forwarding self-tests")
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
---
 tools/testing/selftests/net/udpgro_fwd.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/udpgro_fwd.sh b/tools/testing/selftests/net/udpgro_fwd.sh
index 6a3985b..6f05e06 100755
--- a/tools/testing/selftests/net/udpgro_fwd.sh
+++ b/tools/testing/selftests/net/udpgro_fwd.sh
@@ -185,6 +185,7 @@  for family in 4 6; do
 	IPT=iptables
 	SUFFIX=24
 	VXDEV=vxlan
+	PING=ping

 	if [ $family = 6 ]; then
 		BM_NET=$BM_NET_V6
@@ -192,6 +193,8 @@  for family in 4 6; do
 		SUFFIX="64 nodad"
 		VXDEV=vxlan6
 		IPT=ip6tables
+		# Use ping6 on systems where ping doesn't handle IPv6
+		ping -w 1 -c 1 ::1 > /dev/null 2>&1 || PING="ping6"
 	fi

 	echo "IPv$family"
@@ -237,7 +240,7 @@  for family in 4 6; do

 	# load arp cache before running the test to reduce the amount of
 	# stray traffic on top of the UDP tunnel
-	ip netns exec $NS_SRC ping -q -c 1 $OL_NET$DST_NAT >/dev/null
+	ip netns exec $NS_SRC $PING -q -c 1 $OL_NET$DST_NAT >/dev/null
 	run_test "GRO fwd over UDP tunnel" $OL_NET$DST_NAT 1 1 $OL_NET$DST
 	cleanup