diff --git a/libs/fast-nat/src/cpnat.rs b/libs/fast-nat/src/cpnat.rs index 86f5ee4..8496ed7 100644 --- a/libs/fast-nat/src/cpnat.rs +++ b/libs/fast-nat/src/cpnat.rs @@ -154,9 +154,8 @@ impl CrossProtocolNetworkAddressTableWithIpv4Pool { let new_address = self .pool .iter() - .map(|prefix| prefix.hosts()) - .flatten() - .find(|addr| !self.table.get_ipv6(addr).is_some()) + .flat_map(Ipv4Net::hosts) + .find(|addr| self.table.get_ipv6(addr).is_none()) .ok_or(Error::Ipv4PoolExhausted)?; // Insert the new mapping diff --git a/src/protomask.rs b/src/protomask.rs index a08fdad..de05a15 100644 --- a/src/protomask.rs +++ b/src/protomask.rs @@ -171,7 +171,7 @@ pub async fn main() { Some(new_destination) => Ok(translate_ipv4_to_ipv6( packet, unsafe { embed_ipv4_addr_unchecked(*source, args.translation_prefix) }, - new_destination.into(), + new_destination, ) .map(Some)?), None => { @@ -183,7 +183,7 @@ pub async fn main() { |packet, source, dest| { Ok(translate_ipv6_to_ipv4( packet, - addr_table.borrow_mut().get_or_create_ipv4(source)?.into(), + addr_table.borrow_mut().get_or_create_ipv4(source)?, unsafe { extract_ipv4_addr_unchecked(*dest, args.translation_prefix.prefix_len()) },