summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-09-28 09:41:40 +0200
committerDavid Lönnhager <david.l@mullvad.net>2021-09-28 09:41:40 +0200
commitcb44dc7c39aaf093ca4b43279c714f6bb397edb0 (patch)
tree58bace8604d7b8033b8cd4931374596f5f8df4e6
parent50cd9fef0ed9881665eaaf1d66ca31cf7fd1ea6f (diff)
parent4d560d4ea4c61a714a22ed7f1e7f6f11ac7ecd0f (diff)
downloadmullvadvpn-cb44dc7c39aaf093ca4b43279c714f6bb397edb0.tar.xz
mullvadvpn-cb44dc7c39aaf093ca4b43279c714f6bb397edb0.zip
Merge branch 'fix-ipv6-offline-monitor'
-rw-r--r--CHANGELOG.md1
-rw-r--r--talpid-core/src/offline/linux.rs17
2 files changed, 12 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 448ef8ca46..58dcef1163 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -78,6 +78,7 @@ Line wrap the file at 100 chars. Th
- Assign local DNS servers to more appropriate interfaces when using systemd-resolved.
- Disable DNS over TLS for tunnel's DNS config when using systemd-resolved.
- Fix DNS when combining a static resolv.conf with ad blocking DNS.
+- Check connectivity correctly on IPv6-only networks.
#### Windows
- Fix failure to restart the daemon when resuming from "fast startup" hibernation.
diff --git a/talpid-core/src/offline/linux.rs b/talpid-core/src/offline/linux.rs
index f9e137853b..37468a07b8 100644
--- a/talpid-core/src/offline/linux.rs
+++ b/talpid-core/src/offline/linux.rs
@@ -1,7 +1,7 @@
use crate::routing::{self, RouteManagerHandle};
use futures::{channel::mpsc::UnboundedSender, StreamExt};
use std::{
- net::{IpAddr, Ipv4Addr},
+ net::{IpAddr, Ipv4Addr, Ipv6Addr},
sync::Arc,
};
use talpid_types::ErrorExt;
@@ -20,9 +20,9 @@ pub struct MonitorHandle {
_notify_tx: Arc<UnboundedSender<bool>>,
}
-// Mullvad API's public IP address, correct at the time of writing, but any public IP address will
-// work.
-const PUBLIC_INTERNET_ADDRESS: IpAddr = IpAddr::V4(Ipv4Addr::new(193, 138, 218, 78));
+const PUBLIC_INTERNET_ADDRESS_V4: IpAddr = IpAddr::V4(Ipv4Addr::new(193, 138, 218, 78));
+const PUBLIC_INTERNET_ADDRESS_V6: IpAddr =
+ IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6));
impl MonitorHandle {
pub async fn is_offline(&mut self) -> bool {
@@ -86,8 +86,13 @@ pub async fn spawn_monitor(
async fn public_ip_unreachable(handle: &RouteManagerHandle) -> Result<bool> {
Ok(handle
- .get_destination_route(PUBLIC_INTERNET_ADDRESS, true)
+ .get_destination_route(PUBLIC_INTERNET_ADDRESS_V4, true)
.await
.map_err(Error::RouteManagerError)?
- .is_none())
+ .is_none()
+ && handle
+ .get_destination_route(PUBLIC_INTERNET_ADDRESS_V6, true)
+ .await
+ .unwrap_or(None)
+ .is_none())
}