* DNS: nxdomain: don't return IP address for a blocked domain

Don't return IP address for a blocked domain
 when blocking mode is "nxdomain".
This commit is contained in:
Simon Zolin
2019-12-30 18:41:51 +03:00
parent 3166607540
commit 07ebcc2bf3
4 changed files with 16 additions and 7 deletions

View File

@@ -727,10 +727,6 @@ func (s *Server) genDNSFilterMessage(d *proxy.DNSContext, result *dnsfilter.Resu
case dnsfilter.FilteredParental:
return s.genBlockedHost(m, s.conf.ParentalBlockHost, d)
default:
if result.IP != nil {
return s.genResponseWithIP(m, result.IP)
}
if s.conf.BlockingMode == "null_ip" {
switch m.Question[0].Qtype {
case dns.TypeA:
@@ -746,8 +742,14 @@ func (s *Server) genDNSFilterMessage(d *proxy.DNSContext, result *dnsfilter.Resu
case dns.TypeAAAA:
return s.genAAAARecord(m, s.conf.BlockingIPAddrv6)
}
} else if s.conf.BlockingMode == "nxdomain" {
return s.genNXDomain(m)
}
if result.IP != nil {
return s.genResponseWithIP(m, result.IP)
}
return s.genNXDomain(m)
}
}