diff options
| -rw-r--r-- | CHANGELOG.adoc | 9 | ||||
| -rw-r--r-- | lib/dns/server.go | 11 |
2 files changed, 16 insertions, 4 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index dc6d0ccb..9bcaa223 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -38,6 +38,15 @@ Legend, [#v0_61_0] == pakakeh.go v0.61.0 (2026-xx-xx) +**🌼 lib/dns: skip caching empty answer only for query type A** + +Previously, we did not store response with empty RR answer for all record +types. +Meanwhile, some domains still does not have AAAA(28) and HTTPS(65) records +set, but browser will requesting them. +So, to minimize traffic for those query we skip caching only for query type +A and cache the rest of types. + **🌼 lib/dns: remove DebugLevelDNS** The DebugLevelDNS log the error on DNS level, for example empty answer, diff --git a/lib/dns/server.go b/lib/dns/server.go index e4dcbac5..075eecb9 100644 --- a/lib/dns/server.go +++ b/lib/dns/server.go @@ -668,16 +668,19 @@ func (srv *Server) processResponse(req *request, res *Message) (an *Answer, inse err = errors.New(`response truncated`) return nil, false, err } - if res.Header.ANCount == 0 { - // Ignore empty answers. + if res.Header.ANCount == 0 && res.Question.Type == RecordTypeA { + // Ignore empty answers only for query type A (IPv4). + // // The use case if one use and switch between two different // networks with internal zone, frequently. // For example, if on network Y they have domain MY.Y and // current connection is X, request to MY.Y will return an // empty answers. // Once they connect to Y again, any request to MY.Y will not - // be possible because rescached caches contains empty answer - // for MY.Y. + // be possible because caches contains empty answer for MY.Y. + // + // Some domains that still have an empty answer for AAAA(28) + // and HTTPS(65) will get cached. err = errors.New(`empty RR answer`) return nil, false, err } |
