dns64: preserve cnames in translated response (#2129)
* dns64: preserve cnames in translated response * dns64: rename synthAAAAs to synth64
This commit is contained in:
parent
72a602577a
commit
7177a0ec74
|
@ -121,10 +121,12 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
|||
}
|
||||
}
|
||||
|
||||
synthAAAAs := make([]dns.RR, 0)
|
||||
synth64 := make([]dns.RR, 0)
|
||||
for _, answer := range resp.Answer {
|
||||
header := answer.Header()
|
||||
if header.Rrtype == dns.TypeA {
|
||||
if header.Rrtype == dns.TypeCNAME {
|
||||
synth64 = append(synth64, answer)
|
||||
} else if header.Rrtype == dns.TypeA {
|
||||
ttl := initialTTL
|
||||
if ttl > header.Ttl {
|
||||
ttl = header.Ttl
|
||||
|
@ -143,7 +145,7 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
|||
Ttl: ttl,
|
||||
}
|
||||
synthAAAA.AAAA = ipv6
|
||||
synthAAAAs = append(synthAAAAs, synthAAAA)
|
||||
synth64 = append(synth64, synthAAAA)
|
||||
}
|
||||
plugin.pref64Mutex.RUnlock()
|
||||
}
|
||||
|
@ -151,7 +153,7 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
|||
}
|
||||
|
||||
synth := EmptyResponseFromMessage(msg)
|
||||
synth.Answer = append(synth.Answer, synthAAAAs...)
|
||||
synth.Answer = append(synth.Answer, synth64...)
|
||||
|
||||
pluginsState.synthResponse = synth
|
||||
pluginsState.action = PluginsActionSynth
|
||||
|
|
Loading…
Reference in New Issue