From: Daniel Lenski Date: Mon, 14 Dec 2020 18:33:06 +0000 (-0800) Subject: *BSDs: don't inadvertently pick up a bogus 0.0.0.0/32 route as a default route X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ccabe82cf8eeb5de00e02a85ce05c960973e7b6b;p=users%2Fdwmw2%2Fvpnc-scripts.git *BSDs: don't inadvertently pick up a bogus 0.0.0.0/32 route as a default route See https://gitlab.com/openconnect/vpnc-scripts/-/merge_requests/9#note_465753189 for example and discussion. Signed-off-by: Daniel Lenski --- diff --git a/vpnc-script b/vpnc-script index 069a7a1..3328681 100755 --- a/vpnc-script +++ b/vpnc-script @@ -400,7 +400,7 @@ else # use route command # Get rid of lines containing IPv6 addresses (':') # Get rid of lines for link-local routes (https://superuser.com/a/1067742) # Get rid of lines containing $TUNDEV (we don't want loopback) - netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /\s'"$TUNDEV"'(\s|$)/ { next; } /^(default|0\.0\.0\.0)/ { print $2; exit; }' + netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /\s'"$TUNDEV"'(\s|$)/ { next; } /^(default|0\.0\.0\.0(\s|\/0))/ { print $2; exit; }' } set_vpngateway_route() {