plugin/file: Fix response for qtype=DS (#1300)

DS is peculiar and needs some special cases to do the right things.
For a direct query return the DS, but if we're hitting below the
delegation return the NS+DS in a delegation response.
This commit is contained in:
Miek Gieben
2017-12-11 14:17:41 +00:00
committed by GitHub
parent 6cd0050c09
commit 27da0eba04
2 changed files with 27 additions and 1 deletions

View File

@@ -127,6 +127,15 @@ func (z *Zone) Lookup(state request.Request, qname string) ([]dns.RR, []dns.RR,
// If we see NS records, it means the name as been delegated, and we should return the delegation.
if nsrrs := elem.Types(dns.TypeNS); nsrrs != nil {
// If the query is specifically for DS and the qname matches the delegated name, we should
// return the DS in the answer section and leave the rest empty, i.e. just continue the loop
// and continue searching.
if qtype == dns.TypeDS && elem.Name() == qname {
i++
continue
}
glue := z.Glue(nsrrs, do)
if do {
dss := z.typeFromElem(elem, dns.TypeDS, do)