diff options
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | talpid-core/src/tunnel_state_machine/error_state.rs | 7 | ||||
| -rw-r--r-- | talpid-types/src/net/mod.rs | 8 |
3 files changed, 15 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ef2a197b7f..16a59fb8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ supported. - Use a local DNS resolver on the 127.0.0.0/8 network, regardless of macOS version. ### Fixed +- Automatically connect when IP version becomes available. + #### Linux - Fix syntax error in Apparmor profile. diff --git a/talpid-core/src/tunnel_state_machine/error_state.rs b/talpid-core/src/tunnel_state_machine/error_state.rs index ca280b9584..8ee25c764a 100644 --- a/talpid-core/src/tunnel_state_machine/error_state.rs +++ b/talpid-core/src/tunnel_state_machine/error_state.rs @@ -10,7 +10,7 @@ use crate::firewall::FirewallPolicy; use crate::resolver::LOCAL_DNS_RESOLVER; use futures::StreamExt; use talpid_types::{ - tunnel::{ErrorStateCause, FirewallPolicyError}, + tunnel::{ErrorStateCause, FirewallPolicyError, ParameterGenerationError}, ErrorExt, }; @@ -185,7 +185,10 @@ impl TunnelState for ErrorState { Some(TunnelCommand::Connectivity(connectivity)) => { shared_values.connectivity = connectivity; if !connectivity.is_offline() - && matches!(self.block_reason, ErrorStateCause::IsOffline) + // Reconnect if we're no longer offline + && (matches!(self.block_reason, ErrorStateCause::IsOffline) + // Try to reconnect if missing IP connectivity becomes available + || matches!(self.block_reason, ErrorStateCause::TunnelParameterError(ParameterGenerationError::IpVersionUnavailable { family }) if connectivity.has_family(family))) { #[cfg(target_os = "macos")] if !*LOCAL_DNS_RESOLVER { diff --git a/talpid-types/src/net/mod.rs b/talpid-types/src/net/mod.rs index 68d8b0a0b8..b92bdc9ffc 100644 --- a/talpid-types/src/net/mod.rs +++ b/talpid-types/src/net/mod.rs @@ -613,6 +613,14 @@ impl Connectivity { .unwrap_or(false) } + /// Whether connectivity for `ip_version` seems to be available on the host. + pub fn has_family(&self, ip_version: IpVersion) -> bool { + match ip_version { + IpVersion::V4 => self.has_ipv4(), + IpVersion::V6 => self.has_ipv6(), + } + } + pub fn new(ipv4: bool, ipv6: bool) -> Connectivity { match (ipv4, ipv6) { (true, true) => Connectivity::Online(IpAvailability::Ipv4AndIpv6), |
