mirror of
https://github.com/cirruslabs/softnet.git
synced 2026-10-20 18:10:19 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a540299219 | ||
|
|
16864f38f0 |
+7
-3
@@ -61,10 +61,14 @@ impl Proxy {
|
|||||||
// Once we've learned the VM's IP from the DHCP snooping,
|
// Once we've learned the VM's IP from the DHCP snooping,
|
||||||
// allow all global traffic for that VM's IP
|
// allow all global traffic for that VM's IP
|
||||||
if let Some(lease) = &self.dhcp_snooper.lease() {
|
if let Some(lease) = &self.dhcp_snooper.lease() {
|
||||||
let dst_is_global =
|
let ip_net = &ip_network::IpNetwork::from(Ipv4Addr::from(ipv4_pkt.dst_addr().0));
|
||||||
ip_network::IpNetwork::from(Ipv4Addr::from(ipv4_pkt.dst_addr().0)).is_global();
|
let dst_is_global_or_private =
|
||||||
|
match &ip_net {
|
||||||
|
ip_network::IpNetwork::V4(ip_net) => ip_net.is_global() || ip_net.is_private(),
|
||||||
|
ip_network::IpNetwork::V6(ip_net) => ip_net.is_global(),
|
||||||
|
};
|
||||||
|
|
||||||
if lease.valid_ip_source(ipv4_pkt.src_addr()) && dst_is_global {
|
if lease.valid_ip_source(ipv4_pkt.src_addr()) && dst_is_global_or_private {
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user