Skip to content

Commit

Permalink
SOA belongs in authority section in case of NODATA response
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannik committed Jul 16, 2021
1 parent 6d6fe51 commit b1ed162
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit b1ed162

Please sign in to comment.