From: Jason A. Donenfeld Date: Sun, 15 Jan 2017 12:01:06 +0000 (+0100) Subject: wg-quick: parse IPv6 endpoints correctly X-Git-Tag: v1.0.20191226~285 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d2091289893f6411a599184b5c36d023e6c8540;p=thirdparty%2Fwireguard-tools.git wg-quick: parse IPv6 endpoints correctly Signed-off-by: Jason A. Donenfeld --- diff --git a/src/wg-quick.bash b/src/wg-quick.bash index d611a83..b6fcef8 100755 --- a/src/wg-quick.bash +++ b/src/wg-quick.bash @@ -102,7 +102,7 @@ add_route() { } add_default() { - [[ $(join <(wg show "$INTERFACE" allowed-ips) <(wg show "$INTERFACE" endpoints)) =~ .*\ ${1//./\\.}\ ([0-9.:a-f]+):[0-9]+$ ]] && local endpoint="${BASH_REMATCH[1]}" + [[ $(join <(wg show "$INTERFACE" allowed-ips) <(wg show "$INTERFACE" endpoints)) =~ .*\ ${1//./\\.}\ \[?([0-9.:a-f]+)\]?:[0-9]+$ ]] && local endpoint="${BASH_REMATCH[1]}" [[ -n $endpoint ]] || return 0 local table=51820 while [[ -n $(ip route show table $table) ]]; do ((table++)); done