plugin/file: test that out-of-zone CNAME targets keep NOERROR (#8569)

This commit is contained in:
Baltasar Blanco
2026-10-16 18:05:50 -03:00
committed by GitHub
parent 16b53a46c1
commit 62be0a2f90
3 changed files with 67 additions and 2 deletions

View File

@@ -469,6 +469,9 @@ func delegationFromElem(tr *tree.Tree, elem *tree.Elem, qname string, qtype uint
}
func (z *Zone) doLookup(ctx context.Context, state request.Request, target string, qtype uint16) ([]dns.RR, Result) {
if z.Upstream == nil {
return nil, ServerFailure
}
m, e := z.Upstream.Lookup(ctx, state, target, qtype)
if e != nil {
return nil, ServerFailure
@@ -485,6 +488,9 @@ func (z *Zone) doLookup(ctx context.Context, state request.Request, target strin
if m.Rcode == dns.RcodeSuccess && len(m.Answer) == 0 {
return m.Answer, NoData
}
// Anything else, including the REFUSED returned for a target outside every
// zone served here, keeps NOERROR: the CNAME is the answer and the resolver
// chases the target itself. See #7346.
return m.Answer, Success
}