Commit graph

1250 commits

Author SHA1 Message Date
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
Bob
0835f5bb5f
[plugin][trace] - Have a consistent spanName (#4171)
Automatically submitted.
2020-10-12 19:30:55 +00:00
Miek Gieben
b3b8a7e4b7
plugin/dnstap: various cleanups (#4179)
* plugin/dnstap: various cleanups

A recent issue made me look into this plugin, I suspect various other
cleanups (hopefully deletion of code) can be made as well

Remove identical functions ToClientQuery etc, and just use tap.Message
as the base type in plugin. Keep msg/ for a few helper functions that
may proof useful.

This remove the whole test directory as we will just check the things we
are interested in which gives much better feedback and keeps that code
closer together.

tapwr dir is also not needed, writer_test.go was just duplicating the
tests already done. This moves writer.go to the top directory.

Make the only user of dnstap, the forward plugin, use the newer code
also remove the test, a better test there would be a full e2e test to
see the correct thing happens.

Cleanup the Tapper interface and move it to dnstapio where it belongs,
remove higher level interfaces that are not used. This remove
dnstap.Tapper and dnstap.IORoutines.

Use the standard mechanism for getting access to a plugin and remove
shuffling the plugin into the context.

Signed-off-by: Miek Gieben <miek@miek.nl>

* use opts to get the correct proto

Signed-off-by: Miek Gieben <miek@miek.nl>

* Various fixes

Signed-off-by: Miek Gieben <miek@miek.nl>

* Remove bad addr test, as dnstap is only called from within coredns where these fields have been preparsed

Signed-off-by: Miek Gieben <miek@miek.nl>

* dnstap: remove saving the error

all these fields have been preparsed, no need for dnstap to be pedantic
and check (and save!) this error again.

Simplifies it a bit more.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update plugin/forward/dnstap.go

Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com>

* Code review

Signed-off-by: Miek Gieben <miek@miek.nl>

* add back in preferUDP

Signed-off-by: Miek Gieben <miek@miek.nl>

* nit

Signed-off-by: Miek Gieben <miek@miek.nl>

Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com>
2020-10-12 19:10:35 +02:00
Chris O'Haver
042e57a177
fix lameduck docs (#4169)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-10-01 08:03:34 -07:00
Chris O'Haver
b1a69f70bd
dont return 200 during shutdown (#4167)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-10-01 16:13:23 +02:00
Macks
a0f7120864
plugins/auto: allow fallthrough if no zone match (#4166)
* plugins/auto: allow fallthrough if no zone match

this is a solution to #3033

Signed-off-by: Macks <macksme@outlook.com>

* plugin/auto.go remove whitespace

Signed-off-by: Macks <macksme@outlook.com>
2020-10-01 15:25:19 +02:00
Miek Gieben
0cb0136570
Add proto and remote tags to trace plugin (#4159)
* Add proto and client-ip trace tags

Signed-off-by: Adam Malcontenti-Wilson <amalcontenti-wilson@zendesk.com>

* Commit my own suggestion

Signed-off-by: Miek Gieben <miek@miek.nl>

Co-authored-by: Adam Malcontenti-Wilson <amalcontenti-wilson@zendesk.com>
2020-09-29 10:43:58 +02: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
Yong Tang
9798dd067f
Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142)
* Implement notifies for transfer plugin (#3972)

* Fix notifies in transfer plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* Make it compile

Signed-off-by: Miek Gieben <miek@miek.nl>

* Port more plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* golint

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix notifies in transfer plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* Make it compile

Signed-off-by: Miek Gieben <miek@miek.nl>

* Port more plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* golint

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* really fix test

Signed-off-by: Miek Gieben <miek@miek.nl>

* Implement ixfr fallback and unify file and auto for transfering

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add transfer tests

copied and modified from #3452

Signed-off-by: Miek Gieben <miek@miek.nl>

* Test correct selection of plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* add upstream back in

Signed-off-by: Miek Gieben <miek@miek.nl>

* Implement ixfr fallback and unify file and auto for transfering

Signed-off-by: Miek Gieben <miek@miek.nl>

* fix test

Signed-off-by: Miek Gieben <miek@miek.nl>

* properly merge

Signed-off-by: Miek Gieben <miek@miek.nl>

* Remove plugin/kubernetes/setup_transfer_test.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

Co-authored-by: Miek Gieben <miek@miek.nl>
2020-09-24 20:30:39 +02:00
Miek Gieben
b003d06003
For caddy v1 in our org (#4018)
* 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-24 18:14:41 +02:00
Miek Gieben
24e668ecf0
goreport card fixes (#4139)
This fixes some inefassign as report by Go report card:
https://goreportcard.com/report/github.com/coredns/coredns

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-22 09:22:00 +02:00
Miek Gieben
16d489851e
plugin/hosts: make hosts plugin cursive (#4131)
nit-picking PR, when using the name of the plugin make it cursive.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-18 02:39:11 -07:00
Miek Gieben
acf9a0fa19
cache: default to DNSSEC (#4085)
* 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-09-17 07:28:43 -07:00
Zou Nengren
8e1ab71720
bump prometheus with zipkin (#4109)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-09-16 11:33:08 -07:00
Ruslan Drozhdzh
f96a2f1f69
plugin/forward: fix panic when expire is configured as 0s (#4115)
Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
2020-09-15 14:36:39 +02:00
Ruslan Drozhdzh
30a4a87eaa
plugin/forward: add hit/miss metrics for connection cache (#4114)
Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
2020-09-14 11:42:55 +02:00
Miek Gieben
e082bb5a61
plugin/trace: fix struct allignment (#4112)
* plugin/trace: fix struct allignment

A 64 bit entity needs to be the first in a struct to make it work on 32
bit systems.

Fixes: #4111

Signed-off-by: Miek Gieben <miek@miek.nl>

* plugin/erratic does makes the same mistake

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-09 10:45:14 +02:00
Ruslan Drozhdzh
04af1c692c
plugin/forward: init ClientSessionCache in tls.Config (#4108)
* plugin/forward: init ClientSessionCache in tls.Config

 - ClientSessionCache may speed up a TLS handshake in upcoming connections
   to the same TLS server

Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>

* add comment

Signed-off-by: Ruslan Drozhdzh <rdrozhdzh@infoblox.com>
2020-09-08 21:36:06 +08:00
Hu Shuai
e233f59ee8
Fix some typos in comments. (#4100)
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-09-01 09:10:45 +02:00
Miek Gieben
9e4a177d9f
clouddns,route53: fix lingering goroutines after restart (#4096)
Stop the context so the refresh loop terminates on restart.

Fixes: #3815

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-08-31 06:39:01 -07:00
Olivier Lemasle
f36715e889
Enable debug globally if enabled in any server config (#4007)
* Enable debug globally if enabled in any server config

It was currently enabled only if the plugin debug
was enabled in the last server config of the Corefile.

Signed-off-by: Olivier Lemasle <o.lemasle@gmail.com>

* Add test and update debug's README

Signed-off-by: Olivier Lemasle <o.lemasle@gmail.com>
2020-08-24 09:12:00 +02:00
Zhou Hao
abeba46029
fix misspell (#4081)
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
2020-08-20 09:59:35 +02:00
Grant Garrett-Grossman
6c747d7097
Update README.md (#4068)
* Update README.md

Specify that serial must change for the zone file to be reloaded.

Signed-off-by: Grant Garrett-Grossman <grantlg2@illinois.edu>

* Update plugin/auto/README.md

Co-authored-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Grant Garrett-Grossman <grantlg2@illinois.edu>

Co-authored-by: Miek Gieben <miek@miek.nl>
2020-08-19 20:33:40 -07:00
Miek Gieben
9230e1772b
pkg/upstream: set edns0 and Do when required (#4055)
Set these options of the requests warrents them.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-08-13 09:26:30 -07:00
Miek Gieben
b9a6dba2cb
plugin/etcd: update documention (#4049)
* plugin/etcd: update documention

Make clear(er) how this plugin find records.

Fixes: #4048

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update plugin/etcd/README.md

Co-authored-by: Chris O'Haver <cohaver@infoblox.com>

* Update plugin/etcd/README.md

Co-authored-by: Chris O'Haver <cohaver@infoblox.com>

Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
2020-08-10 15:20:01 +02:00
Maxime Guyot
b3d08f9b21
plugin/template: Add client IP data (#4034)
Signed-off-by: Maxime Guyot <maxime@root314.com>
2020-08-10 10:38:18 +02:00
Miek Gieben
975305732e
backend: fix root zone usage (#4039)
properly concatenate labels by using dnsutil.Join instead of '+'

Fixes: #3316

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-07-31 10:58:09 +02:00
Yong Tang
f23171af5f
Fix wildcard records issue in rout53 plugin (#4038)
* Fix wildcard records issue in rout53 plugin

This PR tries to address 4035 where wild card records does not return
correctly in route53 plugin. The issue was that `strings.Index(s, substr string)`
expect substr to be a string but the code defines as char.

This PR fixes 4035.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix failed tests

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-31 07:51:14 +02:00
Zou Nengren
4166dcc2fe
using promauto package to ensure all created metrics are properly registered (#4025)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-25 08:06:28 -07:00
Chris O'Haver
05751bdb59
register HealthcheckBrokenCount (#4021)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-07-24 08:28:18 -04:00
Oleg Atamanenko
c86be3428a
Disable debug mode for tracing - removes extra logging (#4016)
Signed-off-by: Oleg Atamanenko <oleg.atamanenko@gmail.com>
2020-07-23 09:40:17 +02:00
Ricardo Katz
3ebb46320a
Improve gRPC Plugin when backend is not available (#3966)
* Improve gRPC Plugin when backend is not available

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>

* Improve gRPC Plugin when backend is not available

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
2020-07-15 19:59:45 +02:00
Zou Nengren
20c4f28a5c
remove TestProxyClose (#4005)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-13 08:26:43 -07:00
Yong Tang
614d08cba2
Revert "Implement notifies for transfer plugin (#3972)" (#3995)
This reverts commit 68f1dd5ddf.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-08 09:00:26 -07:00
Miek Gieben
68f1dd5ddf
Implement notifies for transfer plugin (#3972)
* Fix notifies in transfer plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* Make it compile

Signed-off-by: Miek Gieben <miek@miek.nl>

* Port more plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* golint

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix notifies in transfer plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* Make it compile

Signed-off-by: Miek Gieben <miek@miek.nl>

* Port more plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* golint

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests

Signed-off-by: Miek Gieben <miek@miek.nl>

* really fix test

Signed-off-by: Miek Gieben <miek@miek.nl>

* Implement ixfr fallback and unify file and auto for transfering

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add transfer tests

copied and modified from #3452

Signed-off-by: Miek Gieben <miek@miek.nl>

* Test correct selection of plugin

Signed-off-by: Miek Gieben <miek@miek.nl>

* add upstream back in

Signed-off-by: Miek Gieben <miek@miek.nl>

* Implement ixfr fallback and unify file and auto for transfering

Signed-off-by: Miek Gieben <miek@miek.nl>

* fix test

Signed-off-by: Miek Gieben <miek@miek.nl>

* properly merge

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-07-07 12:38:07 -07:00
Zou Nengren
41f9142dd2
complete nsid plugin test case (#3981)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-01 10:17:26 +02:00
Zou Nengren
5437370734
complete transfer plugin test case (#3967)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-29 12:02:56 -07:00
Chris O'Haver
47d6e86f58
plugin/cache/forward: Clean up grammar/wording in forward & cache metrics 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-24 07:49:42 -07:00
Miek Gieben
55e9c2cd7b
plugin/forward: remove exp backoff stuff (#3970)
we hc every 0.5s, doing exp backoff will create a large gap in the
ability to re-use an upstream. Doing a exp. backoff up to (say) 3s,
isn't really exp backoff either.

Remove the wording from the documentation.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-06-24 07:49:06 -07:00
Zou Nengren
8647592786
format and add newline (#3969)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-24 07:48:39 -07:00
Zou Nengren
73e927d6a8
completed metrics of cache and forward (#3962)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-24 06:54:03 +02:00
Zou Nengren
55a33aa9d2
add test case of remote ip (#3964)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-23 14:37:00 -07:00
Ben Kochie
7504b410f3
Update dns64 plugin bugs list (#3955)
Remove the "Follow CNAMEs" bug, CNAME following is handled by the
forward plugin.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-20 07:01:35 -07:00
Chris O'Haver
d902e85919
plugin/kubernetes: fix tombstone unwrapping (#3924)
* fix tombstone unwrapping

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-06-15 10:15:41 -04:00
Yang Bo
4734c0db45
weight for SRV records should be at least 1 (#3931)
Automatically submitted.
2020-06-12 06:01:28 +00:00
Daisuke TASAKI
f3e6575654
plugin/azure: Fix environment option (#3922)
* environment option overwrites a client secret

Signed-off-by: Daisuke TASAKI <tasaki@i3-systems.com>
2020-06-04 15:30:11 +02:00
Michael Kashin
2e3ef77731
k8s_external can now resolve CNAME returned by AWS ELB/NLB (#3916)
Automatically submitted.
2020-05-29 17:04:23 +00:00
Chris O'Haver
54fb2112ac
plugin/forward/grpc: Revert forward/grpc policy dedup (#3919)
* revert de-dup

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* unit test

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* use roundrobin policy in test

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-29 18:30:26 +02:00
Chris O'Haver
a3aeb3d503
plugin/kubernetes: handle tombstones in default processor (#3890)
* handle deletion tombstones in default processor

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* fix terminating pod exclusion

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-15 09:47:29 -07:00
Chris O'Haver
bb7ee5010e
plugin/kubernetes: Handle endpoint tombstones (#3887)
* check for nil

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* handle tombstone

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* move casting to caller. add comments.

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* more sanding

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* more scrubbing

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* move object unwraping to switch cases

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* oops remove debug

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* remove cruft

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-14 12:39:40 -07:00