diff options
author | nsgundy <[email protected]> | 2023-05-19 15:21:20 +0000 |
---|---|---|
committer | nsgundy <[email protected]> | 2023-05-19 15:21:20 +0000 |
commit | aeeca0d7d100436272bb578d693a10cd4064fce2 (patch) | |
tree | c140e4fedc2e4be14f02263bcc90d838e82b0c9b | |
parent | 482d7fb8ccaf671170f5a8fa93af2d91b27d583f (diff) | |
download | rustdesk-server-aeeca0d7d100436272bb578d693a10cd4064fce2.tar.gz rustdesk-server-aeeca0d7d100436272bb578d693a10cd4064fce2.zip |
Fix ip4 mapped ip6 addresses not considered to be part of network
-rw-r--r-- | src/rendezvous_server.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 88cd6cb..5aba4d4 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -1188,8 +1188,16 @@ impl RendezvousServer { #[inline] fn is_lan(&self, addr: SocketAddr) -> bool { if let Some(network) = &self.inner.mask { - if let SocketAddr::V4(addr) = addr { - return network.contains(*addr.ip()); + match addr { + SocketAddr::V4(v4_socket_addr) => { + return network.contains(*v4_socket_addr.ip()); + } + + SocketAddr::V6(v6_socket_addr) => { + if let Some(v4_addr) = v6_socket_addr.ip().to_ipv4_mapped() { + return network.contains(v4_addr); + } + } } } false |