Deep copy cached responses

This commit is contained in:
Frank Denis 2021-01-03 17:37:19 +01:00
parent 3a5585f8a1
commit f9ec0a9c09
1 changed files with 3 additions and 3 deletions

View File

@ -79,20 +79,20 @@ func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error
}
cached := cachedAny.(CachedResponse)
synth := cached.msg
synth := cached.msg.Copy()
synth.Id = msg.Id
synth.Response = true
synth.Compress = true
synth.Question = msg.Question
if time.Now().After(cached.expiration) {
pluginsState.sessionData["stale"] = &synth
pluginsState.sessionData["stale"] = synth
return nil
}
updateTTL(&cached.msg, cached.expiration)
pluginsState.synthResponse = &synth
pluginsState.synthResponse = synth
pluginsState.action = PluginsActionSynth
pluginsState.cacheHit = true
return nil