Commit graph

4 commits

Author SHA1 Message Date
xuweiwei
5f900b86f5
cleanup some code (#4989)
Automatically submitted.
2021-11-19 16:15:58 +00:00
ZouYu
66fcaaeafc
Fix some typos (#4412)
Signed-off-by: zouyu <zouy.fnst@cn.fujitsu.com>
2021-01-20 08:59:03 +01:00
Miek Gieben
be09f47305
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>
2020-10-14 10:11:22 +08:00
Miek Gieben
35b40a84f2
plugin/cache: Fix filtering (#4148)
The filtering of DNSSEC records in the cache plugin was not done
correctly. Also the change to introduced this bug didn't take into
account that the cache - by virtue of differentiating between DNSSEC and
no-DNSSEC - relied on not copying the data from the cache.

This change copies and then filters the data and factors the filtering
into a function that is used in two places (albeit with on ugly boolean
parameters to prevent copying things twice).

Add tests, do_test.go is moved to test/cache_test.go because the OPT
handing is done outside of the cache plugin. The core server re-attaches
the correct OPT when replying, so that makes for a better e2e test.

Added small unit test for filterRRslice and an explicit test that asks
for DNSSEC first and then plain, and vice versa to test cache behavior.

Fixes: #4146

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-28 07:53:00 -07:00