aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-10-23 10:39:58 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-10-23 10:39:58 +0200
commitb99fa05ea36a7fc090602b4295a5a5edc95ca853 (patch)
treebe5e9476dd7d9246c2b6ed3085b9fa53740aa1ab
parent8612f9f3c371631fa33a4279bdad20c0d31d6c7c (diff)
downloadnetworkmanager-dispatcher-openvpn-b99fa05ea36a7fc090602b4295a5a5edc95ca853.tar.gz
networkmanager-dispatcher-openvpn-b99fa05ea36a7fc090602b4295a5a5edc95ca853.tar.zst
be a bit more verbose and fix tun/tap detection
-rwxr-xr-x40-openvpn29
1 files changed, 18 insertions, 11 deletions
diff --git a/40-openvpn b/40-openvpn
index 502dc6b..7cc96b4 100755
--- a/40-openvpn
+++ b/40-openvpn
@@ -3,15 +3,22 @@
INTERFACE="${1}"
STATUS="${2}"
-# VPN interfaces managed by networkmanager send events vpn-{up,down}.
-# If the connection is started by whatever networkmanager sees this
-# and triggers event up or down. Ignore these.
-if ! ip tuntap | grep -q "^${INTERFACE}:"; then
- exit 0
-fi
+case "${STATUS}" in
+ up)
+ # VPN interfaces managed by networkmanager send events vpn-{up,down}.
+ # If the connection is started by whatever networkmanager sees this
+ # and triggers event up or down. Ignore these.
+ if ip tuntap | grep -q "^${INTERFACE}:"; then
+ echo "${0}: ${INTERFACE} changed status to up, but is tun/tap. Ignoring."
+ exit 0
+ fi
-if [ "${STATUS}" == "up" ]; then
- if pgrep -x openvpn >/dev/null; then
- kill -USR1 $(pgrep -x openvpn)
- fi
-fi
+ if pgrep -x openvpn >/dev/null; then
+ echo "${0}: ${INTERFACE} changed status to up, sending restart to openvpn."
+ kill -USR1 $(pgrep -x openvpn)
+ fi
+ ;;
+ *)
+ echo "${0}: ${INTERFACE} changed status to ${STATUS}, ignoring."
+ ;;
+esac