From 36b914d87d3b3a9cb9554507d3f6702c89154f29 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sat, 3 Mar 2018 13:59:05 +0100 Subject: Use 'ss' in runtest.sh but fall back to deprecated 'net-tools' command Fixes bugzilla id #1209. --- tests/runtest.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/runtest.sh b/tests/runtest.sh index 8f4c02a..7afa1dd 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -45,12 +45,22 @@ add_tests() { `$cmd -t filter | grep ACCEPT | wc -l` -eq 3 ]; then if [ -z "`which sendip`" ]; then echo "sendip utility is missig: skipping $1 match and target tests" - elif [ -n "`netstat --protocol $1 -n | grep $2`" ]; then - echo "Our test network $2 in use: skipping $1 match and target tests" + return + elif [ -n "`which ss`" ]; then + if [ -n "`ss -f $1 -t -u -a | grep $2`" ]; then + echo "Our test network $2 in use: skipping $1 match and target tests" + return + fi + elif [ -n "`which netstat`" ]; then + if [ -n "`netstat --protocol $1 -n | grep $2`" ]; then + echo "Our test network $2 in use: skipping $1 match and target tests" + return + fi else - tests="$tests $add" + echo "Cannot check test network, skipping $1 match and target tests" + return fi - : + tests="$tests $add" else echo "You have got iptables rules: skipping $1 match and target tests" fi -- cgit v1.2.3