-(dnsforward): fixed sigsegv when protection is disabled

Also, fixed all golint issues

 Closes: #941
This commit is contained in:
Andrey Meshkov
2019-08-20 00:55:32 +03:00
parent 91a1eb9e06
commit c82e93cfc7
6 changed files with 40 additions and 8 deletions

View File

@@ -473,7 +473,6 @@ func (s *Server) handleDNSRequest(p *proxy.Proxy, d *proxy.DNSContext) error {
}
if res.Reason == dnsfilter.ReasonRewrite && len(res.CanonName) != 0 {
d.Req.Question[0] = originalQuestion
d.Res.Question[0] = originalQuestion
@@ -520,7 +519,7 @@ func (s *Server) filterDNSRequest(d *proxy.DNSContext) (*dnsfilter.Result, error
s.RUnlock()
if !protectionEnabled {
return nil, nil
return &dnsfilter.Result{}, nil
}
if host != origHost {