aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-15 23:12:15 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 04:05:04 +0200
commita0d5736e11e1e70189393fc8803c2c1500c87d3e (patch)
tree2f06012441ff07d499f161d1b7c57aa44c85adec
parentwg-quick: darwin: ensure socket directory exists (diff)
downloadwireguard-monolithic-historical-a0d5736e11e1e70189393fc8803c2c1500c87d3e.tar.xz
wireguard-monolithic-historical-a0d5736e11e1e70189393fc8803c2c1500c87d3e.zip
wg-quick: darwin: remove v6 routes after shutdown
This works around a Darwin kernel bug regarding interface removal.
-rwxr-xr-xsrc/tools/wg-quick/darwin.bash6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/wg-quick/darwin.bash b/src/tools/wg-quick/darwin.bash
index 0c28085..ca7e901 100755
--- a/src/tools/wg-quick/darwin.bash
+++ b/src/tools/wg-quick/darwin.bash
@@ -106,7 +106,7 @@ add_if() {
}
del_routes() {
- local todelete=( ) destination netif
+ local todelete=( ) destination gateway netif
while read -r destination _ _ _ _ netif _; do
[[ $netif == "$REAL_INTERFACE" ]] && todelete+=( "$destination" )
done < <(netstat -nr -f inet)
@@ -114,8 +114,8 @@ del_routes() {
cmd route -q delete -inet "$destination" >/dev/null || true
done
todelete=( )
- while read -r destination _ _ netif; do
- [[ $netif == "$REAL_INTERFACE" ]] && todelete+=( "$destination" )
+ while read -r destination gateway _ netif; do
+ [[ $netif == "$REAL_INTERFACE" || ( $netif == lo* && $gateway == "$REAL_INTERFACE" ) ]] && todelete+=( "$destination" )
done < <(netstat -nr -f inet6)
for destination in "${todelete[@]}"; do
cmd route -q delete -inet6 "$destination" >/dev/null || true