Reverse zones: other views' addresses aren't missing PTRs
A reverse zone's missing PTR count covers only its own view's A and AAAA records. Addresses only other views' records use are counted apart (ptr_other_views, 'Other views' in zone show, a note on the zone page) and filled only when asked: fill-ptr --other-views, zone create --fill --other-views, or the New reverse zone dialog's checkbox. This keeps one view's host names out of another view's reverse zones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d18fe18ccd
commit
6cd3f6ef4e
16 files changed
+216
-48
No files matched your search
@@ -93,3 +93,27 @@ func TestPTRMissingList(t *testing.T) {
|
||||
t.Errorf("ptr_missing %v, list %v", z["ptr_missing"], z["ptr_missing_list"])
|
||||
}
|
||||
}
|
||||
|
||||
// An address only another view's records use isn't missing from a
|
||||
// reverse zone: it is counted apart, and filled only when asked.
|
||||
func TestPTROtherViews(t *testing.T) {
|
||||
e := newAPIEnv(t)
|
||||
e.do("POST", "/views", e.token, map[string]any{"name": "internal", "match_clients": []string{"10.0.0.0/8"}}, 201)
|
||||
e.do("POST", "/views", e.token, map[string]any{"name": "vps"}, 201)
|
||||
e.do("POST", "/zones", e.token, map[string]any{"name": "adbraun.lol", "view": "internal", "nameservers": []string{"ns1.example.net."},
|
||||
"records": []map[string]any{{"name": "claude", "type": "A", "data": "10.0.10.101"}}}, 201)
|
||||
for _, v := range []string{"internal", "vps"} {
|
||||
e.do("POST", "/zones", e.token, map[string]any{"name": "10.0.10.0/24", "view": v, "nameservers": []string{"ns1.example.net."}}, 201)
|
||||
}
|
||||
if z := e.do("GET", "/zones/10.0.10.in-addr.arpa?view=internal", e.token, nil, 200); z["ptr_missing"] != float64(1) || z["ptr_other_views"] != nil {
|
||||
t.Errorf("internal: ptr_missing %v, ptr_other_views %v", z["ptr_missing"], z["ptr_other_views"])
|
||||
}
|
||||
if z := e.do("GET", "/zones/10.0.10.in-addr.arpa?view=vps", e.token, nil, 200); z["ptr_missing"] != nil || z["ptr_other_views"] != float64(1) {
|
||||
t.Errorf("vps: ptr_missing %v, ptr_other_views %v", z["ptr_missing"], z["ptr_other_views"])
|
||||
}
|
||||
e.do("POST", "/zones/10.0.10.in-addr.arpa/fill-ptr?view=vps", e.token, nil, 400)
|
||||
e.do("POST", "/zones/10.0.10.in-addr.arpa/fill-ptr?view=vps&other_views=1", e.token, nil, 201)
|
||||
if z := e.do("GET", "/zones/10.0.10.in-addr.arpa?view=vps", e.token, nil, 200); z["ptr_other_views"] != nil {
|
||||
t.Errorf("vps after filling: ptr_other_views %v", z["ptr_other_views"])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user