Merge pull request #67 from worr/patch-1

Ignore expired routes in `netstat` on macOS
This commit is contained in:
Ivan Ilves 2019-03-26 21:18:31 +01:00 committed by GitHub
commit d3d61149f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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/^(.*) //'