wg-quick: parse IPv6 endpoints correctly
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
035a649641
commit
1d20912898
|
@ -102,7 +102,7 @@ add_route() {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_default() {
|
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
|
[[ -n $endpoint ]] || return 0
|
||||||
local table=51820
|
local table=51820
|
||||||
while [[ -n $(ip route show table $table) ]]; do ((table++)); done
|
while [[ -n $(ip route show table $table) ]]; do ((table++)); done
|
||||||
|
|
Loading…
Reference in a new issue