From 168eb01c10cfd46be03ffeda8f408b6a7ea08c28 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 17 Mar 2015 19:55:51 +0100 Subject: [PATCH] teach dnsscope about EDNS and stats and report the stats, a6502 special ;-) --- pdns/dnsscope.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index 4b36701bb..c007fad84 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -15,6 +15,7 @@ #include "arguments.hh" #include "namespaces.hh" #include +#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 rcodes_t; rcodes_t rcodes; @@ -308,14 +310,14 @@ try set requestors, recipients, rdnonra; typedef vector > 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().empty()) pw=new PcapPacketWriter(g_vm["write-failures"].as(), 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 "<