]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add counter for ignored packets to recursor statistics (+docs). 2888/head
authorAndreas Jakum <aj-gh@users.noreply.github.com>
Fri, 13 Nov 2015 15:04:38 +0000 (16:04 +0100)
committerAndreas Jakum <aj-gh@users.noreply.github.com>
Tue, 8 Dec 2015 20:57:53 +0000 (21:57 +0100)
Turns out recursor can be kept rather busy dealing with packets that will not show up anywhere.

docs/markdown/recursor/stats.md
pdns/pdns_recursor.cc
pdns/rec_channel_rec.cc
pdns/syncres.hh

index 88182b2c2dec3ba51fe98187029193e51a87d101..cef77567bce664e106fab47b72668755eade7bb2 100644 (file)
@@ -30,6 +30,7 @@ The `rec_control get` command can be used to query the following statistics, eit
 * `edns-ping-matches`: number of servers that sent a valid EDNS PING response
 * `edns-ping-mismatches`: number of servers that sent an invalid EDNS PING response
 * `failed-host-entries`: number of servers that failed to resolve
+* `ignored-packets`: counts the number of non-query packets received on server sockets that should only get query packets
 * `ipv6-outqueries`: number of outgoing queries over IPv6
 * `ipv6-questions`: counts all end-user initiated queries with the RD bit set, received over IPv6 UDP
 * `malloc-bytes`: returns the number of bytes allocated by the process (broken, always returns 0)
index d0e9c97400cf6bdcbceb9f2b9040c9dbcf1b381f..3039229f2e680df3ba84fc82038f35b31d569eb5 100644 (file)
@@ -1040,11 +1040,13 @@ void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       dc->setRemote(&conn->d_remote);
       if(dc->d_mdp.d_header.qr) {
         delete dc;
+        g_stats.ignoredCount++;
         L<<Logger::Error<<"Ignoring answer from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl;
         return;
       }
       if(dc->d_mdp.d_header.opcode) {
         delete dc;
+        g_stats.ignoredCount++;
         L<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< conn->d_remote.toString() <<" on server socket!"<<endl;
         return;
       }
@@ -1229,10 +1231,12 @@ void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       dnsheader* dh=(dnsheader*)data;
 
       if(dh->qr) {
+        g_stats.ignoredCount++;
         if(g_logCommonErrors)
           L<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl;
       }
       else if(dh->opcode) {
+        g_stats.ignoredCount++;
         if(g_logCommonErrors)
           L<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl;
       }
index 845edcbbe7828d0f5d878846b3447169368e454e..e2050f1315cbf8b70b9b11b0b9654edefda0288a 100644 (file)
@@ -571,6 +571,7 @@ RecursorControlParser::RecursorControlParser()
   addGetStat("policy-drops", &g_stats.policyDrops);
   addGetStat("no-packet-error", &g_stats.noPacketError);
   addGetStat("dlg-only-drops", &SyncRes::s_nodelegated);
+  addGetStat("ignored-packets", &g_stats.ignoredCount);
   addGetStat("max-mthread-stack", &g_stats.maxMThreadStackUsage);
   
   addGetStat("negcache-entries", boost::bind(getNegCacheSize));
index 148b6d86e7959407e7e8ae3978a843691ca828dc..16602965de33f569ba21f59f8b086a4c67e9bafb 100644 (file)
@@ -593,6 +593,7 @@ struct RecursorStats
   uint64_t noPingOutQueries, noEdnsOutQueries;
   uint64_t packetCacheHits;
   uint64_t noPacketError;
+  uint64_t ignoredCount;
   time_t startupTime;
   unsigned int maxMThreadStackUsage;
 };