Skip to content

Commit

Permalink
Make sure there is a question section. (#18)
Browse files Browse the repository at this point in the history
After parsing the network data, set the question section. That's the
least clients expect.

Signed-off-by: Miek Gieben <miek@miek.nl>
  • Loading branch information
miekg authored Jun 13, 2024
1 parent dbeefb4 commit 1f0f3b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ func (u *Unbound) Resolve(name string, rrtype, rrclass uint16) (*Result, error)
r.Rcode = int(res.rcode)
r.AnswerPacket = new(dns.Msg)
r.AnswerPacket.Unpack(C.GoBytes(res.answer_packet, res.answer_len)) // Should always work
// no matter what, overwrite and potentially set the question section
r.AnswerPacket.Question = []dns.Question{{Name: r.Qname, Qtype: r.Qtype, Qclass: r.Qclass}}

r.HaveData = res.havedata == 1
r.NxDomain = res.nxdomain == 1
r.Secure = res.secure == 1
Expand Down

0 comments on commit 1f0f3b2

Please sign in to comment.