Refactor SetRcode, rd bit is now set properly for error packets

This commit is contained in:
Alex Ciuba 2014-01-05 15:20:41 -05:00
parent ac2ee587b1
commit 848a6c7268
1 changed files with 1 additions and 8 deletions

View File

@ -49,15 +49,8 @@ func (dns *Msg) SetNotify(z string) *Msg {
// SetRcode creates an error packet suitable for the request.
func (dns *Msg) SetRcode(request *Msg, rcode int) *Msg {
dns.SetReply(request)
dns.Rcode = rcode
dns.Opcode = OpcodeQuery
dns.Response = true
dns.Id = request.Id
// Note that this is actually a FORMERR
if len(request.Question) > 0 {
dns.Question = make([]Question, 1)
dns.Question[0] = request.Question[0]
}
return dns
}