mirror of
https://github.com/cirruslabs/softnet.git
synced 2026-09-30 20:11:16 +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,
|
||||
// allow all global traffic for that VM's IP
|
||||
if let Some(lease) = &self.dhcp_snooper.lease() {
|
||||
let dst_is_global =
|
||||
ip_network::IpNetwork::from(Ipv4Addr::from(ipv4_pkt.dst_addr().0)).is_global();
|
||||
let ip_net = &ip_network::IpNetwork::from(Ipv4Addr::from(ipv4_pkt.dst_addr().0));
|
||||
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(());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user