- DNS: filtering didn't work
This commit is contained in:
parent
06b3378fd7
commit
c16dc6cf62
|
@ -686,12 +686,12 @@ func processFilteringAfterResponse(ctx *dnsContext) int {
|
||||||
d.Res.Answer = answer
|
d.Res.Answer = answer
|
||||||
}
|
}
|
||||||
|
|
||||||
case dnsfilter.RewriteEtcHosts:
|
|
||||||
case dnsfilter.NotFilteredWhiteList:
|
case dnsfilter.NotFilteredWhiteList:
|
||||||
// nothing
|
// nothing
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if !ctx.protectionEnabled {
|
if !ctx.protectionEnabled || // filters are disabled: there's nothing to check for
|
||||||
|
!ctx.responseFromUpstream { // only check response if it's from an upstream server
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
origResp2 := d.Res
|
origResp2 := d.Res
|
||||||
|
@ -817,6 +817,10 @@ func (s *Server) updateStats(d *proxy.DNSContext, elapsed time.Duration, res dns
|
||||||
case dnsfilter.NotFilteredWhiteList:
|
case dnsfilter.NotFilteredWhiteList:
|
||||||
fallthrough
|
fallthrough
|
||||||
case dnsfilter.NotFilteredError:
|
case dnsfilter.NotFilteredError:
|
||||||
|
fallthrough
|
||||||
|
case dnsfilter.ReasonRewrite:
|
||||||
|
fallthrough
|
||||||
|
case dnsfilter.RewriteEtcHosts:
|
||||||
e.Result = stats.RNotFiltered
|
e.Result = stats.RNotFiltered
|
||||||
|
|
||||||
case dnsfilter.FilteredSafeBrowsing:
|
case dnsfilter.FilteredSafeBrowsing:
|
||||||
|
|
|
@ -225,11 +225,15 @@ func (a *AutoHosts) update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process - get the list of IP addresses for the hostname
|
// Process - get the list of IP addresses for the hostname
|
||||||
|
// Return nil if not found
|
||||||
func (a *AutoHosts) Process(host string) []net.IP {
|
func (a *AutoHosts) Process(host string) []net.IP {
|
||||||
|
var ipsCopy []net.IP
|
||||||
a.lock.Lock()
|
a.lock.Lock()
|
||||||
ips, _ := a.table[host]
|
ips, _ := a.table[host]
|
||||||
ipsCopy := make([]net.IP, len(ips))
|
if len(ips) != 0 {
|
||||||
copy(ipsCopy, ips)
|
ipsCopy = make([]net.IP, len(ips))
|
||||||
|
copy(ipsCopy, ips)
|
||||||
|
}
|
||||||
a.lock.Unlock()
|
a.lock.Unlock()
|
||||||
return ipsCopy
|
return ipsCopy
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue