]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix sigterm test at last
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 1 May 2020 11:06:17 +0000 (12:06 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 1 May 2020 11:06:19 +0000 (12:06 +0100)
Make the main script wait for the device to be *up* not just exist.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
tests/scripts/vpnc-script-detect-disconnect
tests/sigterm

index 69e2330f4a4b45d55894876d15d7d6cbbe1e2dc2..fe6d1c71df7f3a78fbd202a422790ea88b5e9c54 100755 (executable)
@@ -4,9 +4,7 @@
 # For a real one, see http://www.infradead.org/openconnect/vpnc-script.html
 
 if [ "$reason" = "connect" ]; then
-    ip link show "$TUNDEV"
-    ip link set dev "$TUNDEV" up
-    ip link set dev "$TUNDEV" mtu "$INTERNAL_IP4_MTU"
+    ip link set dev "$TUNDEV" up mtu "$INTERNAL_IP4_MTU"
     ip addr add "$INTERNAL_IP4_ADDRESS/32" peer "$INTERNAL_IP4_ADDRESS" dev "$TUNDEV"
     ip -6 addr add $INTERNAL_IP6_NETMASK dev $TUNDEV
     rm -f ${DISCONNECT_FILE}
index 8412e7b52ba4134371ecac0051dab15bc34f3556..8a0e309d9d1a537ef9e502165fd6cfafeadf73fc 100755 (executable)
@@ -33,8 +33,6 @@ export DISCONNECT_FILE=disconnected-ok.$$.tmp
 
 . `dirname $0`/common.sh
 
-set -x
-
 rm -f ${DISCONNECT_FILE}
 
 if test -z "${IP}";then
@@ -104,7 +102,7 @@ set -e
 echo " * wait for ${TUNDEV}"
 
 TIMEOUT=10
-while ! ${CMDNS1} ip addr list dev ${TUNDEV} &>/dev/null; do
+while ! ${CMDNS1} ip link show dev ${TUNDEV} 2>/dev/null | grep -q UP; do
     TIMEOUT=$(($TIMEOUT - 1))
     if [ $TIMEOUT -eq 0 ]; then
        echo "Timed out waiting for ${TUNDEV}"