Commit graph

7 commits

Author SHA1 Message Date
Miek Gieben
04e532b257
core: fix crash with no plugins (#4184)
* core: fix crash with no plugins

A Corefile that defines a zone without plugins crashes coredns with the
stack trace below. Change this to return a refused.

~~~ corefile
 example.org {
    whoami
    log
    cache
    debug
}

example.net {
}
~~~

Asking for anyhing in example.net does this. Add test that tests this.

~~~
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xa5e6a4]

goroutine 55 [running]:
github.com/coredns/coredns/core/dnsserver.(*Server).ServeDNS(0xc000438f60, 0x2059420, 0xc0005a4030, 0x206c0e0, 0xc000522140, 0xc0005ae000)
	/home/miek/src/github.com/coredns/coredns/core/dnsserver/server.go:247 +0x884
github.com/coredns/coredns/core/dnsserver.(*Server).ServePacket.func1(0x206dd00, 0xc00009e180, 0xc0005ae000)
	/home/miek/src/github.com/coredns/coredns/core/dnsserver/server.go:126 +0xaf
github.com/miekg/dns.HandlerFunc.ServeDNS(0xc000529270, 0x206dd00, 0xc00009e180, 0xc0005ae000)
	/home/miek/go/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:37 +0x44
github.com/miekg/dns.(*Server).serveDNS(0xc000286c60, 0xc000282400, 0x34, 0x200, 0xc00009e180)
	/home/miek/go/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:609 +0x2f7
github.com/miekg/dns.(*Server).serveUDPPacket(0xc000286c60, 0xc0003b03b4, 0xc000282400, 0x34, 0x200, 0xc00000e320, 0xc000522080)
	/home/miek/go/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:549 +0xb2
created by github.com/miekg/dns.(*Server).serveUDP
	/home/miek/go/pkg/mod/github.com/miekg/dns@v1.1.31/server.go:479 +0x292
~~~

Also fix single typo in chaos_test.go

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

* Fix naming

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-07 15:58:14 +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
Ambrose Chua
ed1f42cf56
Fix mixed indentation within tests (#3855)
Signed-off-by: Ambrose Chua <ambrose@chua.family>
2020-04-25 08:08:36 +02:00
Yong Tang
f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* Update Caddy to 1.0.1, and update import path

This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy

This fix fixes 2959

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

* Also update plugin.cfg

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

* Update and bump zplugin.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-03 09:04:47 +08:00
Miek Gieben
f3134da45e
Clean up tests logging (#1979)
* Clean up tests logging

This cleans up the travis logs so you can see the failures better.

Older tests in tests/ would call log.SetOutput(ioutil.Discard) in
a haphazard way. This add log.Discard and put an `init` function in each
package's dir (no way to do this globally). The cleanup in tests/ is
clear.

All plugins also got this init function to have some uniformity and kill
any (future) logging there in the tests as well.

There is a one-off in pkg/healthcheck because that does log.

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

* bring back original log_test.go

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

* suppress logging here as well

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-19 16:23:06 +01:00
Miek Gieben
f901b0cefa tests: CoreDNSServerAndPorts (#972)
* tests: CoreDNSServerAndPorts

Copy from kubernetes.go and renamed to fit the style, adapted almost
all callers.

This is a mechanicl change, no testdata was changed.

* typos
2017-08-24 11:35:14 +01:00
Miek Gieben
024f56682d middleware/chaos: fix version (#669)
* middleware/chaos: fix version

Move the version setting into a init function so it is done early. Then
tweak the setup code for chaos a bit to correctly pick this version up.
Add an integration test to pick this up in the toplevel test/ directory.

Fixes #667

* Update tests
2017-05-22 08:09:35 -04:00