Commit graph

24 commits

Author SHA1 Message Date
Chris O'Haver
d6d8a9974b
plugin/kubernetes: fix SOA response for non-apex queries ()
* fix SOA response for non-apex queries

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

* handle mixed case

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

* do full string compare

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-04 11:05:08 +02:00
Miek Gieben
74ef6e00f1
transfer: reply with refused ()
* transfer: reply with refused

When the *transfer* plugin is not loaded and of the handlers will still
see the AXFR/IXFR request because it is not intercepted.

They need to reply with REFUSED in that case. Update file, auto and k8s
to do this. Add testcase in the file plugin.

Ideally *erratic* should be moved over as well, but maybe that's
*erratic*

This is a bug fix.

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

* import path

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-03-09 12:17:34 -08:00
Yong Tang
9798dd067f
Cherry-pick: Implement notifies for transfer plugin () ()
* Implement notifies for transfer plugin ()

* 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 

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
Yong Tang
614d08cba2
Revert "Implement notifies for transfer plugin ()" ()
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 ()
* 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 

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
Jonathan Nagy
e3266d24f7 Resolve TXT records via CNAME ()
* Add test case for TXT lookup via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Return HostType of explicit TXT records

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Adapt TXT method lookup to allow lookup via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>

* Implement lookup of TXT records via CNAME

Signed-off-by: Jonathan Nagy <nagytech@users.noreply.github.com>
2020-01-03 14:16:04 +01:00
Chris O'Haver
a64ff8cc0a fix NXDOMAIN/NODATA fallthough case () 2019-08-12 18:43:22 +00:00
Chris O'Haver
3a59c833a0 plugin/kubernetes: Don't do a zone transfer for NS requests ()
* fix switch order

* remove fallthough

* add test

* fix test

* distingush nxdomain/nodata for at least first subdomain of zone

* restore fallthough; reorder switch cases
2019-08-09 21:14:48 +00:00
Miek Gieben
53f3f0b666
Remove context.Context from request.Request ()
* Remove context.Context from request.Request

This removes the context from request.Request and makes all the changes
in the code to make it compile again. It's all mechanical. It did
unearth some weirdness in that the context was kept in handler structs
which may cause havoc with concurrently handling of requests.

Fixes 

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

* Make test compile

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-26 14:37:30 +00:00
Miek Gieben
78b26c4678 plugin/kubernetes: create dns.Msg later ()
There is no need to do this at the top of the handler, move this
down into the function.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-02-24 08:04:07 -08:00
Chris O'Haver
18f25dbef3
plugin/kubernetes: fix case preservation and add test ()
* fix case preservation and add test
* only fix case in k8s
2019-01-08 08:30:03 -05:00
Isolus
7642995558 disable ra flag for several plugins ()
* disable ra flag for several plugins

* removed unnecessary assignment

* removed more unnecessary assignments
2018-12-30 17:05:08 +01:00
Kevin Nisbet
6539a10a62 Unblock startup if kubernetes API is unavailable () 2018-10-22 09:30:08 -04:00
Miek Gieben
ba1efee4f1
Default to scrubbing replies in the server ()
Every plugin needs to deal with EDNS0 and should call Scrub to make a
message fit the client's buffer. Move this functionality into the server
and wrapping the ResponseWriter into a ScrubWriter that handles these
bits for us. Result:

Less code and faster, because multiple chained plugins could all be
calling scrub and SizeAndDo - now there is just one place.

Most tests in file/* and dnssec/* needed adjusting because in those unit
tests you don't see OPT RRs anymore. The DNSSEC signer was also looking
at the returned OPT RR to see if it needed to sign - as those are now
added by the server (and thus later), this needed to change slightly.

Scrub itself still exist (for backward compat reasons), but has been
made a noop. Scrub has been renamed to scrub as it should not be used by
external plugins.

Fixes: 

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-29 12:26:22 +01:00
Miek Gieben
6e466d5092 Remove dnsutil.Dedup ()
Remove the code and remove the call in etcd and kubernetes handlers.
This does mean we should not add dups in the first place, which means
adding maps in backend_lookup to prevent dups from begin added.

This should cut down on the allocations because dnsutil.Dedup is very
expensive by converting everything to strings, we avoid doing that now.
2018-06-11 19:23:25 -07:00
Miek Gieben
5735292406
Do Compress only when need in request.Scrub ()
* Remove Compress by default

Set Compress = true in Scrub only when the message doesn not fit the
advertized buffer. Doing compression is expensive, so try to avoid it.

Master vs this branch
pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-2   	   50000	     24774 ns/op

pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-2   	  100000	     21960 ns/op

* and make it compile
2018-05-01 21:04:06 +01:00
Miek Gieben
0930eb8beb
all: fix plugin import ordering ()
Got a bit messed up with stb lib "context" usage.
2018-04-22 08:34:35 +01:00
Miek Gieben
8722336fff
global: move to context ()
* global: move to context

Move from golang.org/x/net/context to std lib's context.

Change done with:

for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done
for i in **/*.go; do goimports -w $i; done

* drop from dns.pb.go as well
2018-04-20 11:01:06 +01:00
Chris O'Haver
71ee323651 plugin/kubernetes: Add upstream @self and loop count ()
* add upstream @self and loop count

* 1st round of feedback

* allow argless upstream

* update test

* readmes

* feedback
2018-02-14 21:11:26 +01:00
Brad Beam
6fd954f19c support for zone transfer for kubernetes ()
* plugin/kubernetes: axfr

Hook up dynamic SOA serial by setting ResourceEventHandlerFuncs in
dnsController.

Add prototype of returns msg.Services via the Transfer function. Leave
expanding this to RRs out of scope for a bit.

* plugin/kubernetes: axfr

Respond to AXFR queries

* Fixing race condition

* Fixing instantiation of dnstest writer

* Updates from review
2018-02-08 16:11:04 +00:00
Miek Gieben
c6febe6250
Add pkg/fall for Fallthrough ()
* Add pkg/fall for Fallthrough

Move this into it's own package to facilitate tests. Important bug
was fixed: make the names fully qualified.

Add fall package to hosts, reverse, etcd, and fix kubernetes and any
tests. The k8s tests are still as-is, might need a future cleanup.
2018-01-07 16:32:59 +00:00
John Belamaric
84ebbbc722
kubernetes: Add zone filtering to fallthrough ()
* Add zone filtering to fallthrough

* Doh. gofmt

* Update documentation
2018-01-06 14:52:09 -05:00
Brad Beam
850a024905 Changing switch to compare on constants versus strings () 2017-12-07 22:31:13 -06:00
Miek Gieben
d8714e64e4 Remove the word middleware ()
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00