Commit 594c6d75 authored by Miek Gieben's avatar Miek Gieben Committed by Chris O'Haver

mw/federation: use original qname in all responses (#1033)

Maybe a fix for #1031 ?
parent 48806fe8
......@@ -73,12 +73,13 @@ func (f *Federation) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
if !middleware.ClientWrite(ret) {
// something went wrong
r.Question[0].Name = qname
return ret, err
}
if m := nw.Msg; m.Rcode != dns.RcodeNameError {
// If positive answer we need to substitute the orinal qname in question and answer.
r.Question[0].Name = qname
// If positive answer we need to substitute the original qname in the answer.
m.Question[0].Name = qname
for _, a := range m.Answer {
a.Header().Name = qname
}
......@@ -93,6 +94,7 @@ func (f *Federation) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.
// Still here, we've seen NXDOMAIN and need to perform federation.
service, err := f.Federations(state, label, f.f[label]) // state references Req which has updated qname
if err != nil {
r.Question[0].Name = qname
return dns.RcodeServerFailure, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment