]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: darwin: account for "link#XX" gateways
authorLaura Hausmann <laura@hausmann.dev>
Thu, 12 Aug 2021 19:29:15 +0000 (21:29 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 12 Aug 2021 20:03:04 +0000 (22:03 +0200)
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>
src/wg-quick/darwin.bash

index c77441fa3812f7da67ba066e0344230562556874..8e468189a2fe5342af62f5f1c5a80eb08816bc54 100755 (executable)
@@ -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)