From b3aafa6103be853678b4c74664e2fcdfba597b55 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 12 Aug 2021 21:29:15 +0200 Subject: 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 Signed-off-by: Jason A. Donenfeld --- src/wg-quick/darwin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash index c77441f..8e46818 100755 --- a/src/wg-quick/darwin.bash +++ b/src/wg-quick/darwin.bash @@ -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) -- cgit v1.2.3-59-g8ed1b