diff --git a/Cargo.toml b/Cargo.toml index 80971df..f8fcf23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wintun-bindings" -version = "0.7.8" +version = "0.7.9" edition = "2021" authors = [ "ssrlive", diff --git a/src/adapter.rs b/src/adapter.rs index 63ee314..ac2e36e 100644 --- a/src/adapter.rs +++ b/src/adapter.rs @@ -237,9 +237,9 @@ impl Adapter { /// Sets the DNS servers for this adapter pub fn set_dns_servers(&self, dns_servers: &[IpAddr]) -> Result<(), Error> { let interface = GUID::from_u128(self.get_guid()); - if let Err(err) = util::set_interface_dns_servers(interface, dns_servers) { - log::error!("Failed to set DNS servers in first attempt: {}", err); - util::set_adapter_dns_servers(&self.get_name()?, dns_servers)?; + if let Err(e) = util::set_interface_dns_servers(interface, dns_servers) { + log::debug!("Failed to set DNS servers in first attempt: \"{}\", try another...", e); + util::set_interface_dns_servers_via_cmd(&self.get_name()?, dns_servers)?; } Ok(()) } diff --git a/src/util.rs b/src/util.rs index fafd253..6512bb7 100644 --- a/src/util.rs +++ b/src/util.rs @@ -157,7 +157,7 @@ pub(crate) fn set_interface_dns_servers(interface: GUID, dns: &[IpAddr]) -> crat } } -pub(crate) fn set_adapter_dns_servers(adapter: &str, dns: &[IpAddr]) -> crate::Result<()> { +pub(crate) fn set_interface_dns_servers_via_cmd(adapter: &str, dns: &[IpAddr]) -> crate::Result<()> { if dns.is_empty() { return Ok(()); }