Skip to content

Commit

Permalink
no mask check for wol to avoid unexpected bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rustdesk committed Jun 16, 2023
1 parent fe8ab49 commit 82d6032
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ pub async fn handle_test_delay(t: TestDelay, peer: &mut Stream) {

/// Whether is track pad scrolling.
#[inline]
#[cfg(all(target_os = "macos"))]
#[cfg(all(target_os = "macos", not(feature = "flutter")))]
fn check_scroll_on_mac(mask: i32, x: i32, y: i32) -> bool {
// flutter version we set mask type bit to 4 when track pad scrolling.
if mask & 7 == crate::input::MOUSE_TYPE_TRACKPAD {
Expand Down
21 changes: 7 additions & 14 deletions src/lan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,14 @@ pub fn send_wol(id: String) {
let interfaces = default_net::get_interfaces();
for peer in &config::LanPeers::load().peers {
if peer.id == id {
for (ip, mac) in peer.ip_mac.iter() {
for (_, mac) in peer.ip_mac.iter() {
if let Ok(mac_addr) = mac.parse() {
if let Ok(IpAddr::V4(ip)) = ip.parse() {
for interface in &interfaces {
for ipv4 in &interface.ipv4 {
if (u32::from(ipv4.addr) & u32::from(ipv4.netmask))
== (u32::from(ip) & u32::from(ipv4.netmask))
{
allow_err!(wol::send_wol(
mac_addr,
None,
Some(IpAddr::V4(ipv4.addr))
));
}
}
for interface in &interfaces {
for ipv4 in &interface.ipv4 {
// remove below mask check to avoid unexpected bug
// if (u32::from(ipv4.addr) & u32::from(ipv4.netmask)) == (u32::from(peer_ip) & u32::from(ipv4.netmask))
log::info!("Send wol to {mac_addr} of {}", ipv4.addr);
allow_err!(wol::send_wol(mac_addr, None, Some(IpAddr::V4(ipv4.addr))));
}
}
}
Expand Down

0 comments on commit 82d6032

Please sign in to comment.