From f165fd91c03c621fe9e7c0d59d3d7403399da7c9 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 21 Dec 2020 15:43:27 +0300 Subject: [PATCH] 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 Date: Mon Dec 21 15:00:46 2020 +0300 all: log changes commit e476fa5c4b8fd3896fa401f4dc546a5d937746eb Author: Eugene Burkov Date: Mon Dec 21 14:55:30 2020 +0300 dnsforward: fix dns cache ttl check --- CHANGELOG.md | 2 ++ internal/dnsforward/http.go | 3 ++- internal/dnsforward/msg.go | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e3a35c7..3fdf434a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/internal/dnsforward/http.go b/internal/dnsforward/http.go index c6c33c4e..e24ba89e 100644 --- a/internal/dnsforward/http.go +++ b/internal/dnsforward/http.go @@ -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 } diff --git a/internal/dnsforward/msg.go b/internal/dnsforward/msg.go index 3c381704..2e72c40c 100644 --- a/internal/dnsforward/msg.go +++ b/internal/dnsforward/msg.go @@ -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) }