mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
set ipv6 mtu on windows
windows use different MTU for ipv4 / ipv6, we should set both.
This commit is contained in:
@@ -384,6 +384,10 @@ impl IfConfiguerTrait for WindowsIfConfiger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn set_mtu(&self, name: &str, mtu: u32) -> Result<(), Error> {
|
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(
|
run_shell_cmd(
|
||||||
format!("netsh interface ipv4 set subinterface {} mtu={}", name, mtu).as_str(),
|
format!("netsh interface ipv4 set subinterface {} mtu={}", name, mtu).as_str(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ pub struct VirtualNic {
|
|||||||
ifcfg: Box<dyn IfConfiguerTrait + Send + Sync + 'static>,
|
ifcfg: Box<dyn IfConfiguerTrait + Send + Sync + 'static>,
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub fn checkreg(dev_name:&str) -> io::Result<()> {
|
pub fn checkreg(dev_name: &str) -> io::Result<()> {
|
||||||
use winreg::{enums::HKEY_LOCAL_MACHINE, enums::KEY_ALL_ACCESS, RegKey};
|
use winreg::{enums::HKEY_LOCAL_MACHINE, enums::KEY_ALL_ACCESS, RegKey};
|
||||||
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
|
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
|
||||||
let profiles_key = hklm.open_subkey_with_flags(
|
let profiles_key = hklm.open_subkey_with_flags(
|
||||||
@@ -262,7 +262,9 @@ pub fn checkreg(dev_name:&str) -> io::Result<()> {
|
|||||||
// check if ProfileName contains "et"
|
// check if ProfileName contains "et"
|
||||||
match subkey.get_value::<String, _>("ProfileName") {
|
match subkey.get_value::<String, _>("ProfileName") {
|
||||||
Ok(profile_name) => {
|
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);
|
keys_to_delete.push(subkey_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,7 +282,9 @@ pub fn checkreg(dev_name:&str) -> io::Result<()> {
|
|||||||
// check if ProfileName contains "et"
|
// check if ProfileName contains "et"
|
||||||
match subkey.get_value::<String, _>("Description") {
|
match subkey.get_value::<String, _>("Description") {
|
||||||
Ok(profile_name) => {
|
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);
|
keys_to_delete_unmanaged.push(subkey_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user