aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-05-08 18:36:08 +0100
committerGravatar GitHub <noreply@github.com> 2018-05-08 18:36:08 +0100
commit565e4164071778d076a48ece1698a0cf66e7548b (patch)
tree07e9bd5a7e1c8a6821149391b8000b5869595480 /plugin
parent0455febc34676b3f8de445ab042fa6de42f31235 (diff)
downloadcoredns-565e4164071778d076a48ece1698a0cf66e7548b.tar.gz
coredns-565e4164071778d076a48ece1698a0cf66e7548b.tar.zst
coredns-565e4164071778d076a48ece1698a0cf66e7548b.zip
plugin/cache: don't recheck the OPT records (#1772)
These are not stored with newItem so we don't have to check them later.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/cache/item.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugin/cache/item.go b/plugin/cache/item.go
index 27102da8a..094b8bb2e 100644
--- a/plugin/cache/item.go
+++ b/plugin/cache/item.go
@@ -32,7 +32,7 @@ func newItem(m *dns.Msg, now time.Time, d time.Duration) *item {
i.Answer = m.Answer
i.Ns = m.Ns
i.Extra = make([]dns.RR, len(m.Extra))
- // Don't copy OPT record as these are hop-by-hop.
+ // Don't copy OPT records as these are hop-by-hop.
j := 0
for _, e := range m.Extra {
if e.Header().Rrtype == dns.TypeOPT {
@@ -75,11 +75,10 @@ func (i *item) toMsg(m *dns.Msg, now time.Time) *dns.Msg {
m1.Ns[j] = dns.Copy(r)
m1.Ns[j].Header().Ttl = ttl
}
+ // newItem skips OPT records, so we can just use i.Extra as is.
for j, r := range i.Extra {
m1.Extra[j] = dns.Copy(r)
- if m1.Extra[j].Header().Rrtype != dns.TypeOPT {
- m1.Extra[j].Header().Ttl = ttl
- }
+ m1.Extra[j].Header().Ttl = ttl
}
return m1
}