]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
GNU awk regex fix
authorDaniel Lenski <dlenski@gmail.com>
Fri, 5 Feb 2021 23:20:15 +0000 (15:20 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Fri, 5 Feb 2021 23:20:20 +0000 (15:20 -0800)
The character `#` does not need to be backslash-escaped in awk regexes, and
GNU awk v5.1.0 complains about these regexes (first added in 3885f8bb).

Fixes #17

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

index 7befb975d19d57f6f0d07b7a3fafa1a005722e31..683900955533ee4c49125c3b6e3d6d9a2a4418dd 100755 (executable)
@@ -402,12 +402,12 @@ else # use route command
                # - keep lines starting with 'default' or '0.0.0.0', but exclude bogus routes '0.0.0.0/nn' where nn != 0
                # - remove lines containing IPv6 addresses (':')
                # - remove lines for link-local routes (https://superuser.com/a/1067742)
-               netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }'
+               netstat -r -n | awk '/:/ { next; } /link#/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }'
        }
 
        get_default_gw_excl_tunnel() {
                # Get rid of lines containing $TUNDEV (we don't want loopback)
-               netstat -r -n | awk '/:/ { next; } /link\#/ { next; } /[[:space:]]'"$TUNDEV"'([[:space:]]|$)/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }'
+               netstat -r -n | awk '/:/ { next; } /link#/ { next; } /[[:space:]]'"$TUNDEV"'([[:space:]]|$)/ { next; } /^(default|0\.0\.0\.0([[:space:]]|\/0))/ { print $2; exit; }'
        }
 
        set_vpngateway_route() {