mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-15 22:27:26 +08:00
allow use ipv4 address in any cidr (#404)
This commit is contained in:
@@ -718,8 +718,16 @@ impl PeerManager {
|
||||
|
||||
let mut is_exit_node = false;
|
||||
let mut dst_peers = vec![];
|
||||
// NOTE: currently we only support ipv4 and cidr is 24
|
||||
if ipv4_addr.is_broadcast() || ipv4_addr.is_multicast() || ipv4_addr.octets()[3] == 255 {
|
||||
let network_length = self
|
||||
.global_ctx
|
||||
.get_ipv4()
|
||||
.map(|x| x.network_length())
|
||||
.unwrap_or(24);
|
||||
let ipv4_inet = cidr::Ipv4Inet::new(ipv4_addr, network_length).unwrap();
|
||||
if ipv4_addr.is_broadcast()
|
||||
|| ipv4_addr.is_multicast()
|
||||
|| ipv4_addr == ipv4_inet.last_address()
|
||||
{
|
||||
dst_peers.extend(
|
||||
self.peers
|
||||
.list_routes()
|
||||
|
||||
Reference in New Issue
Block a user