Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnscrypt-proxy-switcher doesn't work if user has manually changed interface name #2060

Open
shwayder opened this issue Sep 21, 2024 · 0 comments

Comments

@shwayder
Copy link

In recent MacOS, the user is able to manually change the name of the network interface in the "Network" pane of the System Settings. If the user does this, then the dnscrypt-proxy-switcher script fails for that interface as the script is trying to use the hardware interface name, not the network interface name and then the 'networksetup -setdnsservers' call fails.

Fortunately, there is a simple fix. Line 63 of the script needs to be changed.
Old line 63: currentservice="$sname"
New line 63: currentservice=$(networksetup -listnetworkserviceorder | grep -B1 "Device: $sdev" | head -n1 | sed 's/^([0-9]*) //')

This new line takes the active network interface (e.g., 'en3') and then uses the networksetup tool to find the interface name associated with that network interface.

In addition line 58 (sname=$(echo "$line" | awk -F "(, )|(: )|[)]" '{print $2}')) can now be commented out as it is unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant