Skip to content

Commit f8e58ab

Browse files
committed
Merge branch 'wg-fix-ipv6-mtu'
2 parents 22fc75d + 58bfb17 commit f8e58ab

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Line wrap the file at 100 chars. Th
2828
### Fixed
2929
- Fix `mullvad-cli` panicking if it tried to write to a closed pipe on Linux and macOS.
3030

31+
#### Windows
32+
- Fix error setting up tunnel when MTU was incorrectly set to a value below 1280 for IPv6.
33+
3134

3235
## [2025.5-beta1] - 2025-03-11
3336
### Added

talpid-openvpn/src/wintun.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl WintunAdapter {
9898

9999
pub fn prepare_interface(&self) {
100100
if let Err(error) =
101-
talpid_tunnel::network_interface::initialize_interfaces(self.luid(), None)
101+
talpid_tunnel::network_interface::initialize_interfaces(self.luid(), None, None)
102102
{
103103
log::error!(
104104
"{}",

talpid-tunnel/src/windows.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ use windows_sys::Win32::{
77

88
/// Sets MTU, metric, and disables unnecessary features for the IP interfaces
99
/// on the specified network interface (identified by `luid`).
10-
pub fn initialize_interfaces(luid: NET_LUID_LH, mtu: Option<u32>) -> io::Result<()> {
11-
for family in &[AddressFamily::Ipv4, AddressFamily::Ipv6] {
10+
pub fn initialize_interfaces(
11+
luid: NET_LUID_LH,
12+
ipv4_mtu: Option<u32>,
13+
ipv6_mtu: Option<u32>,
14+
) -> io::Result<()> {
15+
for (family, mtu) in &[
16+
(AddressFamily::Ipv4, ipv4_mtu),
17+
(AddressFamily::Ipv6, ipv6_mtu),
18+
] {
1219
let mut row = match get_ip_interface_entry(*family, &luid) {
1320
Ok(row) => row,
1421
Err(error) if error.raw_os_error() == Some(ERROR_NOT_FOUND as i32) => continue,
1522
Err(error) => return Err(error),
1623
};
1724

1825
if let Some(mtu) = mtu {
19-
row.NlMtu = mtu;
26+
row.NlMtu = *mtu;
2027
}
2128

2229
// Disable DAD, DHCP, and router discovery

talpid-wireguard/src/wireguard_go/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ impl WgGoTunnel {
311311
.map_err(|e| BoxedError::new(TunnelError::SetupIpInterfaces(e)))?;
312312
log::debug!("Waiting for tunnel IP interfaces: Done");
313313

314-
if let Err(error) = talpid_tunnel::network_interface::initialize_interfaces(luid, None)
314+
if let Err(error) =
315+
talpid_tunnel::network_interface::initialize_interfaces(luid, None, None)
315316
{
316317
log::error!(
317318
"{}",

talpid-wireguard/src/wireguard_nt/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,12 @@ async fn setup_ip_listener(device: Arc<WgNtAdapter>, mtu: u32, has_ipv6: bool) -
543543
.map_err(Error::IpInterfaces)?;
544544
log::debug!("Waiting for tunnel IP interfaces: Done");
545545

546-
talpid_tunnel::network_interface::initialize_interfaces(luid, Some(mtu))
547-
.map_err(Error::SetTunnelMtu)?;
546+
talpid_tunnel::network_interface::initialize_interfaces(
547+
luid,
548+
Some(mtu),
549+
has_ipv6.then_some(mtu),
550+
)
551+
.map_err(Error::SetTunnelMtu)?;
548552

549553
device
550554
.set_state(WgAdapterState::Up)

0 commit comments

Comments
 (0)