Commit graph

1282 commits

Author SHA1 Message Date
Tobias Schmidt
e671e22e65 plugin/forward: Return original message on truncation (#1674)
With this change the original truncated message returned by requested
server is returned to the client, instead of returning an empty dummy
message with only the truncation bit set.
2018-04-12 20:17:05 +01:00
Miek Gieben
305ae9b9bc
plugin/forward: check TC correctly on reply. (#1670)
* plugin/forward: check TC correctly on reply.

Add test for this.

* Add proxy test as well
2018-04-11 21:18:41 +01:00
Maksim Paramonau
9ae9ee4b6b fix readme.md of log plugin (#1668) 2018-04-11 19:07:10 +01:00
Ruslan Drozhdzh
a0f294e550 plugin/forward: add query timeout (#1665) 2018-04-11 07:53:08 +01:00
Maksim Paramonau
ccfe691b95 plugin/log: allow various combinations of classes of responses (#1664)
This allows to log responses of different classes, for example, denial and error.
2018-04-11 07:50:16 +01:00
Ruslan Drozhdzh
a20b4fe2de plugin/forward: use dynamic read timeout (#1659)
- each proxy stores average RTT (round trip time) of last rttCount queries.
   For now, I assigned the value 4 to rttCount
 - the read timeout is calculated as doubled average RTT, but it cannot
   exceed default timeout
 - initial avg RTT is set to a half of default timeout, so initial timeout
   is equal to default timeout
 - the RTT for failed read is considered equal to default timeout, so any
   failed read will lead to increasing average RTT (up to default timeout)
 - dynamic timeouts will let us react faster on lost UDP packets
 - in future, we may develop a low-latency forward policy based on
   collected RTT values of proxies
2018-04-11 07:50:06 +01:00
Francois Tur
5a546f743e Plugin/Proxy - update README (#1658)
* - adding policy first in the policies description

* - fix number of policies available
2018-04-06 15:53:08 +01:00
Ruslan Drozhdzh
e46ee9d9cc plugin/forward: retry on cached tcp connection closed by peer (#1655)
* plugin/forward: retry on cached tcp connection closed by peer

* fix linter warnings

* fixed unit test

* modify error message
2018-04-06 13:41:48 +01:00
Miek Gieben
81348b420b
plugin/forward: TCP conns can be closed (#1651)
* plugin/forward: TCP conns can be closed

Only when we read and get a io.EOF we know the conn is closed (for TCP).
If this is the case Dial (again) and retry. Note that this new
connection can also be closed by the upstream, we may want to add a
DialForceNew or something to get a new TCP connection..

Simular to #1624, *but* this is by (TCP) design. We also don't have to
wait for a timeout which makes it easier to reason about.

* Move to forward.go

* doesnt need changing
2018-04-01 16:18:21 +01:00
Miek Gieben
5f98e98107
plugin/proxy: return client error (#1646)
Return the client error if there was one instead of the generic
"no healthy upstream or error"
2018-04-01 14:23:40 +01:00
Miek Gieben
2338120f5b
plugin/metrics: add MustRegister function (#1648)
This registers the Collectors iff the metrics plugin has been loaded.
Safes a bunch of code in each and every plugin's setup code.
2018-04-01 13:58:13 +01:00
Miek Gieben
4df416ca1d
Metrics (#1579)
* plugin/metrics: set server address in context

Allow cross server block metrics to co-exist; for this we should label
each metric with the server label. Put this information in the context
and provide a helper function to get it out.

Abstracting with entirely away with difficult as the release client_go
(0.8.0) doesn't have the CurryWith functions yet. So current use is like
so:

define metric, with server label:

	RcodeCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "forward",
		Name:      "response_rcode_count_total",
		Help:      "Counter of requests made per upstream.",
	}, []string{"server", "rcode", "to"})

And report ith with the helper function metrics.WithServer:

	RcodeCount.WithLabelValues(metrics.WithServer(ctx), rc, p.addr).Add(1)
2018-04-01 13:57:03 +01:00
Miek Gieben
fd1501e918
plugin/{forward,proxy}: check for truncated (#1644)
Check for trunacted in the lookup function as well and use the Match
function here as well.
2018-03-31 15:31:03 +01:00
Ruslan Drozhdzh
f19a3b24ca plugin/forward: improve tls configuration (#1643) 2018-03-30 14:35:09 +01:00
Miek Gieben
6d272e3174
plugin/forward: set the RD bit in the hc (#1639)
My routers acts funny when it sees it non RD query; make this HC as
boring as possible
2018-03-26 21:23:33 +01:00
Miek Gieben
5616fcb175
Fix dns-01-003 (#1634)
* plugin/{cache,forward,proxy}: don't allow responses that are bogus

Responses that are not matching what we've been querying for should be
dropped. They are converted into FormErrs by forward and proxy; as a 2nd
backstop cache will also not cache these.

* plug

* add explicit test
2018-03-25 17:11:10 +01:00
John Belamaric
91413c25e1 Make examples complete Corefiles (#1623) 2018-03-25 16:48:57 +01:00
Yong Tang
55824516bd
Add PTR record support for Route53 plugin (#1606)
This fix adds PTR record support for Route53 plugin

This fix fixes 1595

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-13 15:10:07 -07:00
Chris O'Haver
e5beb9dbfc Update README.md (#1607) 2018-03-13 16:33:11 -04:00
Ricardo Katz
3bb4e659b2 Document the service with ClusterIP wildcard (#1605)
This PR documents the trick exposed in coredns/coredns#1357 about using wildcards to get all POD IPs from a service with ClusterIP (as used in 'endpoints')
2018-03-13 14:35:29 +00:00
Yong Tang
3e3d8cc845 Fix incorrect test case in rout53 plugin (#1603)
While looking into route53 plugin I notice the test case
was incorrect and does not really test the reply. This
fix fixes the issue in the test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-13 07:06:50 +00:00
Chris O'Haver
0daa03a81f exclude terminating pods (#1602) 2018-03-13 07:06:03 +00:00
Miek Gieben
27f58d8dc6
logging: Don't use PrintF when not needed (#1599)
These log print don't have any verbs, so just use plain Print
2018-03-09 20:42:27 +00:00
Yamil Asusta
87790dd47c Add DD support (#1596) 2018-03-09 15:08:57 -05:00
Miek Gieben
95342dfaad
plugin/kubernetes: make glog log to standard output (#1598)
Jump through all the hoops to make this work.
2018-03-09 19:55:43 +00:00
Miek Gieben
0353abd3f8
plugin/erratic: linkify RFC references (#1593)
Also add Also See Section.
2018-03-07 13:52:32 +00:00
Miek Gieben
804f745951
plugin/health: make reload work (#1585)
* plugin/health: make reload work

Remove the once.Do from the startup, so we can re-bind the HTTP
listener. Also clarify the usage of health in multiple server blocks
(this is not the best approach - but there isn't a generic solution at
this point).

Manual tested as we lack testing infra, i.e kill -SIGUSR1 and some
CURLing of the health endpoint.

* Readme test fix

* update

* dont need this
2018-03-02 21:40:14 -08:00
Miek Gieben
acf823cd78
Metrics2 (#1588)
* plugin/metrics: still need nil check for shutdown

the second prometheus statement will trigger: (on control-C)

[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x94f45a]

goroutine 25 [running]:
github.com/coredns/coredns/plugin/metrics.(*Metrics).OnShutdown(0xc420252000, 0x0, 0x0)
	/home/miek/g/src/github.com/coredns/coredns/plugin/metrics/metrics.go:107 +0x2a
github.com/coredns/coredns/plugin/metrics.(*Metrics).OnShutdown-fm(0x0, 0x0)
	/home/miek/g/src/github.com/coredns/coredns/plugin/metrics/setup.go:39 +0x2a
github.com/mholt/caddy.(*Instance).ShutdownCallbacks(0xc4202c81e0, 0x0, 0x0, 0x0)
	/home/miek/g/src/github.com/mholt/caddy/caddy.go:164 +0xb3
github.com/mholt/caddy.allShutdownCallbacks(0x1743935, 0x8, 0x14a1b40)
	/home/miek/g/src/github.com/mholt/caddy/sigtrap.go:95 +0x10d
github.com/mholt/caddy.executeShutdownCallbacks.func1()
	/home/miek/g/src/github.com/mholt/caddy/sigtrap.go:75 +0x8f
sync.(*Once).Do(0x2256b80, 0xc42036df88)
	/home/miek/upstream/go/src/sync/once.go:44 +0xbe
github.com/mholt/caddy.executeShutdownCallbacks(0x174033f, 0x6, 0x0)
	/home/miek/g/src/github.com/mholt/caddy/sigtrap.go:71 +0x73
github.com/mholt/caddy.trapSignalsCrossPlatform.func1.1()
	/home/miek/g/src/github.com/mholt/caddy/sigtrap.go:61 +0x36
created by github.com/mholt/caddy.trapSignalsCrossPlatform.func1
	/home/miek

* comments on why
2018-03-02 18:17:05 -08:00
Miek Gieben
6cec66ce40
plugin/reload: enable (#1587)
Couldn't revert the original commit, just manually perform the needed
tweaks.
2018-03-02 17:17:26 -08:00
Miek Gieben
6f3a7af548
Metrics reload (#1586)
* wip

* plugin/metrics: fix reload behavior

Fixes #1472
2018-03-02 17:16:25 -08:00
Uladzimir Trehubenka
5546dbf3c6 Added nanoseconds to dnstap plugin builder (#1583) 2018-03-02 04:50:31 -08:00
Miek Gieben
a131c22d24
plugin/health: doc updates (#1582)
Fixes #1564
2018-03-01 18:32:15 -08:00
Miek Gieben
32671bc983 plugin/auto: update some comments typos
Just happen to see these. Fix them.
2018-03-01 17:14:53 -08:00
Miek Gieben
d67396dc7b
plugin/deprecated: add an easy way to error on deprecated plugin (#1575)
* plugin/deprecated: add an easy way to error on depcated plugin

* lint

* better docs

* slightly more docs
2018-03-01 06:49:52 -08:00
Miek Gieben
654b88d8c4
just use setup (#1574)
All these functions are namespaced by their package anyway; just use
setup().
2018-02-28 19:56:14 -08:00
Miek Gieben
4f3dc207a4
plugin/file: shutdown reload goroutine (#1571)
* plugin/file: shutdown reload goroutine

Shutdown the z.Reload() routine (if started in the first place) on
shutdow and reload.

Fixes #1508

* Must be put in c.OnShutdown()

* up test coverage
2018-02-28 18:19:37 -08:00
varyoo
6bb08ffee4 Easier way to dnstap? (#1496)
* Easier way to dnstap?

* Remove unnecessary function parameter from Tapper

* golint

* golint 2

* Proxy dnstap tests

* README.md & doc

* net.IP

* Proxy test was incorrect

* Small changes

* Update README.md

* Was not reporting dnstap errors + test

* Wasn't working at all, now it's ok

* Thanks Travis
2018-02-28 18:19:01 -08:00
Miek Gieben
f697b33283
return an error for multiple use of some plugins (#1559)
* plugins: Return error for multiple use of some

Return plugin.ErrOnce when a plugin that doesn't support it, is called
mutliple times.

This now adds it for: cache, dnssec, errors, forward, hosts, nsid.
And changes it slightly in kubernetes, pprof, reload, root.

* more tests
2018-02-28 18:16:05 -08:00
Miek Gieben
5faa9e7bc1
plugin/log: log remote port addr as well (#1573)
Log the remote's port, for IPv6 addr this means we should enclose the v6
address in brackets; make this the default for 'remote'.
2018-02-28 18:15:12 -08:00
Miek Gieben
928de738dd
Rename reverse zone constants (#1568)
Rename the constants to IP4arpa and IP6arpa (shorter and exported) and
make IsReverse return the type of the reverse zone which could be handy
for some callers.

Also add tests for IsReverse()
2018-02-28 08:43:19 -08:00
Chris O'Haver
395b614349 plugin/kubernetes: PTR/A reverse query corner cases (#1551)
* better handle non PTR rev zone qrys

* vice versa

* tests

* comment typo

* much cleaner
2018-02-28 07:53:12 -08:00
Miek Gieben
455040c143
doc: some function/vars/const/package level updates (#1558)
* doc: some function/vars/const/package level updates

Various update that stood out while reading godoc.org for CoreDNS.

* Fix some misspellings as well
2018-02-23 15:02:05 +00:00
John Belamaric
e3b7beab6a
Fix health_checks which should be health_check (#1556) 2018-02-22 18:24:21 -05:00
Miek Gieben
11c7d519d1 Add - to name and description 2018-02-22 08:55:37 +00:00
Yong Tang
e9c878a0d9 Fix with gofmt -s -w for plugin/tls/tls_test.go (#1552)
to make goreportcard happy

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-02-22 07:25:55 +00:00
Chris O'Haver
aa2302e3f4 incl addtl rrs when computing cache ttl (#1549) 2018-02-21 21:02:49 +00:00
Freddy
86be6d2532 remove coredns-grpc reference and update DnsService link (#1542) 2018-02-19 15:29:20 +00:00
Miek Gieben
05e41c5969
go 1.10: update travis and gofmt (#1541)
* go 1.10: update travis and gofmt

fmt now complains about on file tls_test.go, fix that. Also remove
gofmt, as goimports also checks, so this was done twice.

Put go 1.9 and 1.10 in travis for the time being.

* goimports optional
2018-02-18 09:43:56 +01:00
Miek Gieben
8cce06cba1
Type.extra (#1538)
* Revert "pkg/typify: empty messages are OtherError (#1531)"

This reverts commit fc1d73ffa9.

* plugin/cache: add failsafeTTL

If we can not see what TTL we should put on a message to be cached, use
5 seconds as minimal TTL. We used to apply the maximum TTL to these
  messages.
2018-02-17 19:45:52 +01:00
Chris O'Haver
9719a47c1b plugin/kubernetes: Add noendpoints option (#1536)
* add noendpoints option

* go fmt
2018-02-16 11:05:52 -05:00