set ipv6 mtu on windows

windows use different MTU for ipv4 / ipv6, we should set both.
This commit is contained in:
sijie.sun 2024-08-15 21:55:02 +08:00 committed by Sijie.Sun
parent 0fbbea963f
commit 198c239399
2 changed files with 12 additions and 4 deletions

View File

@ -384,6 +384,10 @@ impl IfConfiguerTrait for WindowsIfConfiger {
}
async fn set_mtu(&self, name: &str, mtu: u32) -> Result<(), Error> {
let _ = run_shell_cmd(
format!("netsh interface ipv6 set subinterface {} mtu={}", name, mtu).as_str(),
)
.await;
run_shell_cmd(
format!("netsh interface ipv4 set subinterface {} mtu={}", name, mtu).as_str(),
)

View File

@ -262,7 +262,9 @@ pub fn checkreg(dev_name:&str) -> io::Result<()> {
// check if ProfileName contains "et"
match subkey.get_value::<String, _>("ProfileName") {
Ok(profile_name) => {
if profile_name.contains("et_") || (!dev_name.is_empty() && dev_name == profile_name) {
if profile_name.contains("et_")
|| (!dev_name.is_empty() && dev_name == profile_name)
{
keys_to_delete.push(subkey_name);
}
}
@ -280,7 +282,9 @@ pub fn checkreg(dev_name:&str) -> io::Result<()> {
// check if ProfileName contains "et"
match subkey.get_value::<String, _>("Description") {
Ok(profile_name) => {
if profile_name.contains("et_") || (!dev_name.is_empty() && dev_name == profile_name) {
if profile_name.contains("et_")
|| (!dev_name.is_empty() && dev_name == profile_name)
{
keys_to_delete_unmanaged.push(subkey_name);
}
}