I'm trying to remove a host from a IpRange by doing a remove <ip>/32 and I'm getting this is returning way less hosts than it should. Here is the POC for this issue
use iprange::IpRange;
use ipnet::Ipv4Net;
let mut ip_range: IpRange<Ipv4Net> = IpRange::new();
ip_range.add("10.0.0.0/24".parse()?);
let remove: Ipv4Net = "10.0.0.50/32".parse()?;
ip_range.remove(remove);
let total_ip_count: usize = ip_range
.iter()
.map(|r| r.hosts().count())
.sum();
println!("hosts: {}", total_ip_count);
this returns hosts: 243 and we should have 253
I'm trying to remove a host from a IpRange by doing a remove
<ip>/32and I'm getting this is returning way less hosts than it should. Here is the POC for this issuethis returns
hosts: 243and we should have 253