summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-07-05 13:50:57 +0200
committerDavid Lönnhager <david.l@mullvad.net>2021-07-05 13:50:57 +0200
commit039f3a10b46bc634afc86490e7af7040175b9997 (patch)
tree7b9bccd8a03dc919fc974cc834cfbb7950bc124c
parente3c8238243a7202856637014bbf3d6007545ba72 (diff)
parente0e6c46686fd674a3ebe7cdcb40ee23a36a486dc (diff)
downloadmullvadvpn-039f3a10b46bc634afc86490e7af7040175b9997.tar.xz
mullvadvpn-039f3a10b46bc634afc86490e7af7040175b9997.zip
Merge branch 'windows-st-fix-removable-drive-issue'
-rw-r--r--CHANGELOG.md1
-rw-r--r--talpid-core/src/split_tunnel/windows/driver.rs14
-rw-r--r--talpid-core/src/split_tunnel/windows/windows.rs9
3 files changed, 15 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8d1ad2b40..c6cccd59c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -48,6 +48,7 @@ Line wrap the file at 100 chars. Th
monitor may have falsely reported the machine to be online due to a race condition.
- Recover firewall state correctly when restarting the service after a crash. This would fail when
paths were excluded.
+- Fix daemon not starting when a path is excluded on a drive that has since been removed.
## [2021.4] - 2021-06-30
diff --git a/talpid-core/src/split_tunnel/windows/driver.rs b/talpid-core/src/split_tunnel/windows/driver.rs
index feb60dbc88..7f097f9e54 100644
--- a/talpid-core/src/split_tunnel/windows/driver.rs
+++ b/talpid-core/src/split_tunnel/windows/driver.rs
@@ -19,6 +19,7 @@ use std::{
ptr,
time::Duration,
};
+use talpid_types::ErrorExt;
use winapi::{
shared::{
in6addr::IN6_ADDR,
@@ -265,7 +266,18 @@ impl DeviceHandle {
pub fn set_config<T: AsRef<OsStr>>(&self, apps: &[T]) -> io::Result<()> {
let mut device_paths = Vec::with_capacity(apps.len());
for app in apps.as_ref() {
- device_paths.push(get_device_path(app.as_ref())?);
+ match get_device_path(app.as_ref()) {
+ Err(error) if error.kind() == io::ErrorKind::NotFound => {
+ log::warn!(
+ "{}\nPath: {}",
+ error
+ .display_chain_with_msg("Skipping path with non-existent drive letter"),
+ app.as_ref().to_string_lossy()
+ );
+ }
+ Err(error) => return Err(error),
+ Ok(path) => device_paths.push(path),
+ }
}
log::debug!("Excluded device paths:");
diff --git a/talpid-core/src/split_tunnel/windows/windows.rs b/talpid-core/src/split_tunnel/windows/windows.rs
index b706a73203..3163244c5f 100644
--- a/talpid-core/src/split_tunnel/windows/windows.rs
+++ b/talpid-core/src/split_tunnel/windows/windows.rs
@@ -107,20 +107,13 @@ impl Iterator for ProcessSnapshotEntries<'_> {
/// Obtains a device path without resolving links or mount points.
pub fn get_device_path<T: AsRef<Path>>(path: T) -> Result<OsString, io::Error> {
- if !path.as_ref().is_absolute() {
- return Err(io::Error::new(
- io::ErrorKind::InvalidInput,
- "path must be absolute",
- ));
- }
-
let drive_comp = path.as_ref().components().next();
let drive = match drive_comp {
Some(std::path::Component::Prefix(prefix)) => prefix.as_os_str(),
_ => {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
- "invalid drive label",
+ "path must be absolute",
))
}
};