diff options
author | Jake McGinty <me@jake.su> | 2018-04-03 16:05:25 -0700 |
---|---|---|
committer | Jake McGinty <me@jake.su> | 2018-04-03 16:05:25 -0700 |
commit | 131e43efa5f87084a5ed9d945d3464061514d587 (patch) | |
tree | c593511281fcc930cbbe28d283b9152a215b1214 /tools | |
parent | binary: add interface name to log file (diff) | |
download | wireguard-rs-131e43efa5f87084a5ed9d945d3464061514d587.tar.xz wireguard-rs-131e43efa5f87084a5ed9d945d3464061514d587.zip |
tools: fix typo in wg-quick.bash and speed up 'route' call
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/wg-quick.bash | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/wg-quick.bash b/tools/wg-quick.bash index 316d913..4b24f0b 100755 --- a/tools/wg-quick.bash +++ b/tools/wg-quick.bash @@ -147,8 +147,7 @@ add_route() { } add_endpoint_passthroughs() { - ip=$(ifconfig $INTERFACE | grep "inet6 " | tail -1 | cut -d ' ' -f 2) # this doesn't play well with multiple assigned IPs - gateway=$(route get default | grep gateway | awk '{print $2}') + gateway=$(route -n get default | grep gateway | awk '{print $2}') for i in $(while read -r _ i; do for i in $i; do [[ $i =~ ^[0-9a-z:.]+:[0-9]+$ ]] && echo "$i"; done; done < <(wg show "$INTERFACE" endpoints) | sort -nr -k 2 -t /); do endpoint=$(echo "$i" | cut -d ':' -f 1) netstat -rn | grep "$endpoint" > /dev/null || \ @@ -164,6 +163,7 @@ add_default_ipv4() { } add_default_ipv6() { + ip=$(ifconfig $INTERFACE | grep "inet6 " | tail -1 | cut -d ' ' -f 2) # this doesn't play well with multiple assigned IPs cmd route add -inet6 0000::/1 $ip cmd route add -inet6 8000::/1 $ip return 0 |