mirror of
https://github.com/cirruslabs/softnet.git
synced 2026-10-22 05:58:03 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce129ba5cb |
+7
-5
@@ -68,6 +68,11 @@ impl Proxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow communication with host
|
||||||
|
if ipv4_pkt.dst_addr() == self.host.gateway_ip {
|
||||||
|
return Some(());
|
||||||
|
}
|
||||||
|
|
||||||
if ipv4_pkt.protocol() == IpProtocol::Udp {
|
if ipv4_pkt.protocol() == IpProtocol::Udp {
|
||||||
let udp_pkt = UdpPacket::new_checked(ipv4_pkt.payload()).ok()?;
|
let udp_pkt = UdpPacket::new_checked(ipv4_pkt.payload()).ok()?;
|
||||||
|
|
||||||
@@ -77,11 +82,8 @@ impl Proxy {
|
|||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow DHCP communication with the bootpd(8) on host
|
// Allow DHCP communication with the bootpd(8) on host via broadcast address
|
||||||
let allowed_dhcp_target =
|
if udp_pkt.is_dhcp_request() && ipv4_pkt.dst_addr().is_broadcast() {
|
||||||
ipv4_pkt.dst_addr().is_broadcast() || ipv4_pkt.dst_addr() == self.host.gateway_ip;
|
|
||||||
|
|
||||||
if udp_pkt.is_dhcp_request() && allowed_dhcp_target {
|
|
||||||
return Some(());
|
return Some(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ fn try_main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err("root privileges are required to run".into());
|
return Err("root privileges are required to run and passwordless sudo was not available".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set bootpd(8) min/max lease time while still having the root privileges
|
// Set bootpd(8) min/max lease time while still having the root privileges
|
||||||
|
|||||||
Reference in New Issue
Block a user