aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Tobias Schmidt <tobidt@gmail.com> 2018-01-30 22:18:44 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2018-01-30 23:18:44 +0200
commit0af9b9b16fe069f3201584d7e698efb4ebaee7fb (patch)
tree1bd7edb114bfe0bce9008d095abf931dd050da9b
parent64d7268ed6760b4a8724182418a700ae2192be85 (diff)
downloadcoredns-0af9b9b16fe069f3201584d7e698efb4ebaee7fb.tar.gz
coredns-0af9b9b16fe069f3201584d7e698efb4ebaee7fb.tar.zst
coredns-0af9b9b16fe069f3201584d7e698efb4ebaee7fb.zip
plugin/proxy: Fix unnecessary message truncation (#1477)
As plugin/proxy always returns compressed messages, it's important to set this before calling Scrub(), as some messages will be unnecessarily truncated otherwise.
-rw-r--r--plugin/proxy/dns.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/proxy/dns.go b/plugin/proxy/dns.go
index 2bebae755..bbff3ba4a 100644
--- a/plugin/proxy/dns.go
+++ b/plugin/proxy/dns.go
@@ -63,10 +63,12 @@ func (d *dnsEx) Exchange(ctx context.Context, addr string, state request.Request
if err != nil {
return nil, err
}
- // Make sure it fits in the DNS response.
- reply, _ = state.Scrub(reply)
reply.Compress = true
reply.Id = state.Req.Id
+ // When using force_tcp the upstream can send a message that is too big for
+ // the udp buffer, hence we need to truncate the message to at least make it
+ // fit the udp buffer.
+ reply, _ = state.Scrub(reply)
return reply, nil
}