]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
*BSDs: don't inadvertently pick up a bogus 0.0.0.0/32 route as a default route
authorDaniel Lenski <dlenski@gmail.com>
Mon, 14 Dec 2020 18:33:06 +0000 (10:33 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Thu, 17 Dec 2020 00:24:08 +0000 (16:24 -0800)
See https://gitlab.com/openconnect/vpnc-scripts/-/merge_requests/9#note_465753189 for example and discussion.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
vpnc-script

index 069a7a152c28f2e4089c7f048956800689113d95..33286816b75665b5da319c7fafdb906fc3c2cff3 100755 (executable)
@@ -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() {