From: bert hubert Date: Tue, 18 Mar 2014 10:23:43 +0000 (+0100) Subject: little cleanup of dnsscope, plus also count non-RA answers. X-Git-Tag: rec-3.6.0-rc1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa7c37fe2750865a2ade6bcaa4c0f046e8691c3d;p=thirdparty%2Fpdns.git little cleanup of dnsscope, plus also count non-RA answers. --- diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index ce31be2218..8680cf8b62 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -125,8 +125,8 @@ try typedef map cumul_t; cumul_t cumul; unsigned int untracked=0, errorresult=0, reallylate=0, nonRDQueries=0, queries=0; - unsigned int ipv4Packets=0, ipv6Packets=0, fragmented=0; - unsigned int questions=0, answers=0; + unsigned int ipv4Packets=0, ipv6Packets=0, fragmented=0, rdNonRAAnswers=0; + unsigned int answers=0; typedef map rcodes_t; rcodes_t rcodes; @@ -162,7 +162,7 @@ try if(pr.d_pheader.ts.tv_sec != lastsec) { LiveCounts lc; if(lastsec) { - lc.questions = questions; + lc.questions = queries; lc.answers = answers; lc.outstanding = liveQuestions(); @@ -174,12 +174,6 @@ try lastcounts = lc; } - if(!mdp.d_header.qr) { - if(!mdp.d_header.rd) - nonRDQueries++; - queries++; - } - lowestTime=min((time_t)lowestTime, (time_t)pr.d_pheader.ts.tv_sec); highestTime=max((time_t)highestTime, (time_t)pr.d_pheader.ts.tv_sec); @@ -188,15 +182,22 @@ try QuestionIdentifier qi=QuestionIdentifier::create(pr.getSource(), pr.getDest(), mdp); if(!mdp.d_header.qr) { // question + if(!mdp.d_header.rd) + nonRDQueries++; + queries++; + QuestionData& qd=statmap[qi]; if(!qd.d_firstquestiontime.tv_sec) qd.d_firstquestiontime=pr.d_pheader.ts; qd.d_qcount++; - questions++; } else { // NO ERROR or NXDOMAIN + if(mdp.d_header.rd && !mdp.d_header.ra) { + rdNonRAAnswers++; + } answers++; + QuestionData& qd=statmap[qi]; if(!qd.d_qcount) @@ -260,6 +261,7 @@ try } cout<< boost::format("%d (%.02f%% of all) queries did not request recursion") % nonRDQueries % ((nonRDQueries*100.0)/queries) << endl; + cout<< rdNonRAAnswers << " answers had recursion desired bit set, but recursion available=0"<