aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-11-29 20:02:32 +0000
committerGravatar GitHub <noreply@github.com> 2018-11-29 20:02:32 +0000
commit50ef7409d1d351fdd0c7cafa8f382b6e17fa3a35 (patch)
tree0b0b6f84935858c3decd8fdb5c3bd543329a940a
parent39ad7e499ee4af832fac6af89bbfaf8aba8f6323 (diff)
downloadcoredns-50ef7409d1d351fdd0c7cafa8f382b6e17fa3a35.tar.gz
coredns-50ef7409d1d351fdd0c7cafa8f382b6e17fa3a35.tar.zst
coredns-50ef7409d1d351fdd0c7cafa8f382b6e17fa3a35.zip
Up to DNS version 1.1.0 (#2346)
Upgrade to new dns lib version; that saw multiple improvements; some patch releases are in the pipeline. The big thing here is the removal of ErrTruncated, so we need to deal with this slightly different in the forward plugin. It removed the entire truncated.go logic and just checks the message for .Truncated (if there is a message) and retries with tcp. Signed-off-by: Miek Gieben <miek@miek.nl>
-rw-r--r--Makefile2
-rw-r--r--plugin/forward/forward.go3
-rw-r--r--plugin/forward/lookup.go1
-rw-r--r--plugin/forward/truncated.go29
4 files changed, 2 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index d0531e60c..5efbaf8c8 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ godeps:
go get -u github.com/prometheus/client_golang/prometheus/promhttp
go get -u github.com/prometheus/client_golang/prometheus
(cd $(GOPATH)/src/github.com/mholt/caddy && git checkout -q v0.11.1)
- (cd $(GOPATH)/src/github.com/miekg/dns && git checkout -q v1.0.15)
+ (cd $(GOPATH)/src/github.com/miekg/dns && git checkout -q v1.1.0)
(cd $(GOPATH)/src/github.com/prometheus/client_golang && git checkout -q v0.8.0)
@ # for travis only, if this fails we don't care, but don't see benchmarks
go get -u golang.org/x/tools/cmd/benchcmp || true
diff --git a/plugin/forward/forward.go b/plugin/forward/forward.go
index dfa1aaca1..66526509b 100644
--- a/plugin/forward/forward.go
+++ b/plugin/forward/forward.go
@@ -116,7 +116,7 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
continue
}
// Retry with TCP if truncated and prefer_udp configured.
- if err == dns.ErrTruncated && !opts.forceTCP && f.opts.preferUDP {
+ if ret != nil && ret.Truncated && !opts.forceTCP && f.opts.preferUDP {
opts.forceTCP = true
continue
}
@@ -127,7 +127,6 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
child.Finish()
}
- ret, err = truncated(state, ret, err)
upstreamErr = err
if err != nil {
diff --git a/plugin/forward/lookup.go b/plugin/forward/lookup.go
index 855230b9a..f3eb8f34a 100644
--- a/plugin/forward/lookup.go
+++ b/plugin/forward/lookup.go
@@ -35,7 +35,6 @@ func (f *Forward) Forward(state request.Request) (*dns.Msg, error) {
ret, err := proxy.Connect(context.Background(), state, f.opts)
- ret, err = truncated(state, ret, err)
upstreamErr = err
if err != nil {
diff --git a/plugin/forward/truncated.go b/plugin/forward/truncated.go
deleted file mode 100644
index fb821d335..000000000
--- a/plugin/forward/truncated.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package forward
-
-import (
- "github.com/coredns/coredns/request"
-
- "github.com/miekg/dns"
-)
-
-// truncated looks at the error and if truncated return a nil error
-// and a possible reconstructed dns message if that was nil.
-func truncated(state request.Request, ret *dns.Msg, err error) (*dns.Msg, error) {
- // If you query for instance ANY isc.org; you get a truncated query back which miekg/dns fails to unpack
- // because the RRs are not finished. The returned message can be useful or useless. Return the original
- // query with some header bits set that they should retry with TCP.
- if err != dns.ErrTruncated {
- return ret, err
- }
-
- // We may or may not have something sensible... if not reassemble something to send to the client.
- m := ret
- if ret == nil {
- m = new(dns.Msg)
- m.SetReply(state.Req)
- m.Truncated = true
- m.Authoritative = true
- m.Rcode = dns.RcodeSuccess
- }
- return m, nil
-}