wg-quick: darwin: account for "link#XX" gateways

On macOS, under specific configurations, the `netstat -nr -f inet` and
`netstat -nr -f inet6` outputs break gateway collection.

Signed-off-by: Laura Hausmann <laura@hausmann.dev>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Laura Hausmann 2021-08-12 21:29:15 +02:00 committed by Jason A. Donenfeld
parent 52597c3515
commit b3aafa6103
1 changed files with 2 additions and 2 deletions

View File

@ -194,14 +194,14 @@ collect_gateways() {
GATEWAY4=""
while read -r destination gateway _; do
[[ $destination == default ]] || continue
[[ $destination == default && $gateway != "link#"* ]] || continue
GATEWAY4="$gateway"
break
done < <(netstat -nr -f inet)
GATEWAY6=""
while read -r destination gateway _; do
[[ $destination == default ]] || continue
[[ $destination == default && $gateway != "link#"* ]] || continue
GATEWAY6="$gateway"
break
done < <(netstat -nr -f inet6)