Don't update OPT records

Fixes #527
This commit is contained in:
Frank Denis 2018-06-26 08:24:13 +02:00
parent 46823f8cc3
commit 97f604670c
1 changed files with 8 additions and 0 deletions

View File

@ -118,6 +118,10 @@ func setMaxTTL(msg *dns.Msg, ttl uint32) {
} }
} }
for _, rr := range msg.Extra { for _, rr := range msg.Extra {
header := rr.Header()
if header.Class == dns.ClassINET && header.Rrtype == dns.TypeOPT {
continue
}
if ttl < rr.Header().Ttl { if ttl < rr.Header().Ttl {
rr.Header().Ttl = ttl rr.Header().Ttl = ttl
} }
@ -134,6 +138,10 @@ func updateTTL(msg *dns.Msg, expiration time.Time) {
rr.Header().Ttl = ttl rr.Header().Ttl = ttl
} }
for _, rr := range msg.Extra { for _, rr := range msg.Extra {
header := rr.Header()
if header.Class == dns.ClassINET && header.Rrtype == dns.TypeOPT {
continue
}
rr.Header().Ttl = ttl rr.Header().Ttl = ttl
} }
} }