]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
iproute2 is Linux only; don't try to set IPROUTE on another OS
authorDaniel Lenski <daniel.lenski@finalphasesystems.com>
Thu, 6 Jun 2019 00:31:38 +0000 (17:31 -0700)
committerDaniel Lenski <daniel.lenski@finalphasesystems.com>
Thu, 6 Jun 2019 00:32:22 +0000 (17:32 -0700)
If `which ip` returns something on another OS, it's an unrelated tool that
won't work for routing configuration. This should fix the macOS issue
discovered at:
https://github.com/dlenski/openconnect/issues/132#issuecomment-470475009

Signed-off-by: Daniel Lenski <daniel.lenski@finalphasesystems.com>
vpnc-script

index dafd10ce63b0d2ed4926b56cb517196f17906790..64f255019558ced73b81570de5f1d57299096b94 100755 (executable)
@@ -88,9 +88,6 @@ if [ ! -d "/var/run/vpnc" ]; then
        [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/vpnc
 fi
 
-# stupid SunOS: no blubber in /usr/local/bin ... (on stdout)
-IPROUTE="`which ip 2> /dev/null | grep '^/'`"
-
 if ifconfig --help 2>&1 | grep BusyBox > /dev/null; then
        ifconfig_syntax_inet=""
 else
@@ -98,11 +95,15 @@ else
 fi
 
 if [ "$OS" = "Linux" ]; then
+       IPROUTE="`which ip 2> /dev/null | grep '^/'`"
        ifconfig_syntax_ptp="pointopoint"
        route_syntax_gw="gw"
        route_syntax_del="del"
        route_syntax_netmask="netmask"
 else
+       # iproute2 is Linux only; if `which ip` returns something on another OS, it's likely an unrelated tool
+       # (see https://github.com/dlenski/openconnect/issues/132#issuecomment-470475009)
+       IPROUTE=""
        ifconfig_syntax_ptp=""
        route_syntax_gw=""
        route_syntax_del="delete"