wg-quick: wait for interface to disappear on freebsd

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-10-12 16:55:35 +02:00
parent 599b84fbd1
commit 4410c87c39
1 changed files with 9 additions and 0 deletions

View File

@ -137,8 +137,17 @@ del_routes() {
}
del_if() {
local line monitor_pid
[[ $HAVE_SET_DNS -eq 0 ]] || unset_dns
exec 39< <(exec route -n monitor 2>/dev/null)
monitor_pid=$!
cmd rm -f "/var/run/wireguard/$INTERFACE.sock"
while ifconfig "$INTERFACE" >/dev/null 2>&1; do
while read -r line; do
[[ $line =~ ^RTM_IFANNOUNCE:.* ]] && break
done <&39
done
kill $monitor_pid
}
up_if() {