Pull request: fix dns cache ttl check

Merge in DNS/adguard-home from 2459-dns-ttl to master

Updates #2459.

Squashed commit of the following:

commit 27e74e30b202ab5163ebdbc2c00622099b11a1ff
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 21 15:00:46 2020 +0300

    all: log changes

commit e476fa5c4b8fd3896fa401f4dc546a5d937746eb
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 21 14:55:30 2020 +0300

    dnsforward: fix dns cache ttl check
This commit is contained in:
Eugene Burkov 2020-12-21 15:43:27 +03:00
parent 49c55e356f
commit f165fd91c0
3 changed files with 4 additions and 2 deletions

View File

@ -57,6 +57,7 @@ and this project adheres to
### Fixed
- Inability to set DNS cache TTL limits ([#2459]).
- Possible freezes on slower machines ([#2225]).
- A mitigation against records being shown in the wrong order on the query log
page ([#2293]).
@ -68,6 +69,7 @@ and this project adheres to
[#2293]: https://github.com/AdguardTeam/AdGuardHome/issues/2293
[#2345]: https://github.com/AdguardTeam/AdGuardHome/issues/2345
[#2355]: https://github.com/AdguardTeam/AdGuardHome/issues/2355
[#2459]: https://github.com/AdguardTeam/AdGuardHome/issues/2459
### Removed

View File

@ -167,11 +167,12 @@ func (req *dnsConfig) checkCacheTTL() bool {
if req.CacheMinTTL == nil && req.CacheMaxTTL == nil {
return true
}
var min, max uint32
if req.CacheMinTTL != nil {
min = *req.CacheMinTTL
}
if req.CacheMaxTTL == nil {
if req.CacheMaxTTL != nil {
max = *req.CacheMaxTTL
}

View File

@ -42,7 +42,6 @@ func (s *Server) genDNSFilterMessage(d *proxy.DNSContext, result *dnsfilter.Resu
if result.Reason == dnsfilter.FilteredSafeSearch &&
len(result.Rules) > 0 &&
result.Rules[0].IP != nil {
return s.genResponseWithIP(m, result.Rules[0].IP)
}