void declareStats(void)
{
S.declare("udp-queries","Number of UDP queries received");
+ S.declare("udp-do-queries","Number of UDP queries received with DO bit");
S.declare("udp-answers","Number of answers sent out over UDP");
S.declare("udp4-answers","Number of IPv4 answers sent out over UDP");
- S.declare("udp4-queries","Number of IPv4UDP queries received");
+ S.declare("udp4-queries","Number of IPv4 UDP queries received");
S.declare("udp6-answers","Number of IPv6 answers sent out over UDP");
S.declare("udp6-queries","Number of IPv6 UDP queries received");
DNSPacket cached;
unsigned int &numreceived=*S.getPointer("udp-queries");
+ unsigned int &numreceiveddo=*S.getPointer("udp-do-queries");
unsigned int &numanswered=*S.getPointer("udp-answers");
unsigned int &numreceived4=*S.getPointer("udp4-queries");
else
numreceived6++;
+ if(P->d_dnssecOk)
+ numreceiveddo++;
+
if(P->d.qr)
continue;
return minttl;
}
+bool DNSPacket::isEmpty()
+{
+ return (d_rrs.empty());
+}
+
/** Must be called before attempting to access getData(). This function stuffs all resource
* records found in rrs into the data buffer. It also frees resource records queued for us.
*/
void wrapup(); // writes out queued rrs, and generates the binary packet. also shuffles. also rectifies dnsheader 'd', and copies it to the stringbuffer
void spoofQuestion(const DNSPacket *qd); //!< paste in the exact right case of the question. Useful for PacketCache
unsigned int getMinTTL(); //!< returns lowest TTL of any record in the packet
+ bool isEmpty(); //!< returns true if there are no rrs in the packet
vector<DNSResourceRecord*> getAPRecords(); //!< get a vector with DNSResourceRecords that need additional processing
vector<DNSResourceRecord*> getAnswerRecords(); //!< get a vector with DNSResourceRecords that are answers
/* Query statistics */
if(p->d.aa) {
- if (p->d.rcode == RCode::NoError)
- S.ringAccount("noerror-queries",p->qdomain+"/"+p->qtype.getName());
- else if (p->d.rcode == RCode::NXDomain)
+ if (p->d.rcode==RCode::NXDomain)
S.ringAccount("nxdomain-queries",p->qdomain+"/"+p->qtype.getName());
- } else {
+ } else if (p->isEmpty()) {
S.ringAccount("unauth-queries",p->qdomain);
S.ringAccount("remotes-unauth",p->getRemote());
}
return 0;
}
cached->spoofQuestion(p); // for correct case
+ cached->qdomain=p->qdomain;
+ cached->qtype=p->qtype;
return 1;
}
if(p->d_dnssecOk && d_dk.isSecuredZone(sd.qname))
addNSECX(p, r, target, wildcard, sd.qname, mode);
+
+ S.ringAccount("noerror-queries",p->qdomain+"/"+p->qtype.getName());
}
void TCPNameserver::sendPacket(shared_ptr<DNSPacket> p, int outsock)
{
+
+ /* Query statistics */
+ if(p->qtype.getCode()!=QType::AXFR && p->qtype.getCode()!=QType::IXFR) {
+ if(p->d.aa) {
+ if(p->d.rcode==RCode::NXDomain)
+ S.ringAccount("nxdomain-queries",p->qdomain+"/"+p->qtype.getName());
+ } else if(p->isEmpty()) {
+ S.ringAccount("unauth-queries",p->qdomain);
+ S.ringAccount("remotes-unauth",p->getRemote());
+ }
+ }
+
uint16_t len=htons(p->getString().length());
string buffer((const char*)&len, 2);
buffer.append(p->getString());