From ccabe82cf8eeb5de00e02a85ce05c960973e7b6b Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Mon, 14 Dec 2020 10:33:06 -0800 Subject: [PATCH] *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 --- vpnc-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() { -- 2.50.1