diff options
Diffstat (limited to '40-openvpn')
-rwxr-xr-x | 40-openvpn | 29 |
1 files changed, 18 insertions, 11 deletions
@@ -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 |