From 9cde177bbe2bc3a51e9b395b5f4beac75def3106 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 23 Jun 2017 14:48:03 +0200 Subject: wg-quick: properly match IPv6 endpoint --- src/tools/wg-quick.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/wg-quick.bash b/src/tools/wg-quick.bash index 012e41f..6edcd3a 100755 --- a/src/tools/wg-quick.bash +++ b/src/tools/wg-quick.bash @@ -117,7 +117,7 @@ set_mtu() { return fi 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 =~ 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) -- cgit v1.2.3-59-g8ed1b