summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-02-01 11:57:52 +0100
committerDavid Lönnhager <david.l@mullvad.net>2022-02-08 17:43:12 +0100
commite2f7cf1ba90fa59ea04d26dae28ae576db92bb07 (patch)
treec20956d1bb25f8703186171d97059fd23d6e1cec /mullvad-daemon/src
parent022874449ba862aba6788bb430099923ba8a1a6c (diff)
downloadmullvadvpn-e2f7cf1ba90fa59ea04d26dae28ae576db92bb07.tar.xz
mullvadvpn-e2f7cf1ba90fa59ea04d26dae28ae576db92bb07.zip
Reapply excluded paths when the frontend receives messages for device
arrivals or removals
Diffstat (limited to 'mullvad-daemon/src')
-rw-r--r--mullvad-daemon/src/lib.rs20
-rw-r--r--mullvad-daemon/src/management_interface.rs16
2 files changed, 36 insertions, 0 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index b54eae5908..2ef7bccc39 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -293,6 +293,9 @@ pub enum DaemonCommand {
/// Toggle wireguard-nt on or off
#[cfg(target_os = "windows")]
UseWireGuardNt(ResponseTx<(), Error>, bool),
+ /// Notify the split tunnel monitor that a volume was mounted or dismounted
+ #[cfg(target_os = "windows")]
+ CheckVolumes(ResponseTx<(), Error>),
/// Makes the daemon exit the main loop and quit.
Shutdown,
/// Saves the target tunnel state and enters a blocking state. The state is restored
@@ -546,6 +549,8 @@ pub struct Daemon<L: EventListener> {
shutdown_tasks: Vec<Pin<Box<dyn Future<Output = ()>>>>,
/// oneshot channel that completes once the tunnel state machine has been shut down
tunnel_state_machine_shutdown_signal: oneshot::Receiver<()>,
+ #[cfg(target_os = "windows")]
+ volume_update_tx: mpsc::UnboundedSender<()>,
}
impl<L> Daemon<L>
@@ -627,6 +632,8 @@ where
Self::get_allowed_endpoint(rpc_runtime.address_cache.peek_address());
let (offline_state_tx, offline_state_rx) = mpsc::unbounded();
+ #[cfg(target_os = "windows")]
+ let (volume_update_tx, volume_update_rx) = mpsc::unbounded();
let tunnel_command_tx = tunnel_state_machine::spawn(
tunnel_state_machine::InitialTunnelState {
allow_lan: settings.allow_lan,
@@ -643,6 +650,8 @@ where
internal_event_tx.to_specialized_sender(),
offline_state_tx,
tunnel_state_machine_shutdown_tx,
+ #[cfg(target_os = "windows")]
+ volume_update_rx,
#[cfg(target_os = "macos")]
exclusion_gid,
#[cfg(target_os = "android")]
@@ -742,6 +751,8 @@ where
app_version_info,
shutdown_tasks: vec![],
tunnel_state_machine_shutdown_signal,
+ #[cfg(target_os = "windows")]
+ volume_update_tx,
};
daemon.ensure_wireguard_keys_for_current_account().await;
@@ -1241,6 +1252,8 @@ where
SetSplitTunnelState(tx, enabled) => self.on_set_split_tunnel_state(tx, enabled).await,
#[cfg(target_os = "windows")]
UseWireGuardNt(tx, state) => self.on_use_wireguard_nt(tx, state).await,
+ #[cfg(target_os = "windows")]
+ CheckVolumes(tx) => self.on_check_volumes(tx).await,
Shutdown => self.trigger_shutdown_event(),
PrepareRestart => self.on_prepare_restart(),
#[cfg(target_os = "android")]
@@ -1980,6 +1993,13 @@ where
}
}
+ #[cfg(windows)]
+ async fn on_check_volumes(&mut self, tx: ResponseTx<(), Error>) {
+ if self.volume_update_tx.unbounded_send(()).is_ok() {
+ let _ = tx.send(Ok(()));
+ }
+ }
+
async fn on_update_relay_settings(
&mut self,
tx: ResponseTx<(), settings::Error>,
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index 2136312541..ba828ed903 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -708,6 +708,22 @@ impl ManagementService for ManagementServiceImpl {
async fn set_use_wireguard_nt(&self, _: Request<bool>) -> ServiceResult<()> {
Ok(Response::new(()))
}
+
+ #[cfg(windows)]
+ async fn check_volumes(&self, _: Request<()>) -> ServiceResult<()> {
+ log::debug!("check_volumes");
+ let (tx, rx) = oneshot::channel();
+ self.send_command_to_daemon(DaemonCommand::CheckVolumes(tx))?;
+ self.wait_for_result(rx)
+ .await?
+ .map_err(map_daemon_error)
+ .map(Response::new)
+ }
+
+ #[cfg(not(windows))]
+ async fn check_volumes(&self, _: Request<()>) -> ServiceResult<()> {
+ Ok(Response::new(()))
+ }
}
impl ManagementServiceImpl {