aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/netfilter/nf_nat_edemux.sh
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2021-12-27 11:52:53 +0800
committerPablo Neira Ayuso <pablo@netfilter.org>2022-01-06 10:43:18 +0100
commit1585f590a2e5dcae5833b05e030c47229299dd09 (patch)
tree3c26f705511a0e1d56514a55081c395bc564860b /tools/testing/selftests/netfilter/nf_nat_edemux.sh
parentnetfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check() (diff)
downloadlinux-dev-1585f590a2e5dcae5833b05e030c47229299dd09.tar.xz
linux-dev-1585f590a2e5dcae5833b05e030c47229299dd09.zip
selftests: netfilter: switch to socat for tests using -q option
The nc cmd(nmap-ncat) that distributed with Fedora/Red Hat does not have option -q. This make some tests failed with: nc: invalid option -- 'q' Let's switch to socat which is far more dependable. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to '')
-rwxr-xr-xtools/testing/selftests/netfilter/nf_nat_edemux.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/testing/selftests/netfilter/nf_nat_edemux.sh b/tools/testing/selftests/netfilter/nf_nat_edemux.sh
index cfee3b65be0f..1092bbcb1fba 100755
--- a/tools/testing/selftests/netfilter/nf_nat_edemux.sh
+++ b/tools/testing/selftests/netfilter/nf_nat_edemux.sh
@@ -76,23 +76,23 @@ ip netns exec $ns2 ip route add 10.96.0.1 via 192.168.1.1
sleep 1
# add a persistent connection from the other namespace
-ip netns exec $ns2 nc -q 10 -w 10 192.168.1.1 5201 > /dev/null &
+ip netns exec $ns2 socat -t 10 - TCP:192.168.1.1:5201 > /dev/null &
sleep 1
# ip daddr:dport will be rewritten to 192.168.1.1 5201
# NAT must reallocate source port 10000 because
# 192.168.1.2:10000 -> 192.168.1.1:5201 is already in use
-echo test | ip netns exec $ns2 nc -w 3 -q 3 10.96.0.1 443 >/dev/null
+echo test | ip netns exec $ns2 socat -t 3 -u STDIN TCP:10.96.0.1:443 >/dev/null
ret=$?
kill $iperfs
-# Check nc can connect to 10.96.0.1:443 (aka 192.168.1.1:5201).
+# Check socat can connect to 10.96.0.1:443 (aka 192.168.1.1:5201).
if [ $ret -eq 0 ]; then
- echo "PASS: nc can connect via NAT'd address"
+ echo "PASS: socat can connect via NAT'd address"
else
- echo "FAIL: nc cannot connect via NAT'd address"
+ echo "FAIL: socat cannot connect via NAT'd address"
exit 1
fi