mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
incl addtl rrs when computing cache ttl (#1549)
This commit is contained in:
committed by
Miek Gieben
parent
96aff9376a
commit
aa2302e3f4
8
plugin/cache/item.go
vendored
8
plugin/cache/item.go
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user