mirror of
https://github.com/ivanilves/xiringuito.git
synced 2025-05-15 14:50:19 -07:00
Ignore expired routes in netstat
on macOS
When routes expire in macOS, `netstat -r` shows a trailing exclamation point to indicate this. In the current version of this code, this will set `DEF_GW_IF` to contain a `!`, causing subsequent DNS modifications on OSX to fail. This change ignores the the `!` that can be set in this case.
This commit is contained in:
parent
beaee21a0b
commit
4211570649
@ -7,5 +7,5 @@ if [[ -n "${FORCE_NETWORK_SERVICE}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DEF_GW_IF=$(netstat -nr | grep default | awk '{print $NF}' | grep -v tun | tail -n1)
|
||||
DEF_GW_IF=$(netstat -nr | grep default | awk '!/tun|!/ {print $NF}' | tail -n1)
|
||||
networksetup -listnetworkserviceorder | grep -B1 " Device: ${DEF_GW_IF})" | head -n1 | sed 's/^(.*) //'
|
||||
|
Loading…
x
Reference in New Issue
Block a user