coredns/plugin
Miek Gieben 268781d355
cache: do the msg copy right (#4207)
Not sure why this is proving so difficult.. pointers are hard? [Was
tempted to rollback all tweaks here, but the original issue we're fixing
it too important to not have a proper fix].

But we need to make a copy of the message at the earliest point in the
handler because we are changing it (adding an opt rr). If we do this on
the original message (which is a pointer) we change it (obvs). When
undoing those changes we do work on a copy.

Re: testing. There isn't a explicit test for this, so I've added on to
the top-level test/ directory, which indeed makes the issue visible:

master:

~~~
go test -v -run=TestLookupCacheWithoutEdns
=== RUN   TestLookupCacheWithoutEdns
    cache_test.go:154: Expected no OPT RR, but got:
        ;; OPT PSEUDOSECTION:
        ; EDNS: version 0; flags: do; udp: 2048
--- FAIL: TestLookupCacheWithoutEdns (0.01s)
FAIL
~~~

This branch:

~~~
% go test -v -run=TestLookupCacheWithoutEdns
=== RUN   TestLookupCacheWithoutEdns
--- PASS: TestLookupCacheWithoutEdns (0.01s)
PASS
ok  	github.com/coredns/coredns/test	0.109s
~~~

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-15 07:47:07 -07:00
..
acl For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
any For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
auto plugins/auto: allow fallthrough if no zone match (#4166) 2020-10-01 15:25:19 +02:00
autopath For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
azure For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
bind For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
bufsize For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
cache cache: do the msg copy right (#4207) 2020-10-15 07:47:07 -07:00
cancel For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
chaos For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
clouddns For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
debug For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
deprecated For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
dns64 For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
dnssec For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
dnstap plugin/dnstap: various cleanups (#4179) 2020-10-12 19:10:35 +02:00
erratic For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
errors For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
etcd Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
file Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
forward plugin/dnstap: various cleanups (#4179) 2020-10-12 19:10:35 +02:00
grpc For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
health fix lameduck docs (#4169) 2020-10-01 08:03:34 -07:00
hosts For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
import Directive -> plugin (#3363) 2019-10-08 10:20:48 +01:00
k8s_external For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
kubernetes Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
loadbalance For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
log For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
loop For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
metadata For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
metrics For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
nsid For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
pkg Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
pprof For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
ready dont return 200 during shutdown (#4167) 2020-10-01 16:13:23 +02:00
reload For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
rewrite For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
root For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
route53 For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
secondary Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
sign For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
template For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
test goreport card fixes (#4139) 2020-09-22 09:22:00 +02:00
tls For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
trace [plugin][trace] - Have a consistent spanName (#4171) 2020-10-12 19:30:55 +00:00
transfer plugin/transfer: remove duplicate code (#4200) 2020-10-14 09:09:39 -04:00
whoami For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
backend.go Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142) 2020-09-24 20:30:39 +02:00
backend_lookup.go backend: fix root zone usage (#4039) 2020-07-31 10:58:09 +02:00
done.go go report card fixes (#3182) 2019-08-24 18:14:25 +00:00
log_test.go Clean up tests logging (#1979) 2018-07-19 16:23:06 +01:00
normalize.go add MustNormalize (#3385) 2019-10-19 08:08:14 +01:00
normalize_test.go add MustNormalize (#3385) 2019-10-19 08:08:14 +01:00
plugin.go typo fixes (#3169) 2019-08-21 16:08:55 -04:00
register.go For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00