updated win's mtu

This commit is contained in:
asxalex 2025-02-06 10:13:43 +08:00
parent 4aa33a4e26
commit 7e5792e190
3 changed files with 26 additions and 1 deletions

View File

@ -3,3 +3,6 @@ linker = "x86_64-linux-musl-gcc"
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"

View File

@ -12,7 +12,7 @@ linux-tun:
RUSTFLAGS="-L ." cargo build --features "tun" --release
win:
cargo build --release
cargo build --release --target x86_64-pc-windows-gnu
pb:
cargo run --bin build_pb

View File

@ -91,6 +91,28 @@ impl Iface {
error!("failed to run netsh: {}", e.to_string());
}
}
let mut cmd = Command::new("netsh");
let command = cmd
.creation_flags(0x08000000)
.arg("interface")
.arg("ipv4")
.arg("set")
.arg("subinterface")
.arg(&format!("\"{}\"", self.name))
.arg(format!("mtu={}", device_config.mtu))
.arg("store=persistent");
let res = command.output();
match res {
Ok(r) => {
debug!("netsh2 ok: [{:?}]", String::from_utf8_lossy(&r.stdout));
}
Err(e) => {
error!("failed to run netsh2: {}", e.to_string());
}
}
}
}