make getRR also set the section correctly
This commit is contained in:
@ -88,6 +88,13 @@ bool DNSMessageReader::getRR(DNSSection& section, DNSName& name, DNSType& type,
|
||||
{
|
||||
if(payloadpos == payload.size())
|
||||
return false;
|
||||
if(rrpos < ntohs(dh.ancount))
|
||||
section = DNSSection::Answer;
|
||||
else if(rrpos < ntohs(dh.ancount) + ntohs(dh.nscount))
|
||||
section = DNSSection::Authority;
|
||||
else
|
||||
section = DNSSection::Additional;
|
||||
++rrpos;
|
||||
name = getName();
|
||||
type=(DNSType)getUInt16();
|
||||
/* uint16_t lclass = */ getUInt16(); // class
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
struct dnsheader dh=dnsheader{}; //!< the DNS header
|
||||
std::vector<uint8_t> payload; //!< The payload
|
||||
uint16_t payloadpos{0}; //!< Current position of processing
|
||||
uint16_t rrpos{0}; //!< Used in getRR to set section correctly
|
||||
uint16_t d_endofrecord;
|
||||
//! are we at the end of a record?
|
||||
bool eor() const { return payloadpos == d_endofrecord; }
|
||||
|
Reference in New Issue
Block a user