diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-08-21 19:16:45 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-08-22 20:24:38 +0200 |
| commit | 6d1a486fadde25716de7f0c0527925b86bb67ab6 (patch) | |
| tree | 9f570bddb6eeb9cb0e89cee8222ac5488497050b | |
| parent | dfe166d16fd87198546bb631fca38e08d473fb7c (diff) | |
| download | mullvadvpn-6d1a486fadde25716de7f0c0527925b86bb67ab6.tar.xz mullvadvpn-6d1a486fadde25716de7f0c0527925b86bb67ab6.zip | |
Use previous IP override indicator on settings change
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index 926946dc7b..c52972c4e1 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -53,7 +53,7 @@ use mullvad_types::{ auth_failed::AuthFailed, custom_list::CustomList, device::{Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceState, RemoveDeviceEvent}, - features::{compute_feature_indicators, FeatureIndicators}, + features::{compute_feature_indicators, FeatureIndicator, FeatureIndicators}, location::{GeoIpLocation, LocationEventData}, relay_constraints::{ BridgeSettings, BridgeState, BridgeType, ObfuscationSettings, RelayOverride, RelaySettings, @@ -958,7 +958,7 @@ impl Daemon { DeviceMigrationEvent(event) => self.handle_device_migration_event(event), LocationEvent(location_data) => self.handle_location_event(location_data), SettingsChanged => { - self.update_feature_indicators_on_settings_changed().await; + self.update_feature_indicators_on_settings_changed(); } #[cfg(any(windows, target_os = "android", target_os = "macos"))] ExcludedPathsEvent(update, tx) => self.handle_new_excluded_paths(update, tx).await, @@ -1135,7 +1135,7 @@ impl Daemon { } /// Update the set of feature indicators based on the new settings. - async fn update_feature_indicators_on_settings_changed(&mut self) { + fn update_feature_indicators_on_settings_changed(&mut self) { // Updated settings may affect the feature indicators, even if they don't change the tunnel // state (e.g. activating lockdown mode). Note that only the connected and connecting states // have feature indicators. @@ -1150,7 +1150,13 @@ impl Daemon { endpoint, .. } => { - let ip_override = self.parameters_generator.last_relay_was_overridden().await; + // The server IP override feature indicator can only be changed when the tunnels + // state changes and it is updated in `handle_tunnel_state_transition`. We must rely + // on this value being up to date as we need the relay to know if + // the IP override is active. + let ip_override = feature_indicators + .active_features() + .any(|f| matches!(&f, FeatureIndicator::ServerIpOverride)); let new_feature_indicators = compute_feature_indicators(&self.settings.to_settings(), endpoint, ip_override); // Update and broadcast the new feature indicators if they have changed |
