dns_server.go: parseQuery: set NXDOMAIN if there's no Answer to return (#845)

This commit is contained in:
NODA Kai 2024-04-30 21:56:57 +08:00 committed by GitHub
parent df78158cfa
commit e54f9dd206
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,10 @@ func parseQuery(l *logrus.Logger, m *dns.Msg, w dns.ResponseWriter) {
} }
} }
} }
if len(m.Answer) == 0 {
m.Rcode = dns.RcodeNameError
}
} }
func handleDnsRequest(l *logrus.Logger, w dns.ResponseWriter, r *dns.Msg) { func handleDnsRequest(l *logrus.Logger, w dns.ResponseWriter, r *dns.Msg) {