diff options
author | 2018-11-29 20:02:32 +0000 | |
---|---|---|
committer | 2018-11-29 20:02:32 +0000 | |
commit | 50ef7409d1d351fdd0c7cafa8f382b6e17fa3a35 (patch) | |
tree | 0b0b6f84935858c3decd8fdb5c3bd543329a940a /plugin | |
parent | 39ad7e499ee4af832fac6af89bbfaf8aba8f6323 (diff) | |
download | coredns-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>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/forward/forward.go | 3 | ||||
-rw-r--r-- | plugin/forward/lookup.go | 1 | ||||
-rw-r--r-- | plugin/forward/truncated.go | 29 |
3 files changed, 1 insertions, 32 deletions
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 -} |