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:
parent
52597c3515
commit
b3aafa6103
|
@ -194,14 +194,14 @@ collect_gateways() {
|
||||||
|
|
||||||
GATEWAY4=""
|
GATEWAY4=""
|
||||||
while read -r destination gateway _; do
|
while read -r destination gateway _; do
|
||||||
[[ $destination == default ]] || continue
|
[[ $destination == default && $gateway != "link#"* ]] || continue
|
||||||
GATEWAY4="$gateway"
|
GATEWAY4="$gateway"
|
||||||
break
|
break
|
||||||
done < <(netstat -nr -f inet)
|
done < <(netstat -nr -f inet)
|
||||||
|
|
||||||
GATEWAY6=""
|
GATEWAY6=""
|
||||||
while read -r destination gateway _; do
|
while read -r destination gateway _; do
|
||||||
[[ $destination == default ]] || continue
|
[[ $destination == default && $gateway != "link#"* ]] || continue
|
||||||
GATEWAY6="$gateway"
|
GATEWAY6="$gateway"
|
||||||
break
|
break
|
||||||
done < <(netstat -nr -f inet6)
|
done < <(netstat -nr -f inet6)
|
||||||
|
|
Loading…
Reference in New Issue