diff --git a/Cargo.lock b/Cargo.lock index 698c4fe..e1844ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1584,9 +1584,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smoltcp" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" +checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" dependencies = [ "bitflags 1.3.2", "byteorder", diff --git a/lib/dhcp_snooper.rs b/lib/dhcp_snooper.rs index 07c0e70..10ea36d 100644 --- a/lib/dhcp_snooper.rs +++ b/lib/dhcp_snooper.rs @@ -26,14 +26,14 @@ impl DhcpSnooper { }; let dns_ips = match message.opts().get(OptionCode::DomainNameServer) { - Some(DhcpOption::DomainNameServer(dns_ips)) => HashSet::from_iter( - dns_ips.iter().map(|dns_ip| Ipv4Address(dns_ip.octets())), - ), + Some(DhcpOption::DomainNameServer(dns_ips)) => { + HashSet::from_iter(dns_ips.iter().cloned()) + } _ => HashSet::new(), }; self.vm_lease = Some(Lease::new( - message.yiaddr().into(), + message.yiaddr(), Duration::from_secs(*lease_time as u64), dns_ips, )) diff --git a/lib/host.rs b/lib/host.rs index 1397e52..75a83fd 100644 --- a/lib/host.rs +++ b/lib/host.rs @@ -92,7 +92,7 @@ impl Host { interface, new_packets_rx, callback_can_continue_tx, - gateway_ip: gateway_ip.into(), + gateway_ip, max_packet_size, finalized: false, }) diff --git a/lib/proxy/vm.rs b/lib/proxy/vm.rs index c06abac..53c7530 100644 --- a/lib/proxy/vm.rs +++ b/lib/proxy/vm.rs @@ -48,7 +48,7 @@ impl Proxy<'_> { let source_protocol_addr = Ipv4Addr::from(source_protocol_addr); if let Some(lease) = self.dhcp_snooper.lease() { - if lease.valid_ip_source(source_protocol_addr.into()) { + if lease.valid_ip_source(source_protocol_addr) { return Some(()); } } else if source_protocol_addr.is_unspecified() { @@ -62,7 +62,7 @@ impl Proxy<'_> { // Have we learned the VM's IP from the DHCP snooping? if let Some(lease) = &self.dhcp_snooper.lease() { // If so, allow all global traffic - let dst_addr = Ipv4Addr::from(ipv4_pkt.dst_addr().0); + let dst_addr = ipv4_pkt.dst_addr(); let dst_is_global = ip_network::IpNetwork::from(dst_addr).is_global(); if lease.valid_ip_source(ipv4_pkt.src_addr()) && dst_is_global {