aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-27plugin/cache: add a new keepttl option (#5879)Gravatar Arthur Outhenin-Chalandre 6-1/+87
adds a new option `keepttl` to the cache plugin Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
2022-10-21plugin/cache: cache now uses source query DNSSEC option for upstream refresh ↵Gravatar Grant Spence 7-85/+69
(#5671) Signed-off-by: Grant Spence <gspence@redhat.com> Signed-off-by: Grant Spence <gspence@redhat.com>
2022-09-08plugin/view: Advanced routing interface and new 'view' plugin (#5538)Gravatar Chris O'Haver 5-27/+34
* introduce new interface "dnsserver.Viewer", that allows a plugin implementing it to decide if a query should be routed into its server block. * add new plugin "view", that uses the new interface to enable a user to define expression based conditions that must be met for a query to be routed to its server block. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-28plugin/cache: Add cache disable option (#5540)Gravatar Chris O'Haver 6-3/+158
* add cache disable options Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-11auto go fmtGravatar coredns[bot] 1-1/+1
Signed-off-by: coredns[bot] <bot@bot.coredns.io>
2022-07-10add golangci-lint linter (#5499)Gravatar Ondřej Benkovský 1-1/+1
2022-07-07plugin/file/cache: Add metadata for wildcard record responses (#5308)Gravatar Chris O'Haver 4-2/+87
For responses synthesized by known wildcard records, publish metadata containing the wildcard record name Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-06-17plugin/cache: Add option to adjust SERVFAIL response cache TTL (#5320)Gravatar Chris O'Haver 5-2/+78
* add servfail cache opt Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-06-17retain response AD bit if requestor's AD bit was set (#5191)Gravatar Chris O'Haver 4-8/+14
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-06-17fix 'verify' option name in readme (#5441)Gravatar Chris O'Haver 1-2/+2
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-06-07plugin/cache: Reword serve_stale docs for clarity (#5394)Gravatar Chris O'Haver 1-6/+6
* reword for clarity; use consistent terminology Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-05-02plugin/cache: Add refresh mode setting to serve_stale (#5131)Gravatar Antoine Tollenaere 6-25/+170
This PR adds an optional REFRESH_MODE parameter on the serve_stale configuration directive of the cache plugin, which verifies that the upstream is still unavailable before returning stale entries. Signed-off-by: Antoine Tollenaere <atollena@gmail.com>
2022-05-01plugin/cache: Fix cache poisoning exploit (#5174)Gravatar Chris O'Haver 3-25/+29
2022-03-18update all +build statements (#5271)Gravatar Qasim Sarfraz 1-1/+1
* update all +build statements Signed-off-by: MQasimSarfraz <syed.qasim.sarfraz@gmail.com> * remove old +build style Signed-off-by: MQasimSarfraz <syed.qasim.sarfraz@gmail.com>
2022-02-14add zones label to cache metrics (#5124)Gravatar Elijah Andrews 5-31/+35
* add zones to cache metrics Signed-off-by: Elijah Andrews <elijahcandrews@gmail.com>
2021-11-19cleanup some code (#4989)Gravatar xuweiwei 1-1/+1
Automatically submitted.
2021-08-16Update cache metrics (#4781)Gravatar Ben Kochie 3-3/+13
Add a total cache request counter to follow Prometheus conventions[0]. Mark the existing cache miss metric as deprecated. > Similarly, with hit or miss for caches, it’s better to have one > metric for total and another for hits. [0]: https://prometheus.io/docs/instrumenting/writing_exporters/#naming Signed-off-by: SuperQ <superq@gmail.com>
2021-07-09plugin/cache: Unset AD flag when DO is not set for cache miss (#4736)Gravatar Chris O'Haver 2-1/+10
* 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>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 1-10/+1
Make normalize return multiple "hosts" (= reverse zones) when a non-octet boundary cidr is given. Added pkg/cidr package that holds the cidr calculation routines; felt they didn't really fit dnsutil. This change means the IPNet return parameter isn't needed, the hosts are all correct. The tests that tests this is also removed: TestSplitHostPortReverse The fallout was that zoneAddr _also_ doesn't need the IPNet member, that in turn make it visible that zoneAddr in address.go duplicated a bunch of stuff from register.go; removed/refactored that too. Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the right things, by consuming ZONE arguments; this now expands reverse zones correctly. This is mostly mechanical. Remove the reverse test in plugin/kubernetes which is a copy-paste from a core test (which has since been fixed). Remove MustNormalize as it has no plugin users. This change is not backwards compatible to plugins that have a ZONE argument that they parse in the setup util. All in-tree plugins have been updated. Signed-off-by: Miek Gieben <miek@miek.nl>
2021-03-21Add cache eviction metrics to the cache plugin (#4411)Gravatar Frank Riley 3-2/+14
Signed-off-by: Frank Riley <fhriley@gmail.com>
2021-01-24Fix import ordering presubmit test (#4422)Gravatar Miek Gieben 1-0/+1
Automatically submitted.
2021-01-20Fix some typos (#4412)Gravatar ZouYu 1-1/+1
Signed-off-by: zouyu <zouy.fnst@cn.fujitsu.com>
2021-01-15Prevent race from prefetching (#4368)Gravatar sschepens 1-20/+16
Automatically submitted.
2020-12-11Move .LocalAddr() out of goroutine (#4281)Gravatar Miek Gieben 1-1/+2
I don't have theory why this panics, but concurrency has something to do with it, so get the address before we call the goroutine. See #4271 Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-15cache: do the msg copy right (#4207)Gravatar Miek Gieben 2-19/+16
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-14plugin/cache: fix removing OPT (#4190)Gravatar Miek Gieben 3-6/+9
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-09-28plugin/cache: Fix filtering (#4148)Gravatar Miek Gieben 6-162/+174
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-24For caddy v1 in our org (#4018)Gravatar Miek Gieben 2-3/+2
* For caddy v1 in our org This RP changes all imports for caddyserver/caddy to coredns/caddy. This is the v1 code of caddy. For the coredns/caddy repo the following changes have been made: * anything not needed by us is deleted * all `telemetry` stuff is deleted * all its import paths are also changed to point to coredns/caddy * the v1 branch has been moved to the master branch * a v1.1.0 tag has been added to signal the latest release Signed-off-by: Miek Gieben <miek@miek.nl> * Fix imports Signed-off-by: Miek Gieben <miek@miek.nl> * Group coredns/caddy with out plugins Signed-off-by: Miek Gieben <miek@miek.nl> * remove this file Signed-off-by: Miek Gieben <miek@miek.nl> * Relax import ordering github.com/coredns is now also a coredns dep, this makes github.com/coredns/caddy fit more natural in the list. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix final import Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-17cache: default to DNSSEC (#4085)Gravatar Miek Gieben 6-44/+204
* cache: default to DNSSEC This change does away with the DNS/DNSSEC distinction the cache currently makes. Cache will always make coredns perform a DNSSEC query and store that result. If a client just needs plain DNS, the DNSSEC records are stripped from the response. It should also be more memory efficient, because we store a reply once and not one DNS and another for DNSSEC. Fixes: #3836 Signed-off-by: Miek Gieben <miek@miek.nl> * Change OPT RR when one is present in the msg. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix comment for isDNSSEC Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin/cache/handler.go Co-authored-by: Chris O'Haver <cohaver@infoblox.com> * Update plugin/cache/item.go Co-authored-by: Chris O'Haver <cohaver@infoblox.com> * Code review; fix comment for isDNSSEC Signed-off-by: Miek Gieben <miek@miek.nl> * Update doc and set AD to false Set Authenticated Data to false when DNSSEC was not wanted. Also update the readme with the new behavior. Signed-off-by: Miek Gieben <miek@miek.nl> * Update plugin/cache/handler.go Co-authored-by: Chris O'Haver <cohaver@infoblox.com> Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
2020-07-25using promauto package to ensure all created metrics are properly registered ↵Gravatar Zou Nengren 2-14/+7
(#4025) Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-24plugin/cache/forward: Clean up grammar/wording in forward & cache metrics ↵Gravatar Chris O'Haver 2-2/+2
descriptions. (#3971) * tweak language Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * tweak language Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * typo Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-06-24completed metrics of cache and forward (#3962)Gravatar Zou Nengren 1-0/+1
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-04-03correct metrics name of cache size (#3805)Gravatar Zou Nengren 2-2/+2
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-31introduce metric naming test (#3789)Gravatar Zou Nengren 2-45/+52
* introduce metric naming test Signed-off-by: zounengren <zounengren@cmss.chinamobile.com> * Update metrics.go Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-26Fix plugin name in project README (#3683)Gravatar Chris O'Haver 1-1/+1
* Update README.md Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix readme occurances Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-03-20plugin/cache: fix negative cache masking cases (#3744)Gravatar Chris O'Haver 3-3/+107
* fix negative cache masking cases Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove unecessary param Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-02-29explain drop metric (#3706)Gravatar Chris O'Haver 1-1/+1
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-01-30presubmit: check import path ordering (#3636)Gravatar Miek Gieben 1-1/+1
Add a test for this as well as it's annoying to point out in every code review. Fix all the import paths that are flagged by this new test. Fixes: #3634 Signed-off-by: Miek Gieben <miek@miek.nl>
2020-01-03plugin/cache: update comment to conform to the implementation (#3573)Gravatar Zheng Xie 1-1/+6
Signed-off-by: zheng xie <xiez1989@gmail.com>
2020-01-03registry cache_miss logic (#3578)Gravatar Zou Nengren 1-0/+1
Signed-off-by: zouyee <zounyee1989@gmail.com>
2019-11-29Add a serve_stale option for plugin/cache (#3468)Gravatar Gonzalo Paniagua Javier 6-15/+166
Automatically submitted.
2019-11-29Move to CODEOWNERS (#3489)Gravatar Miek Gieben 1-6/+0
* Move to CODEOWNERS No change in who own what; just a move to CODEOWNERS. This allows dreck cleanups. Added .dreck.yaml for alias and exec. Fixes: #3486 Signed-off-by: Miek Gieben <miek@miek.nl> * stickler bot Signed-off-by: Miek Gieben <miek@miek.nl> * sort the file Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-08Directive -> plugin (#3363)Gravatar Miek Gieben 1-2/+2
Caught my eye, we name things directive still, esp when talking about the prometheus *plugin*. Rename everything that needs to be plugin to 'plugin'. Also make sure Metrics is a H2 section (not H1). Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-07kubernetes: brush up README, rename metric (#3360)Gravatar Miek Gieben 1-1/+1
Other latency metrics have `_duration` in the name change this metric to be in sync with the other ones. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-04Make request.Request smaller (#3351)Gravatar Miek Gieben 1-1/+1
* Make request.Request smaller This makes the request struct smaller and removes the pointer to the do boolean (tri-bool) as size == 0 will indicate if we have cached it. Family can be a int8 because it only carries 3 values, Size itself is just a uint16 under the covers. This is a more comprehensive fix than #3292 Closes #3292 Signed-off-by: Miek Gieben <miek@miek.nl> * cache: fix test this now needs a valid response writter Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-03cache: move goroutine closure to separate function to save memory (#3353)Gravatar Miek Gieben 1-20/+25
The goroutine closure was causing objects to be heap allocated. Moving it to a separate function fixes that. ```benchmark old ns/op new ns/op delta BenchmarkCacheResponse/NoPrefetch-12 773 713 -7.76% BenchmarkCacheResponse/Prefetch-12 878 837 -4.67% BenchmarkHash-12 9.17 9.18 +0.11% benchmark old allocs new allocs delta BenchmarkCacheResponse/NoPrefetch-12 9 8 -11.11% BenchmarkCacheResponse/Prefetch-12 9 8 -11.11% BenchmarkHash-12 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkCacheResponse/NoPrefetch-12 471 327 -30.57% BenchmarkCacheResponse/Prefetch-12 471 327 -30.57% BenchmarkHash-12 0 0 +0.00% ``` Signed-off-by: Charlie Vieth <charlie.vieth@gmail.com> Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-26fix mis-spelling (#3310)Gravatar xieyanker 1-1/+1
Signed-off-by: xieyanker <xjsisnice@gmail.com>
2019-09-20all: simply registering plugins (#3287)Gravatar Miek Gieben 1-6/+1
Abstract the caddy call and make it simpler. See #3261 for some part of the discussion. Go from: ~~~ go func init() { caddy.RegisterPlugin("any", caddy.Plugin{ ServerType: "dns", Action: setup, }) } ~~~ To: ~~~ go func init() { plugin.Register("any", setup) } ~~~ This requires some external documents in coredns.io to be updated as well; the old way still works, so it's backwards compatible. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-19update doc to not use the root zone for everything (#3288)Gravatar Miek Gieben 1-7/+7
Update all documentation in the tree to use example.org as an example configuration (in so far possible). As to get out of the just use "." and fallthrough and things would be fine. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-08-25fuzz: revert setup function (#3189)Gravatar Miek Gieben 1-1/+1
This can't be used in its current form; revert the entire PR. Revert "fuzzing: allow setup function to be called (#3175)" This reverts commit 62451fd3eb68cef5dcdafe6e4228f08cf52d84fc.