Reverse zones made easy: suggested, filled, in the right view, PTRs kept in step
Missing reverse zones are suggested for the private views' A and AAAA records (/24 for private IPv4, /32 for a public address, /48 for IPv6) and created filled with PTR records (jarl zone suggest-reverse, the Zones page). zone create --fill and zone fill-ptr add the PTRs a reverse zone lacks; a reverse zone created without a view goes to the private view using its addresses. Per zone, auto_ptr keeps the PTR records of A and AAAA records in step on every change (database version 12). Zone commands take a network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a3b054cc86
commit
aa4b004a14
27 files changed
+1173
-38
No files matched your search
@@ -217,3 +217,35 @@ func TestReverseZones(t *testing.T) {
|
||||
t.Errorf("ReverseZone /22: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrefixFromReverse(t *testing.T) {
|
||||
for zone, want := range map[string]string{
|
||||
"10.0.10.in-addr.arpa.": "10.0.10.0/24",
|
||||
"10.in-addr.arpa": "10.0.0.0/8",
|
||||
"154.144.144.139.in-addr.arpa.": "139.144.144.154/32",
|
||||
"d.3.f.7.3.1.0.8.2.0.a.2.ip6.arpa.": "2a02:8013:7f3d::/48",
|
||||
"b.a.b.a.b.a.b.a.b.a.d.f.ip6.arpa.": "fdab:abab:abab::/48",
|
||||
"0-63.1.0.10.in-addr.arpa.": "",
|
||||
"example.com.": "",
|
||||
"256.10.in-addr.arpa.": "",
|
||||
} {
|
||||
p, ok := PrefixFromReverse(zone)
|
||||
got := ""
|
||||
if ok {
|
||||
got = p.String()
|
||||
}
|
||||
if got != want {
|
||||
t.Errorf("PrefixFromReverse(%q) = %q, want %q", zone, got, want)
|
||||
}
|
||||
}
|
||||
// Round trip with ReverseZone.
|
||||
for _, s := range []string{"192.168.1.0/24", "2a02:8013:7f3d::/48", "fd00::/8", "10.0.0.5/32"} {
|
||||
z, err := ReverseZone(netip.MustParsePrefix(s))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if p, ok := PrefixFromReverse(z); !ok || p.String() != s {
|
||||
t.Errorf("%s -> %s -> %v", s, z, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user