]> granicus.if.org Git - ipset/commitdiff
Use 'ss' in runtest.sh but fall back to deprecated 'net-tools' command
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 3 Mar 2018 12:59:05 +0000 (13:59 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 3 Mar 2018 12:59:05 +0000 (13:59 +0100)
Fixes bugzilla id #1209.

tests/runtest.sh

index 8f4c02a4373a2c3c1a7dd693a14534632a1b9933..7afa1dd0eb20d66bc77b296b2467e49b442e23c2 100755 (executable)
@@ -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