From be09f4730572860bd5ecb4a3e856dc19d0cd74fe Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 14 Oct 2020 04:11:22 +0200 Subject: plugin/cache: fix removing OPT (#4190) By checking state.Do() were are checking if the request had DO, but we are _always_ adding Do now - do we need to save the DO from the ORIGINAL request, which must be done in the ResponseWriter. Also skip OPT records in filterDNSSEC as we can't set the TTL on those records, this prevents writing a number to OPT's MBZ. Note none of the tests have changed and still PASS. This is due to the fact that CoreDNSServerAndPorts isn't a full server as we start in main, it lacks the scrubwriter for instance. This is not bad per se, but should be documented in the test code. Signed-off-by: Miek Gieben --- plugin/cache/dnssec.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin/cache/dnssec.go') diff --git a/plugin/cache/dnssec.go b/plugin/cache/dnssec.go index 72520e345..7f880db75 100644 --- a/plugin/cache/dnssec.go +++ b/plugin/cache/dnssec.go @@ -31,6 +31,9 @@ func filterRRSlice(rrs []dns.RR, ttl uint32, do, dup bool) []dns.RR { if !do && isDNSSEC(r) { continue } + if r.Header().Rrtype == dns.TypeOPT { + continue + } r.Header().Ttl = ttl if dup { rs[j] = dns.Copy(r) -- cgit v1.2.3