plugin/cache: Unset AD flag when DO is not set for cache miss (#4736)

* unset AD bit when client DO is 0

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* add flag check to existing tests

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver 2021-07-09 04:53:50 -04:00 committed by GitHub
parent bfb6972d30
commit 002b748ccd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 9 deletions

View file

@ -181,6 +181,10 @@ func (w *ResponseWriter) WriteMsg(res *dns.Msg) error {
res.Ns = filterRRSlice(res.Ns, ttl, w.do, false)
res.Extra = filterRRSlice(res.Extra, ttl, w.do, false)
if !w.do {
res.AuthenticatedData = false // unset AD bit if client is not OK with DNSSEC
}
return w.ResponseWriter.WriteMsg(res)
}