Merge branch 'mac-dns'

* mac-dns:
  Set Mac DNS. ALWAYS
  Fix network service detection for MacOSX
This commit is contained in:
Ivan Ilves 2017-02-20 11:45:09 +01:00
commit 6943a690d2
3 changed files with 12 additions and 13 deletions

View File

@ -2,14 +2,7 @@
#
# Update MacOSX DNS
#
if [[ ${#} != 1 ]]; then
echo "Usage: ${0} LOCAL_TUNNEL_ID"
exit 1
fi
if [[ -f /tmp/xiringuito.dns.${1} ]]; then
NETWORK_SERVICE="$($(dirname ${0})/get-network-service-name.sh)"
DNS_SERVERS=$(grep nameserver /etc/resolv.conf | awk '{print $2}' | tr '\n' ' ')
echo "* Setting DNS for \"${NETWORK_SERVICE}\": ${DNS_SERVERS}"
sudo networksetup -setdnsservers "${NETWORK_SERVICE}" ${DNS_SERVERS}
fi
NETWORK_SERVICE="$($(dirname ${0})/get-network-service-name.sh)"
DNS_SERVERS=$(grep nameserver /etc/resolv.conf | awk '{print $2}' | tr '\n' ' ')
echo "* Setting DNS for \"${NETWORK_SERVICE}\": ${DNS_SERVERS}"
sudo networksetup -setdnsservers "${NETWORK_SERVICE}" ${DNS_SERVERS}

View File

@ -2,4 +2,10 @@
#
# Get name of the MacOSX network service (device connection)
#
networksetup -listnetworkserviceorder | grep '^(1) ' | sed 's/^(1) //'
if [[ -n "${FORCE_NETWORK_SERVICE}" ]]; then
echo "${FORCE_NETWORK_SERVICE}"
exit 0
fi
DEF_GW_IF=$(netstat -nr | grep default | tail -n1 | awk '{print $NF}')
networksetup -listnetworkserviceorder | grep -B1 " Device: ${DEF_GW_IF})" | head -n1 | sed 's/^(.*) //'

View File

@ -114,7 +114,7 @@ if [[ ! ${NO_DNS} && ! -z "${NETWORKS}" ]]; then
echo "${REMOTE_RESOLV_CONF}" | ./scripts/client-update-resolv-conf.sh
if [[ ${KERNEL} == darwin ]]; then
./scripts/${KERNEL}/client-update-macosx-dns.sh ${LOCAL_TUNNEL_ID}
./scripts/${KERNEL}/client-update-macosx-dns.sh
fi
fi
fi