修复udp广播丢失的问题

This commit is contained in:
lubeilin
2023-04-08 21:44:31 +08:00
parent 5dcda4d088
commit 8a032f86d8
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ fn handle(sender: &Sender<Ipv4Addr>, data: &mut [u8], tun_writer: &TunWriter, cu
// // 137端口是在局域网中提供计算机的名字或IP地址查询服务
// return Ok(());
// }
if src_ip != current_device.virtual_ip() || !check_dest(dest_ip, current_device.virtual_netmask, current_device.virtual_network) {
if src_ip != current_device.virtual_ip() || (!check_dest(dest_ip, current_device.virtual_netmask, current_device.virtual_network) && !dest_ip.is_broadcast()) {
return Ok(());
}
if src_ip == dest_ip {
@@ -97,7 +97,7 @@ fn start_(sender: Sender<Ipv4Addr>,
}
}
#[cfg(any(target_os = "linux",target_os = "macos"))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn start_(sender: Sender<Ipv4Addr>,
tun_reader: TunReader,
tun_writer: TunWriter,