Setting DNS server on Mac Sonoma fails
First off thank you for this awesome alternative to the horrible GlobalProtect app!
I have tracked down an issue int the vpn script to here This variable is empty and thus the script fails and dns is not set up as expected on Mac Sonoma
Ive enabled debugging on the script:
route -n get default
++ grep interface
++ awk '{print $2}'
+ ACTIVE_INTERFACE=utun4
It then fails
++ networksetup -listnetworkserviceorder
++ grep -B 1 utun4
++ head -n 1
++ awk '/\([0-9]+\)/{ print }'
++ cut -d ' ' -f2-
+ ACTIVE_NETWORK_SERVICE=
+ networksetup -setdnsservers '' <redacted>
is not a recognized network service.
** Error: The parameters were not valid.
ACTIVE_NETWORK_SERVICE=networksetup -listnetworkserviceorder | grep -B 1 "$ACTIVE_INTERFACE" | head -n 1 | awk '/(\[0-9\]+)/{ print }'|cut -d " " -f2-
Im not sure what the intent of the above snippet is, but from my machine I can see that thetun\
device is not an option.
bash-5.2$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) USB 10/100/1000 LAN
(Hardware Port: USB 10/100/1000 LAN, Device: en6)
(2) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge, Device: bridge0)
(3) Wi-Fi
(Hardware Port: Wi-Fi, Device: en0)
Hardcoding the value for ACTIVE_NETWORK_SERVICE as Wi-Fi fixes the issue.
Should we maybe set the dns for all network services?
Edited by David Connack