Skip to content

Commit

Permalink
wg-quick: darwin: account for "link#XX" gateways
Browse files Browse the repository at this point in the history
On macOS, under specific configurations, the `netstat -nr -f inet` and
`netstat -nr -f inet6` outputs break gateway collection.

Signed-off-by: Laura Hausmann <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
  • Loading branch information
zotanmew authored and zx2c4 committed Aug 12, 2021
1 parent 52597c3 commit b3aafa6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wg-quick/darwin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b3aafa6

Please sign in to comment.