Pull request 1877: 5913-fix-safesearch-ipv6
Updates #5913. Squashed commit of the following: commit a0ab1320ea22dc1b4e2804ef2d14e0091daa6a1e Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Jun 19 15:23:44 2023 +0300 all: fmt; typo commit 3a2e561c535bbbd2b2eeeaa1a6f423bc123b1a6b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Jun 19 15:16:28 2023 +0300 all: fix safesearch for ipv6
This commit is contained in:
@@ -57,16 +57,13 @@ func (s *Server) genDNSFilterMessage(
|
||||
return s.genBlockedHost(req, s.conf.SafeBrowsingBlockHost, dctx)
|
||||
case filtering.FilteredParental:
|
||||
return s.genBlockedHost(req, s.conf.ParentalBlockHost, dctx)
|
||||
case filtering.FilteredSafeSearch:
|
||||
// If Safe Search generated the necessary IP addresses, use them.
|
||||
// Otherwise, if there were no errors, there are no addresses for the
|
||||
// requested IP version, so produce a NODATA response.
|
||||
return s.genResponseWithIPs(req, ipsFromRules(res.Rules))
|
||||
default:
|
||||
// If the query was filtered by Safe Search, filtering also must return
|
||||
// the IP addresses that must be used in response. Return them
|
||||
// regardless of the filtering method.
|
||||
ips := ipsFromRules(res.Rules)
|
||||
if res.Reason == filtering.FilteredSafeSearch && len(ips) > 0 {
|
||||
return s.genResponseWithIPs(req, ips)
|
||||
}
|
||||
|
||||
return s.genForBlockingMode(req, ips)
|
||||
return s.genForBlockingMode(req, ipsFromRules(res.Rules))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user