summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2023-10-09 16:05:29 +0200
committerDavid Lönnhager <david.l@mullvad.net>2023-10-10 11:33:13 +0200
commit864503f26701a0001f53204c9363265bd4c2df6d (patch)
treecb679799e82984bc5fcc61cb3b2d8a808e8209ec
parent108cfc2c8c0ed3aa9664841377bbafcb1a0fd14c (diff)
downloadmullvadvpn-864503f26701a0001f53204c9363265bd4c2df6d.tar.xz
mullvadvpn-864503f26701a0001f53204c9363265bd4c2df6d.zip
Print network services when offline
-rw-r--r--talpid-routing/src/unix/macos/interface.rs14
-rw-r--r--talpid-routing/src/unix/macos/mod.rs10
2 files changed, 24 insertions, 0 deletions
diff --git a/talpid-routing/src/unix/macos/interface.rs b/talpid-routing/src/unix/macos/interface.rs
index 1ed65aadea..a6e0bed540 100644
--- a/talpid-routing/src/unix/macos/interface.rs
+++ b/talpid-routing/src/unix/macos/interface.rs
@@ -56,6 +56,7 @@ impl Family {
}
}
+#[derive(Debug)]
struct NetworkServiceDetails {
name: String,
router_ip: IpAddr,
@@ -252,6 +253,19 @@ impl PrimaryInterfaceMonitor {
})
.collect::<Vec<_>>()
}
+
+ pub fn debug(&self) {
+ for family in [Family::V4, Family::V6] {
+ log::debug!(
+ "Primary interface ({family}): {:?}",
+ self.get_primary_interface(family)
+ );
+ log::debug!(
+ "Network services ({family}): {:?}",
+ self.network_services(family)
+ );
+ }
+ }
}
/// Return a map from interface name to link addresses (AF_LINK)
diff --git a/talpid-routing/src/unix/macos/mod.rs b/talpid-routing/src/unix/macos/mod.rs
index 351265146d..5b69402939 100644
--- a/talpid-routing/src/unix/macos/mod.rs
+++ b/talpid-routing/src/unix/macos/mod.rs
@@ -152,6 +152,8 @@ impl RouteManagerImpl {
false
});
+ self.debug_offline();
+
let mut completion_tx = None;
loop {
@@ -365,6 +367,8 @@ impl RouteManagerImpl {
self.update_best_default_route(interface::Family::V4)?;
self.update_best_default_route(interface::Family::V6)?;
+ self.debug_offline();
+
if !self.unhandled_default_route_changes {
return Ok(());
}
@@ -386,6 +390,12 @@ impl RouteManagerImpl {
Ok(())
}
+ fn debug_offline(&self) {
+ if self.v4_default_route.is_none() && self.v6_default_route.is_none() {
+ self.primary_interface_monitor.debug();
+ }
+ }
+
/// Figure out what the best default routes to use are, and send updates to default route change
/// subscribers. The "best routes" are used by the tunnel device to send packets to the VPN
/// relay.