mullvad / mullvadvpn-app

The Mullvad VPN client app for desktop and mobile
https://mullvad.net/
GNU General Public License v3.0
4.95k stars 336 forks source link

Unable to set private custom DNS servers. #5564

Open k4z4n0v4 opened 10 months ago

k4z4n0v4 commented 10 months ago

Issue report

Operating system: Linux 6.6.4-zen1-1-zen

App version: 2023.5

Issue description

Is there a specific reason why Mullvad doesn't allow setting both a private and a public DNS server in custom dns settings? Use case is for whenever you can reach the private dns it uses that, and the public is for fallback. The way it is currently is whenever i add 1 private and x public servers, the resolv.conf is only updated to contain the public servers, not the private one.

k4z4n0v4 commented 9 months ago

Actually, i got it wrong. It's not that mullvad refuses to set them together, its just that for some reason whenever i specify a private IP in the custom dns, it just doesn't get picked up by talpid_core, judging by the log:

[2023-12-09 03:21:45.362][mullvad_daemon::management_interface][DEBUG] set_dns_options(DnsOptions { state: Custom, default_options: DefaultDnsOptions { block_ads: false, block_trackers: false, block_malware: false, block_adult_content: false, block_gambling: false }, custom_options: CustomDnsOptions { addresses: [192.168.1.1] } })
[2023-12-09 03:21:45.362][mullvad_daemon::settings][DEBUG] Writing settings to /etc/mullvad-vpn/settings.json
[2023-12-09 03:21:45.364][mullvad_daemon::management_interface][DEBUG] Broadcasting new settings
[2023-12-09 03:21:45.364][talpid_core::firewall][INFO] Applying firewall policy: Connected to 185.195.233.76:28246/UDP over "wg-mullvad" (ip: 10.139.45.126, v4 gw: 10.64.0.1, v6 gw: None), Blocking LAN
[2023-12-09 03:21:45.382][talpid_core::dns][INFO] Setting DNS servers to 
[2023-12-09 03:21:45.445][talpid_core::dns::imp][DEBUG] Managing DNS via resolvconf

(notice the blank Setting DNS servers to on the second to last line, should have been Setting DNS servers to 192.168.1.1)

Is the feature not supported at all, can i not set a private dns / local dns in mullvad?

BowDown097 commented 3 months ago

Might be a misunderstanding of the code, but it does seem that local IPs for some reason are filtered from the pool of DNS servers when setting them. https://github.com/mullvad/mullvadvpn-app/blob/c86bcc3981805562116d13413914e8c86397e11a/talpid-core/src/tunnel_state_machine/connected_state.rs#L175-L182 Would be nice to know if this is the case, and if so, why. I don't see any documentation on it.

nicholasngai commented 3 months ago

Hi! I’m experiencing this issue as well and finding it strange that Mullvad won’t let me set a private IP as a custom DNS server. Would it be reasonable to remove this filter?

nicholasngai commented 3 months ago

@pinkisemils Looks like you were the original author of 9e1eebb864f8e32620b1982a5604656e1bdd5658 which added the check—would you be able to provide any context for why this was added?