SOA belongs in authority section in case of NODATA response

https://datatracker.ietf.org/doc/html/rfc2308#section-2.2
This commit is contained in:
Yannik Sembritzki 2021-06-09 13:19:12 +02:00
parent 6d6fe51d92
commit b1ed162494

3
dns.go
View File

@ -124,7 +124,8 @@ func (d *DNSServer) readQuery(m *dns.Msg) {
}
m.MsgHdr.Authoritative = authoritative
if authoritative {
if m.MsgHdr.Rcode == dns.RcodeNameError {
if m.MsgHdr.Rcode == dns.RcodeNameError ||
(m.MsgHdr.Rcode == dns.RcodeSuccess && len(m.Answer) == 0) {
m.Ns = append(m.Ns, d.SOA)
}
}