summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim.hulthe@mullvad.net>2025-10-06 15:19:08 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2025-10-24 14:11:11 +0200
commitf4a95a0841c64805c5dba52a91ea561e515deeb7 (patch)
treeb981e796fb81c5bdb9e09ec47609b325b67f1d5d
parent2351c1c5e827004e28db637ebcb27f7fa1448826 (diff)
downloadmullvadvpn-f4a95a0841c64805c5dba52a91ea561e515deeb7.tar.xz
mullvadvpn-f4a95a0841c64805c5dba52a91ea561e515deeb7.zip
Work around mtu getter not being implemented on Android
-rw-r--r--talpid-wireguard/src/boringtun/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/talpid-wireguard/src/boringtun/mod.rs b/talpid-wireguard/src/boringtun/mod.rs
index ef3ce5116d..413a86dddd 100644
--- a/talpid-wireguard/src/boringtun/mod.rs
+++ b/talpid-wireguard/src/boringtun/mod.rs
@@ -219,7 +219,13 @@ pub async fn open_boringtun_tunnel(
let mut tun_config = tun07::Configuration::default();
tun_config.raw_fd(fd);
- let device = tun07::Device::new(&tun_config).unwrap();
+ let mut device = tun07::Device::new(&tun_config).unwrap();
+
+ // HACK: the `tun` crate does not implement AbstractDevice::(set_)mtu on Android, instead
+ // they are stubbed. `mtu()` will simply return the value set by `set_mtu()`, or 1500.
+ //
+ // GotaTun will try to read the MTU from this, so call set_mtu here with the correct value.
+ device.set_mtu(config.mtu).unwrap();
(Arc::new(tun), tun07::AsyncDevice::new(device).unwrap())
};