diff --git a/src/init.rs b/src/init.rs index 70fe5fa..33d5538 100644 --- a/src/init.rs +++ b/src/init.rs @@ -142,6 +142,8 @@ impl Launcher { let cidr = IpNetwork::from_str(&cidr.clone())?; ipmap.entry(listen_ip).or_insert_with(|| cidr.network()); + let cidr = IpNetwork::new(cidr.network(), cidr.prefix()).unwrap(); + if let Entry::Vacant(e) = authority_map.entry(cidr) { tracing::debug!("{}", cidr.to_ptr_soa_name()?); let ptr_authority = diff --git a/src/traits.rs b/src/traits.rs index 8083e7f..74f72d7 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -139,6 +139,10 @@ mod tests { IpNetwork::from_str("1.2.3.4/32").unwrap(), LowerName::from_str("4.3.2.1.in-addr.arpa").unwrap(), ), + ( + IpNetwork::from_str("fd0c:ccb7:52f7:13c4:7c99:9312:1234:5678/88").unwrap(), + LowerName::from_str("3.9.9.9.c.7.4.c.3.1.7.f.2.5.7.b.c.c.c.0.d.f.ip6.arpa").unwrap(), + ) ] { assert_eq!(item.0.to_ptr_soa_name().unwrap(), item.1); } diff --git a/tests/service/mod.rs b/tests/service/mod.rs index 9051ea1..fb1d1f3 100644 --- a/tests/service/mod.rs +++ b/tests/service/mod.rs @@ -187,6 +187,7 @@ impl Service { ipmap.insert(listen_ip, cidr.network()); } + let cidr = IpNetwork::new(cidr.network(), cidr.prefix()).unwrap(); if !authority_map.contains_key(&cidr) { let ptr_authority = RecordAuthority::new( cidr.to_ptr_soa_name().unwrap(),