From f2725df922fce5960af7a8028201ca736bdb7b85 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 3 Feb 2025 05:48:58 +0000 Subject: [PATCH] fix(gui-client): don't fail DNS control on nameservers (#7972) As part of fixing #6777, we added a code path to explicitly set nameservers on the tunnel interface. This was necessary to make DNS resources work under WSL. Exactly this code also seems to be causing issues where this particular registry key is not available on a users machine. DNS resources outside of WSL will also work without this, therefore we make this part optional to at least have something working on the users machine. Related: #7962. --- rust/headless-client/src/dns_control/windows.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust/headless-client/src/dns_control/windows.rs b/rust/headless-client/src/dns_control/windows.rs index aaca683ba..f7066c569 100644 --- a/rust/headless-client/src/dns_control/windows.rs +++ b/rust/headless-client/src/dns_control/windows.rs @@ -16,7 +16,7 @@ use super::DnsController; use anyhow::{Context as _, Result}; use firezone_bin_shared::platform::{DnsControlMethod, CREATE_NO_WINDOW, TUNNEL_UUID}; -use firezone_logging::std_dyn_err; +use firezone_logging::{anyhow_dyn_err, std_dyn_err}; use std::{io, net::IpAddr, os::windows::process::CommandExt, path::Path, process::Command}; use windows::Win32::System::GroupPolicy::{RefreshPolicyEx, RP_FORCE}; @@ -125,7 +125,9 @@ fn activate(dns_config: &[IpAddr]) -> Result<()> { let hklm = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE); - set_nameservers_on_interface(dns_config).context("Failed to set nameservers")?; + if let Err(e) = set_nameservers_on_interface(dns_config) { + tracing::warn!(error = anyhow_dyn_err(&e), "Failed to explicitly set nameservers on tunnel interface; DNS resources in WSL may not work"); + } // e.g. [100.100.111.1, 100.100.111.2] -> "100.100.111.1;100.100.111.2" let dns_config_string = itertools::join(dns_config, ";");