Skip to content

Commit 7177a0e

Browse files
authored
dns64: preserve cnames in translated response (#2129)
* dns64: preserve cnames in translated response * dns64: rename synthAAAAs to synth64
1 parent 72a6025 commit 7177a0e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

dnscrypt-proxy/plugin_dns64.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
121121
}
122122
}
123123

124-
synthAAAAs := make([]dns.RR, 0)
124+
synth64 := make([]dns.RR, 0)
125125
for _, answer := range resp.Answer {
126126
header := answer.Header()
127-
if header.Rrtype == dns.TypeA {
127+
if header.Rrtype == dns.TypeCNAME {
128+
synth64 = append(synth64, answer)
129+
} else if header.Rrtype == dns.TypeA {
128130
ttl := initialTTL
129131
if ttl > header.Ttl {
130132
ttl = header.Ttl
@@ -143,15 +145,15 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
143145
Ttl: ttl,
144146
}
145147
synthAAAA.AAAA = ipv6
146-
synthAAAAs = append(synthAAAAs, synthAAAA)
148+
synth64 = append(synth64, synthAAAA)
147149
}
148150
plugin.pref64Mutex.RUnlock()
149151
}
150152
}
151153
}
152154

153155
synth := EmptyResponseFromMessage(msg)
154-
synth.Answer = append(synth.Answer, synthAAAAs...)
156+
synth.Answer = append(synth.Answer, synth64...)
155157

156158
pluginsState.synthResponse = synth
157159
pluginsState.action = PluginsActionSynth

0 commit comments

Comments
 (0)