diff --git a/dnscrypt-proxy/dnsutils.go b/dnscrypt-proxy/dnsutils.go index ff65689e..96bad9c9 100644 --- a/dnscrypt-proxy/dnsutils.go +++ b/dnscrypt-proxy/dnsutils.go @@ -42,7 +42,7 @@ func NormalizeName(name *[]byte) { } func getMinTTL(msg *dns.Msg, minTTL uint32, maxTTL uint32, negCacheMinTTL uint32) time.Duration { - if len(msg.Answer) <= 0 { + if msg.Rcode != dns.RcodeSuccess || len(msg.Answer) <= 0 { return time.Duration(negCacheMinTTL) * time.Second } ttl := uint32(maxTTL) diff --git a/dnscrypt-proxy/plugins.go b/dnscrypt-proxy/plugins.go index ba1b4d6a..d1c0e91a 100644 --- a/dnscrypt-proxy/plugins.go +++ b/dnscrypt-proxy/plugins.go @@ -218,8 +218,7 @@ func (plugin *PluginCacheResponse) Description() string { func (plugin *PluginCacheResponse) Eval(pluginsState *PluginsState, msg *dns.Msg) error { plugin.cachedResponses = &cachedResponses - - if msg.Rcode != dns.RcodeSuccess && msg.Rcode != dns.RcodeNXRrset { + if msg.Rcode == dns.RcodeServerFailure { return nil } cacheKey, err := computeCacheKey(pluginsState, msg)