]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
teach dnsscope about EDNS and stats and report the stats, a6502 special ;-)
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 17 Mar 2015 18:55:51 +0000 (19:55 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 17 Mar 2015 18:55:51 +0000 (19:55 +0100)
pdns/dnsscope.cc

index 4b36701bb17cefdbbec54c5f2aad3a75c500b365..c007fad843f627ea8136c5803f09d65744c62f84 100644 (file)
@@ -15,6 +15,7 @@
 #include "arguments.hh"
 #include "namespaces.hh"
 #include <deque>
+#include "dnsrecords.hh"
 
 namespace po = boost::program_options;
 po::variables_map g_vm;
@@ -298,7 +299,8 @@ try
   unsigned int untracked=0, errorresult=0, reallylate=0, nonRDQueries=0, queries=0;
   unsigned int ipv4DNSPackets=0, ipv6DNSPackets=0, fragmented=0, rdNonRAAnswers=0;
   unsigned int answers=0, nonDNSIP=0, rdFilterMismatch=0;
-  
+  unsigned int dnssecOK=0, edns=0;
+  unsigned int dnssecCD=0, dnssecAD=0;
   typedef map<uint16_t,uint32_t> rcodes_t;
   rcodes_t rcodes;
   
@@ -308,14 +310,14 @@ try
   set<ComboAddress, comboCompare> requestors, recipients, rdnonra;
   typedef vector<pair<time_t, LiveCounts> > pcounts_t;
   pcounts_t pcounts;
-
+  OPTRecordContent::report();
   for(unsigned int fno=0; fno < files.size(); ++fno) {
     PcapPacketReader pr(files[fno]);
     PcapPacketWriter* pw=0;
     if(!g_vm["write-failures"].as<string>().empty())
       pw=new PcapPacketWriter(g_vm["write-failures"].as<string>(), pr);
  
-
+    EDNSOpts edo;
     while(pr.getUDPPacket()) {
 
       if((ntohs(pr.d_udp->uh_dport)==5300 || ntohs(pr.d_udp->uh_sport)==5300 ||
@@ -337,6 +339,17 @@ try
            continue;
          }
 
+         if(!mdp.d_header.qr && getEDNSOpts(mdp, &edo)) {
+           edns++;
+           if(edo.d_Z & EDNSOpts::DNSSECOK)
+             dnssecOK++;
+           if(mdp.d_header.cd)
+             dnssecCD++;
+           if(mdp.d_header.ad)
+             dnssecAD++;
+         }
+         
+
          if(pr.d_ip->ip_v == 4) 
            ++ipv4DNSPackets;
          else
@@ -471,7 +484,7 @@ try
   cout<< rdNonRAAnswers << " answers had recursion desired bit set, but recursion available=0 (for "<<rdnonra.size()<<" remotes)"<<endl;
   cout<<statmap.size()<<" queries went unanswered, of which "<< statmap.size()-unanswered<<" were answered on exact retransmit"<<endl;
   cout<<untracked<<" responses could not be matched to questions"<<endl;
-
+  cout<<edns <<" questions requested EDNS processing, do=1: "<<dnssecOK<<", ad=1: "<<dnssecAD<<", cd=1: "<<dnssecCD<<endl;
 
   if(answers) {
     cout<<(boost::format("%1% %|25t|%2%") % "Rcode" % "Count\n");