summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid-core/src/tunnel/mod.rs6
-rw-r--r--talpid-wireguard/src/lib.rs14
2 files changed, 10 insertions, 10 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 652d24e4b9..b7b4abd747 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -164,9 +164,9 @@ impl TunnelMonitor {
{
let default_mtu = DEFAULT_MTU;
- #[cfg(any(target_os = "linux", target_os = "windows"))]
// Detects the MTU of the device and sets the default tunnel MTU to that minus headers and
// the safety margin
+ #[cfg(any(target_os = "linux", target_os = "windows"))]
let default_mtu = args
.runtime
.block_on(
@@ -176,14 +176,14 @@ impl TunnelMonitor {
.map(|mtu| Self::clamp_mtu(params, mtu))
.unwrap_or(default_mtu);
- #[cfg(any(target_os = "linux", windows))]
+ #[cfg(not(target_os = "android"))]
let detect_mtu = params.options.mtu.is_none();
let config = talpid_wireguard::config::Config::from_parameters(params, default_mtu)?;
let monitor = talpid_wireguard::WireguardMonitor::start(
config,
params.options.quantum_resistant,
- #[cfg(any(target_os = "linux", windows))]
+ #[cfg(not(target_os = "android"))]
detect_mtu,
log.as_deref(),
args,
diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs
index a2d4d496c0..ee801559f7 100644
--- a/talpid-wireguard/src/lib.rs
+++ b/talpid-wireguard/src/lib.rs
@@ -50,7 +50,7 @@ mod connectivity_check;
mod logging;
mod ping_monitor;
mod stats;
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "linux", target_os = "macos"))]
mod unix;
#[cfg(wireguard_go)]
mod wireguard_go;
@@ -274,7 +274,7 @@ impl WireguardMonitor {
>(
mut config: Config,
psk_negotiation: bool,
- #[cfg(any(target_os = "linux", windows))] detect_mtu: bool,
+ #[cfg(not(target_os = "android"))] detect_mtu: bool,
log_path: Option<&Path>,
args: TunnelArgs<'_, F>,
) -> Result<WireguardMonitor> {
@@ -394,7 +394,7 @@ impl WireguardMonitor {
.await?;
}
- #[cfg(any(target_os = "linux", windows))]
+ #[cfg(not(target_os = "android"))]
if detect_mtu {
let iface_name_clone = iface_name.clone();
tokio::task::spawn(async move {
@@ -416,7 +416,7 @@ impl WireguardMonitor {
if verified_mtu != config.mtu {
log::warn!("Lowering MTU from {} to {verified_mtu}", config.mtu);
- #[cfg(target_os = "linux")]
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
let res = unix::set_mtu(&iface_name_clone, verified_mtu);
#[cfg(windows)]
let res = talpid_windows::net::luid_from_alias(iface_name_clone).and_then(
@@ -1013,7 +1013,7 @@ impl WireguardMonitor {
///
/// The detection works by sending evenly spread out range of pings between 576 and the given
/// current tunnel MTU, and returning the maximum packet size that was returned within a timeout.
-#[cfg(any(target_os = "linux", windows))]
+#[cfg(not(target_os = "android"))]
async fn auto_mtu_detection(
gateway: std::net::Ipv4Addr,
#[cfg(any(target_os = "macos", target_os = "linux"))] iface_name: String,
@@ -1102,7 +1102,7 @@ async fn auto_mtu_detection(
/// Creates a linear spacing of MTU values with the given step size. Always includes the given end
/// points.
-#[cfg(any(target_os = "linux", windows))]
+#[cfg(not(target_os = "android"))]
fn mtu_spacing(mtu_min: u16, mtu_max: u16, step_size: u16) -> Vec<u16> {
assert!(mtu_min < mtu_max);
assert!(step_size < mtu_max);
@@ -1118,7 +1118,7 @@ fn mtu_spacing(mtu_min: u16, mtu_max: u16, step_size: u16) -> Vec<u16> {
ret
}
-#[cfg(all(test, any(target_os = "linux", windows)))]
+#[cfg(all(test, not(target_os = "android")))]
mod tests {
use crate::mtu_spacing;
use proptest::prelude::*;