diff options
author | 2018-02-21 16:02:49 -0500 | |
---|---|---|
committer | 2018-02-21 21:02:49 +0000 | |
commit | aa2302e3f44ae9c80c87d1c6597ba0a424128532 (patch) | |
tree | 8c7e0ecc77b3e594e6174038973a76fdbccf1564 /plugin | |
parent | 96aff9376a7f7aedb08b090c0e501d826bb4f109 (diff) | |
download | coredns-aa2302e3f44ae9c80c87d1c6597ba0a424128532.tar.gz coredns-aa2302e3f44ae9c80c87d1c6597ba0a424128532.tar.zst coredns-aa2302e3f44ae9c80c87d1c6597ba0a424128532.zip |
incl addtl rrs when computing cache ttl (#1549)
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cache/item.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugin/cache/item.go b/plugin/cache/item.go index 55d618a39..40dff0b65 100644 --- a/plugin/cache/item.go +++ b/plugin/cache/item.go @@ -96,12 +96,16 @@ func minMsgTTL(m *dns.Msg, mt response.Type) time.Duration { } // No data to examine, return a short ttl as a fail safe. - if len(m.Answer)+len(m.Ns) == 0 { + if len(m.Answer)+len(m.Ns)+len(m.Extra) == 0 { return failSafeTTL } minTTL := maxTTL - for _, r := range append(m.Answer, m.Ns...) { + for _, r := range append(append(m.Answer, m.Ns...), m.Extra...) { + if r.Header().Rrtype == dns.TypeOPT { + // OPT records use TTL field for extended rcode and flags + continue + } switch mt { case response.NameError, response.NoData: if r.Header().Rrtype == dns.TypeSOA { |