diff options
| author | David Göransson <david.goransson@mullvad.net> | 2025-02-25 14:46:54 +0100 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2025-02-25 14:46:54 +0100 |
| commit | 0f4632d73fe2363489673a7314bd2f21959f8fe0 (patch) | |
| tree | 9a816c536e1c47a1bb9b02ac1b3bc42c1b6ff9e3 | |
| parent | 60ccaee30c558ec05dbe36224cdb66464fab4272 (diff) | |
| parent | 0b40caa9c9223ad7ce30a225da09215c2e340acc (diff) | |
| download | mullvadvpn-0f4632d73fe2363489673a7314bd2f21959f8fe0.tar.xz mullvadvpn-0f4632d73fe2363489673a7314bd2f21959f8fe0.zip | |
Merge branch 'clean-up-android-tun'
| -rw-r--r-- | talpid-tunnel/src/tun_provider/android/mod.rs | 7 | ||||
| -rw-r--r-- | talpid-wireguard/src/wireguard_go/mod.rs | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/talpid-tunnel/src/tun_provider/android/mod.rs b/talpid-tunnel/src/tun_provider/android/mod.rs index 7b4b1ae3c3..1024404ad1 100644 --- a/talpid-tunnel/src/tun_provider/android/mod.rs +++ b/talpid-tunnel/src/tun_provider/android/mod.rs @@ -113,7 +113,7 @@ impl AndroidTunProvider { if vpn_service_config == &config { return Ok(VpnServiceTun { tunnel: *raw_fd, - is_new_tunnel: false, + is_new: false, jvm, class: self.class.clone(), object: self.object.clone(), @@ -140,7 +140,7 @@ impl AndroidTunProvider { Ok(VpnServiceTun { tunnel: raw_fd, - is_new_tunnel: true, + is_new: true, jvm, class: self.class.clone(), object: self.object.clone(), @@ -381,7 +381,8 @@ impl From<&InetNetwork> for IpNetwork { /// Handle to a tunnel device on Android. pub struct VpnServiceTun { tunnel: RawFd, - pub is_new_tunnel: bool, + // True if a new file descriptor was created, false if cache was returned. + pub is_new: bool, jvm: JavaVM, class: GlobalRef, object: GlobalRef, diff --git a/talpid-wireguard/src/wireguard_go/mod.rs b/talpid-wireguard/src/wireguard_go/mod.rs index 6e082870f4..f9c3f86403 100644 --- a/talpid-wireguard/src/wireguard_go/mod.rs +++ b/talpid-wireguard/src/wireguard_go/mod.rs @@ -366,7 +366,6 @@ impl WgGoTunnel { tun_config.ipv6_gateway = config.ipv6_gateway; tun_config.mtu = config.mtu; - // Route everything into the tunnel and have wireguard-go act as a firewall. #[cfg(not(target_os = "android"))] { tun_config.routes = routes.collect(); @@ -374,6 +373,9 @@ impl WgGoTunnel { #[cfg(target_os = "android")] { + // Route everything into the tunnel and have wireguard-go act as a firewall when + // blocking. These will not necessarily be the actual routes used by android. Those will + // be generated at a later stage e.g. if Local Network Sharing is enabled. tun_config.routes = vec!["0.0.0.0/0".parse().unwrap(), "::/0".parse().unwrap()]; } @@ -412,7 +414,7 @@ impl WgGoTunnel { .map_err(|e| TunnelError::FatalStartWireguardError(Box::new(e)))?; let (mut tunnel_device, tunnel_fd) = Self::get_tunnel(Arc::clone(&tun_provider), config)?; - let is_new_tunnel = tunnel_device.is_new_tunnel; + let is_new_tunnel = tunnel_device.is_new; let interface_name: String = tunnel_device .interface_name() @@ -474,7 +476,7 @@ impl WgGoTunnel { .map_err(|e| TunnelError::FatalStartWireguardError(Box::new(e)))?; let (mut tunnel_device, tunnel_fd) = Self::get_tunnel(Arc::clone(&tun_provider), config)?; - let is_new_tunnel = tunnel_device.is_new_tunnel; + let is_new_tunnel = tunnel_device.is_new; let interface_name: String = tunnel_device .interface_name() |
