summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2022-06-29 14:24:38 +0200
committerLinus Färnstrand <faern@faern.net>2022-06-29 14:51:29 +0200
commitfa7e1ba56954ab39d16518422552ee5843d9814c (patch)
tree5cfee7fd7a46e747b72d96295e4a39f13ebb28dc
parent9fb4a01daa8c88e50f6ee7287eab346c22e12c1f (diff)
downloadmullvadvpn-fa7e1ba56954ab39d16518422552ee5843d9814c.tar.xz
mullvadvpn-fa7e1ba56954ab39d16518422552ee5843d9814c.zip
Don't rely on the stdout message from ipconfig, it's localized
-rw-r--r--CHANGELOG.md4
-rw-r--r--talpid-core/src/dns/windows/mod.rs24
2 files changed, 18 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d4d5c2d51..7e57041974 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -44,6 +44,10 @@ Line wrap the file at 100 chars. Th
- Fix quick settings tile not working when the device is locked. It will now prompt the user to
unlock the device before attempting to toggle the tunnel state.
+#### Windows
+- Fix DNS issue on non-English Windows installations. Don't parse the output of ipconfig.exe
+ to determine if the tool succeeded.
+
### Security
#### Android
- Prevent location request responses from being received outside the tunnel when in the connected
diff --git a/talpid-core/src/dns/windows/mod.rs b/talpid-core/src/dns/windows/mod.rs
index 8cc8683d21..78c167e769 100644
--- a/talpid-core/src/dns/windows/mod.rs
+++ b/talpid-core/src/dns/windows/mod.rs
@@ -1,5 +1,9 @@
use crate::windows::{get_system_dir, guid_from_luid, luid_from_alias, string_from_guid};
-use std::{io, net::IpAddr, process::Command};
+use std::{
+ io,
+ net::IpAddr,
+ process::{Command, Stdio},
+};
use talpid_types::ErrorExt;
use winapi::shared::guiddef::GUID;
use winreg::{
@@ -149,14 +153,14 @@ fn config_interface<'a>(
fn flush_dns_cache() -> Result<(), Error> {
let sysdir = get_system_dir().map_err(Error::SystemDirError)?;
- let mut ipconfig = Command::new(sysdir.join("ipconfig.exe"));
- ipconfig.arg("/flushdns");
- let output = ipconfig.output().map_err(Error::ExecuteIpconfigError)?;
- let output = String::from_utf8_lossy(&output.stdout);
- // The exit code cannot be trusted
- if !output.contains("Successfully flushed") {
- log::error!("Failed to flush DNS cache: {}", output);
- return Err(Error::FlushResolverCacheError);
- }
+ Command::new(sysdir.join("ipconfig.exe"))
+ .arg("/flushdns")
+ .stdout(Stdio::null())
+ .stderr(Stdio::null())
+ .status()
+ .map_err(Error::ExecuteIpconfigError)?;
+ // The exit code cannot be trusted. And the stdout messages from Windows CLI tools
+ // are localized, so it can also not be checked. There is no way to verify if
+ // this flush succeeded or failed.
Ok(())
}