only one question per query

This commit is contained in:
Niklas 2020-12-31 14:11:07 +01:00
parent a71b619763
commit 7f40a04638

View File

@ -278,8 +278,13 @@ func handleRequest(w dns.ResponseWriter, r *dns.Msg, zone zoneView) {
m.SetReply(r)
m.Authoritative = true
// maybe only support one question per query like most servers do it ???
for _, q := range r.Question {
// Only support one question per query because all the other server also does that
if len(r.Question) != 1 {
rcodeRequest(w, r, dns.RcodeServerFailure)
}
q := r.Question[0]
rrs := zone.rr[q.Qtype]
// Handle ANY
@ -339,7 +344,6 @@ func handleRequest(w dns.ResponseWriter, r *dns.Msg, zone zoneView) {
}
}
}
}
w.WriteMsg(m)
}