Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: switch to socat in the GSO GRE test

Commit a985442fdecb ("selftests: net: properly support IPv6 in GSO GRE test")
is not compatible with:

Ncat: Version 7.80 ( https://nmap.org/ncat )

(which is distributed with Fedora/Red Hat), tests fail with:

nc: invalid option -- 'N'

Let's switch to socat which is far more dependable.

Fixes: 025efa0a82df ("selftests: add simple GSO GRE test")
Fixes: a985442fdecb ("selftests: net: properly support IPv6 in GSO GRE test")
Tested-by: Andrea Righi <andrea.righi@canonical.com>
Link: https://lore.kernel.org/r/20211111162929.530470-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+9 -7
+9 -7
tools/testing/selftests/net/gre_gso.sh
··· 118 118 local addr=$2 119 119 local proto=$3 120 120 121 - $NS_EXEC nc $proto -kl $port >/dev/null & 121 + [ "$proto" == 6 ] && addr="[$addr]" 122 + 123 + $NS_EXEC socat - tcp${proto}-listen:$port,reuseaddr,fork >/dev/null & 122 124 PID=$! 123 125 while ! $NS_EXEC ss -ltn | grep -q $port; do ((i++)); sleep 0.01; done 124 126 125 - cat $TMPFILE | timeout 1 nc $proto -N $addr $port 127 + cat $TMPFILE | timeout 1 socat -u STDIN TCP:$addr:$port 126 128 log_test $? 0 "$name - copy file w/ TSO" 127 129 128 130 ethtool -K veth0 tso off 129 131 130 - cat $TMPFILE | timeout 1 nc $proto -N $addr $port 132 + cat $TMPFILE | timeout 1 socat -u STDIN TCP:$addr:$port 131 133 log_test $? 0 "$name - copy file w/ GSO" 132 134 133 135 ethtool -K veth0 tso on ··· 157 155 158 156 sleep 2 159 157 160 - gre_gst_test_checks GREv6/v4 172.16.2.2 161 - gre_gst_test_checks GREv6/v6 2001:db8:1::2 -6 158 + gre_gst_test_checks GREv6/v4 172.16.2.2 4 159 + gre_gst_test_checks GREv6/v6 2001:db8:1::2 6 162 160 163 161 cleanup 164 162 } ··· 214 212 exit $ksft_skip 215 213 fi 216 214 217 - if [ ! -x "$(command -v nc)" ]; then 218 - echo "SKIP: Could not run test without nc tool" 215 + if [ ! -x "$(command -v socat)" ]; then 216 + echo "SKIP: Could not run test without socat tool" 219 217 exit $ksft_skip 220 218 fi 221 219