mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-15 18:08:30 -07:00
Pull request: 3185 fix recursion vol.2
Merge in DNS/adguard-home from fix-recursion to master Closes #3185. Squashed commit of the following: commit c78650b762163f39b2eb4b10f76f1845913134b2 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon May 31 13:12:46 2021 +0300 all: fix changelog commit e43017a4b6d245f14e1a3bdf735a9c9f03501156 Author: Eugene Burkov <e.burkov@adguard.com> Date: Sun May 30 22:39:05 2021 +0300 dnsforward: reduce recursion ttl commit 79208a82bdad8280c439669413aef8dc7df0a85c Author: Eugene Burkov <e.burkov@adguard.com> Date: Sun May 30 22:29:27 2021 +0300 dnsforward: only check recursion for private rdns commit 1b8075b086f33e58e273dfcf4168a6ba0473ebae Author: Eugene Burkov <e.burkov@adguard.com> Date: Sun May 30 22:18:11 2021 +0300 dnsforward: rm recursion detecting from upstream
This commit is contained in:
parent
f3687104dd
commit
78d47d8884
@ -15,7 +15,8 @@ and this project adheres to
|
||||
|
||||
### Added
|
||||
|
||||
- Detection and handling of recurrent requests ([#3185]).
|
||||
- Detection and handling of recurrent PTR requests for locally-served addresses
|
||||
([#3185]).
|
||||
- The ability to completely disable reverse DNS resolving of IPs from
|
||||
locally-served networks ([#3184]).
|
||||
- New flag `--local-frontend` to serve dinamically changeable frontend files
|
||||
|
@ -532,7 +532,6 @@ func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) {
|
||||
}
|
||||
|
||||
// request was not filtered so let it be processed further
|
||||
s.recDetector.add(*req)
|
||||
if ctx.err = s.dnsProxy.Resolve(d); ctx.err != nil {
|
||||
return resultCodeError
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func domainNameToSuffix(tld string) (suffix string) {
|
||||
|
||||
const (
|
||||
// recursionTTL is the time recursive request is cached for.
|
||||
recursionTTL = 5 * time.Second
|
||||
recursionTTL = 1 * time.Second
|
||||
// cachedRecurrentReqNum is the maximum number of cached recurrent
|
||||
// requests.
|
||||
cachedRecurrentReqNum = 1000
|
||||
@ -265,13 +265,6 @@ func (s *Server) Exchange(ip net.IP) (host string, err error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
var resolver *proxy.Proxy = s.localResolvers
|
||||
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
|
||||
resolver = s.internalProxy
|
||||
} else if !s.conf.UsePrivateRDNS {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
arpa := dns.Fqdn(aghnet.ReverseAddr(ip))
|
||||
req := &dns.Msg{
|
||||
MsgHdr: dns.MsgHdr{
|
||||
@ -291,7 +284,16 @@ func (s *Server) Exchange(ip net.IP) (host string, err error) {
|
||||
StartTime: time.Now(),
|
||||
}
|
||||
|
||||
s.recDetector.add(*req)
|
||||
var resolver *proxy.Proxy = s.internalProxy
|
||||
if s.subnetDetector.IsLocallyServedNetwork(ip) {
|
||||
if !s.conf.UsePrivateRDNS {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
resolver = s.localResolvers
|
||||
s.recDetector.add(*req)
|
||||
}
|
||||
|
||||
if err = resolver.Resolve(ctx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type recursionDetector struct {
|
||||
ttl time.Duration
|
||||
}
|
||||
|
||||
// check checks if the passed req was already sent by s.
|
||||
// check checks if the passed req was already sent by the server.
|
||||
func (rd *recursionDetector) check(msg dns.Msg) (ok bool) {
|
||||
if len(msg.Question) == 0 {
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user