mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-15 10:25:40 +00:00
minor fixed (#120)
1. fix mtu, always set by ourselves and use smaller value 2. wireguard connector should return tunnel after receive packet
This commit is contained in:
@@ -295,14 +295,6 @@ impl VirtualNic {
|
||||
todo!("queue_num != 1")
|
||||
}
|
||||
config.queues(self.queue_num);
|
||||
|
||||
let flags = self.global_ctx.config.get_flags();
|
||||
let mut mtu_in_config = flags.mtu;
|
||||
if flags.enable_encryption {
|
||||
mtu_in_config -= 20;
|
||||
}
|
||||
|
||||
config.mtu(mtu_in_config as i32);
|
||||
config.up();
|
||||
|
||||
let dev = {
|
||||
@@ -313,6 +305,19 @@ impl VirtualNic {
|
||||
let ifname = dev.get_ref().name()?;
|
||||
self.ifcfg.wait_interface_show(ifname.as_str()).await?;
|
||||
|
||||
let flags = self.global_ctx.config.get_flags();
|
||||
let mut mtu_in_config = flags.mtu;
|
||||
if flags.enable_encryption {
|
||||
mtu_in_config -= 20;
|
||||
}
|
||||
{
|
||||
// set mtu by ourselves, rust-tun does not handle it correctly on windows
|
||||
let _g = self.global_ctx.net_ns.guard();
|
||||
self.ifcfg
|
||||
.set_mtu(ifname.as_str(), mtu_in_config as u32)
|
||||
.await?;
|
||||
}
|
||||
|
||||
let (a, b) = BiLock::new(dev);
|
||||
|
||||
let ft = TunnelWrapper::new(
|
||||
|
||||
Reference in New Issue
Block a user