Commit d46cea0e authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

selftests: netfilter: switch zone stress to socat

centos9 has nmap-ncat which doesn't like the '-q' option, use socat.
While at it, mark test skipped if needed tools are missing.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 962e5a40
...@@ -18,11 +18,17 @@ cleanup() ...@@ -18,11 +18,17 @@ cleanup()
ip netns del $ns ip netns del $ns
} }
ip netns add $ns checktool (){
if [ $? -ne 0 ];then if ! $1 > /dev/null 2>&1; then
echo "SKIP: Could not create net namespace $gw" echo "SKIP: Could not $2"
exit $ksft_skip exit $ksft_skip
fi fi
}
checktool "nft --version" "run test without nft tool"
checktool "ip -Version" "run test without ip tool"
checktool "socat -V" "run test without socat tool"
checktool "ip netns add $ns" "create net namespace"
trap cleanup EXIT trap cleanup EXIT
...@@ -71,7 +77,8 @@ EOF ...@@ -71,7 +77,8 @@ EOF
local start=$(date +%s%3N) local start=$(date +%s%3N)
i=$((i + 10000)) i=$((i + 10000))
j=$((j + 1)) j=$((j + 1))
dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" nc -w 1 -q 1 -u -p 12345 127.0.0.1 12345 > /dev/null # nft rule in output places each packet in a different zone.
dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
if [ $? -ne 0 ] ;then if [ $? -ne 0 ] ;then
ret=1 ret=1
break break
......
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