mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user