From: Pieter Lexis Date: Wed, 20 Feb 2019 15:59:28 +0000 (+0100) Subject: Hook up DNSName, QType ringbuffers to the auth X-Git-Tag: dnsdist-1.4.0-alpha1~46^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb029b8efe0217b39c5cf34235b565b4c8d6e95e;p=thirdparty%2Fpdns.git Hook up DNSName, QType ringbuffers to the auth --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index ccdfbe8b25..83482df6d4 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -335,11 +335,11 @@ void declareStats(void) S.declare("latency","Average number of microseconds needed to answer a question", getLatency); S.declare("timedout-packets","Number of packets which weren't answered within timeout set"); S.declare("security-status", "Security status based on regular polling"); - S.declareRing("queries","UDP Queries Received"); - S.declareRing("nxdomain-queries","Queries for non-existent records within existent domains"); - S.declareRing("noerror-queries","Queries for existing records, but for type we don't have"); - S.declareRing("servfail-queries","Queries that could not be answered due to backend errors"); - S.declareRing("unauth-queries","Queries for domains that we are not authoritative for"); + S.declareDNSNameQTypeRing("queries","UDP Queries Received"); + S.declareDNSNameQTypeRing("nxdomain-queries","Queries for non-existent records within existent domains"); + S.declareDNSNameQTypeRing("noerror-queries","Queries for existing records, but for type we don't have"); + S.declareDNSNameQTypeRing("servfail-queries","Queries that could not be answered due to backend errors"); + S.declareDNSNameQTypeRing("unauth-queries","Queries for domains that we are not authoritative for"); S.declareRing("logmessages","Log Messages"); S.declareComboRing("remotes","Remote server IP addresses"); S.declareComboRing("remotes-unauth","Remote hosts querying domains for which we are not auth"); @@ -421,7 +421,7 @@ try if(P->d.qr) continue; - S.ringAccount("queries", P->qdomain.toLogString()+"/"+P->qtype.getName()); + S.ringAccount("queries", P->qdomain, P->qtype); S.ringAccount("remotes",P->d_remote); if(logDNSQueries) { string remote; diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 72888474af..e7189ece00 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1003,7 +1003,7 @@ void PacketHandler::makeNOError(DNSPacket* p, DNSPacket* r, const DNSName& targe if(d_dk.isSecuredZone(sd.qname)) addNSECX(p, r, target, wildcard, sd.qname, mode); - S.ringAccount("noerror-queries",p->qdomain.toLogString()+"/"+p->qtype.getName()); + S.ringAccount("noerror-queries", p->qdomain, p->qtype); } @@ -1561,7 +1561,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p) r=p->replyPacket(); // generate an empty reply packet r->setRcode(RCode::ServFail); S.inc("servfail-packets"); - S.ringAccount("servfail-queries",p->qdomain.toLogString()); + S.ringAccount("servfail-queries", p->qdomain, p->qtype); } catch(PDNSException &e) { g_log<replyPacket(); // generate an empty reply packet r->setRcode(RCode::ServFail); S.inc("servfail-packets"); - S.ringAccount("servfail-queries",p->qdomain.toLogString()); + S.ringAccount("servfail-queries", p->qdomain, p->qtype); } return r; diff --git a/pdns/responsestats-auth.cc b/pdns/responsestats-auth.cc index 6187180efe..dbc143c2b7 100644 --- a/pdns/responsestats-auth.cc +++ b/pdns/responsestats-auth.cc @@ -24,9 +24,9 @@ void ResponseStats::submitResponse(DNSPacket &p, bool udpOrTCP) { if(p.d.aa) { if (p.d.rcode==RCode::NXDomain) - S.ringAccount("nxdomain-queries",p.qdomain.toLogString()+"/"+p.qtype.getName()); + S.ringAccount("nxdomain-queries", p.qdomain, p.qtype); } else if (p.d.rcode == RCode::Refused) { - S.ringAccount("unauth-queries",p.qdomain.toLogString()+"/"+p.qtype.getName()); + S.ringAccount("unauth-queries", p.qdomain, p.qtype); S.ringAccount("remotes-unauth",p.d_remote); } diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 8d75ed1c74..783effea40 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -282,9 +282,10 @@ void AuthWebServer::indexfunction(HttpRequest* req, HttpResponse* resp) ret<<"Total queries: "<
"<getvars["ring"].empty()) { - vectorentries=S.listRings(); - for(vector::const_iterator i=entries.begin();i!=entries.end();++i) - printtable(ret,*i,S.getRingTitle(*i)); + auto entries = S.listRings(); + for(const auto &i: entries) { + printtable(ret, i, S.getRingTitle(i)); + } printvars(ret); if(arg().mustDo("webserver-print-arguments"))