diff options
-rwxr-xr-x | usr/local/sbin/ovpn-linkup | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr/local/sbin/ovpn-linkup b/usr/local/sbin/ovpn-linkup index b613a9a..0f1ca80 100755 --- a/usr/local/sbin/ovpn-linkup +++ b/usr/local/sbin/ovpn-linkup @@ -2,11 +2,17 @@ # let the configuration system know that the ip has changed. #/usr/local/sbin/pfSctl -c "interface newip $interface" -if [ "" != "$route_vpn_gateway" ]; then - /bin/echo $route_vpn_gateway > /tmp/$1_router -else - /bin/echo $5 > /tmp/$1_router + + +ifindex="${1##?????}" +if [ -f /dev/tun$ifindex ]; then + if [ "" != "$route_vpn_gateway" ]; then + /bin/echo $route_vpn_gateway > /tmp/$1_router + else + /bin/echo $5 > /tmp/$1_router + fi fi + /usr/bin/touch /tmp/$1up # reload filter /usr/local/sbin/pfSctl -c "interface newip $1" |