From: Jozsef Kadlecsik Date: Sat, 3 Mar 2018 12:59:05 +0000 (+0100) Subject: Use 'ss' in runtest.sh but fall back to deprecated 'net-tools' command X-Git-Tag: v6.36~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36b914d87d3b3a9cb9554507d3f6702c89154f29;p=thirdparty%2Fipset.git Use 'ss' in runtest.sh but fall back to deprecated 'net-tools' command Fixes bugzilla id #1209. --- diff --git a/tests/runtest.sh b/tests/runtest.sh index 8f4c02a4..7afa1dd0 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