Skip to content

Commit

Permalink
fix: Don't limit the Windows MTU
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Sep 2, 2024
1 parent 97f5943 commit 21d9495
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn get_interface_mtu_linux_macos(socket: &UdpSocket) -> Result<usize, Error> {

#[cfg(target_os = "windows")]
fn get_interface_mtu_windows(socket: &UdpSocket) -> Result<usize, Error> {
use std::{cmp::min, ffi::c_void, slice};
use std::{ffi::c_void, slice};

use windows::Win32::{
Foundation::NO_ERROR,
Expand Down Expand Up @@ -214,8 +214,7 @@ fn get_interface_mtu_windows(socket: &UdpSocket) -> Result<usize, Error> {
// For the matching address, find local interface and its MTU.
for iface in ifaces {
if iface.InterfaceIndex == addr.InterfaceIndex {
// On loopback, the MTU is 4294967295...
res = min(iface.NlMtu, 65536).try_into().or(res);
res = iface.NlMtutry_into().or(res);
break 'addr_loop;
}
}
Expand Down

0 comments on commit 21d9495

Please sign in to comment.