Always use negative caching except on srvfail (and obviously on success)

This commit is contained in:
Frank Denis 2018-01-10 23:26:03 +01:00
parent 9cd31e27f5
commit 822ae27a46
2 changed files with 2 additions and 3 deletions

View File

@ -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)

View File

@ -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)