* dns: enable DNS message compression

This commit is contained in:
Simon Zolin 2019-10-23 19:31:34 +03:00
parent 15e6311c63
commit 3b443bc9c8
1 changed files with 4 additions and 1 deletions

View File

@ -432,7 +432,6 @@ func (s *Server) handleDNSRequest(p *proxy.Proxy, d *proxy.DNSContext) error {
if res.Reason == dnsfilter.ReasonRewrite && len(res.CanonName) != 0 { if res.Reason == dnsfilter.ReasonRewrite && len(res.CanonName) != 0 {
d.Req.Question[0] = originalQuestion d.Req.Question[0] = originalQuestion
d.Res.Question[0] = originalQuestion
if len(d.Res.Answer) != 0 { if len(d.Res.Answer) != 0 {
answer = append(answer, d.Res.Answer...) // host -> IP answer = append(answer, d.Res.Answer...) // host -> IP
@ -441,6 +440,10 @@ func (s *Server) handleDNSRequest(p *proxy.Proxy, d *proxy.DNSContext) error {
} }
} }
if d.Res != nil {
d.Res.Compress = true // some devices require DNS message compression
}
shouldLog := true shouldLog := true
msg := d.Req msg := d.Req