diff options
author | 2020-10-14 04:11:22 +0200 | |
---|---|---|
committer | 2020-10-14 10:11:22 +0800 | |
commit | be09f4730572860bd5ecb4a3e856dc19d0cd74fe (patch) | |
tree | 1f0f6dbb0bc768eacaa268305a1f663c22f5523f /plugin/cache/handler.go | |
parent | 34dc59fc585fe72568f6887301578026e55d48cf (diff) | |
download | coredns-be09f4730572860bd5ecb4a3e856dc19d0cd74fe.tar.gz coredns-be09f4730572860bd5ecb4a3e856dc19d0cd74fe.tar.zst coredns-be09f4730572860bd5ecb4a3e856dc19d0cd74fe.zip |
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 <miek@miek.nl>
Diffstat (limited to 'plugin/cache/handler.go')
-rw-r--r-- | plugin/cache/handler.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugin/cache/handler.go b/plugin/cache/handler.go index f079e6c51..987dd61b2 100644 --- a/plugin/cache/handler.go +++ b/plugin/cache/handler.go @@ -41,7 +41,7 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) if !do { setDo(r) } - crr := &ResponseWriter{ResponseWriter: w, Cache: c, state: state, server: server} + crr := &ResponseWriter{ResponseWriter: w, Cache: c, state: state, server: server, do: do} return plugin.NextOrFailure(c.Name(), c.Next, ctx, crr, r) } if ttl < 0 { @@ -53,7 +53,7 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) if !do { setDo(r) } - crr := &ResponseWriter{Cache: c, state: state, server: server, prefetch: true, remoteAddr: w.LocalAddr()} + crr := &ResponseWriter{Cache: c, state: state, server: server, prefetch: true, remoteAddr: w.LocalAddr(), do: do} plugin.NextOrFailure(c.Name(), c.Next, ctx, crr, r) }() } |