wg-quick: properly match IPv6 endpoint
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e7fd4cfd3f
commit
cf4b3ebd08
|
@ -117,7 +117,7 @@ set_mtu() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
while read -r _ endpoint; do
|
while read -r _ endpoint; do
|
||||||
[[ $endpoint =~ ^([a-z0-9:.]+):[0-9]+$ ]] || continue
|
[[ $endpoint =~ ^\[?([a-z0-9:.]+)\]?:[0-9]+$ ]] || continue
|
||||||
output="$(ip route get "${BASH_REMATCH[1]}" || true)"
|
output="$(ip route get "${BASH_REMATCH[1]}" || true)"
|
||||||
[[ ( $output =~ mtu\ ([0-9]+) || ( $output =~ dev\ ([^ ]+) && $(ip link show dev "${BASH_REMATCH[1]}") =~ mtu\ ([0-9]+) ) ) && ${BASH_REMATCH[1]} -gt $mtu ]] && mtu="${BASH_REMATCH[1]}"
|
[[ ( $output =~ mtu\ ([0-9]+) || ( $output =~ dev\ ([^ ]+) && $(ip link show dev "${BASH_REMATCH[1]}") =~ mtu\ ([0-9]+) ) ) && ${BASH_REMATCH[1]} -gt $mtu ]] && mtu="${BASH_REMATCH[1]}"
|
||||||
done < <(wg show "$INTERFACE" endpoints)
|
done < <(wg show "$INTERFACE" endpoints)
|
||||||
|
|
Loading…
Reference in a new issue