plugin/file: return referrals after alias resolution (#8341)

Detect zone cuts while following CNAME and DNAME targets so partial answers carry the child NS and glue records instead of returning SERVFAIL or apex authority. Keep AA set for authoritative alias partial answers while clearing it for referral-only responses.

Fixes #6405
Fixes #6627

Signed-off-by: houyuwushang <liuluoqianqiu@outlook.com>
This commit is contained in:
houyuwushang
2026-07-30 09:12:07 +08:00
committed by GitHub
parent 73cd1efe5b
commit 3c2c33bb50
3 changed files with 329 additions and 23 deletions

View File

@@ -117,7 +117,11 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
case NameError:
m.Rcode = dns.RcodeNameError
case Delegation:
m.Authoritative = false
// A referral-only response is not authoritative. A partial answer
// containing an authoritative alias keeps AA set for the original QNAME.
if len(m.Answer) == 0 {
m.Authoritative = false
}
case ServerFailure:
// If the result is SERVFAIL and the answer is non-empty, then the SERVFAIL came from an
// external CNAME lookup and the answer contains the CNAME with no target record. We should