]> granicus.if.org Git - pdns/commitdiff
auth: Fix the accounting of servfail-queries in the distributor
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2019 14:08:18 +0000 (16:08 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 10 Jul 2019 19:20:50 +0000 (21:20 +0200)
This was broken since eb029b8efe0217b39c5cf34235b565b4c8d6e95e
which introduced a specific type of DNSName,qtype ring.

(cherry picked from commit 5c293d1139b0a730c7193ff956b59eb3fc109fb7)

pdns/distributor.hh
pdns/test-distributor_hh.cc

index 9efb928aff986c2abda3fb2b54f42ec040590ca9..f5b1e1e323c9d89d28ca5807e62d20208447e3ff 100644 (file)
@@ -222,7 +222,7 @@ retry:
 
           a->setRcode(RCode::ServFail);
           S.inc("servfail-packets");
-          S.ringAccount("servfail-queries",QD->Q->qdomain.toLogString());
+          S.ringAccount("servfail-queries", QD->Q->qdomain, QD->Q->qtype);
 
           delete QD->Q;
         } else {
@@ -239,7 +239,7 @@ retry:
 
           a->setRcode(RCode::ServFail);
           S.inc("servfail-packets");
-          S.ringAccount("servfail-queries",QD->Q->qdomain.toLogString());
+          S.ringAccount("servfail-queries", QD->Q->qdomain, QD->Q->qtype);
 
           delete QD->Q;
         } else {
@@ -286,7 +286,7 @@ retry:
 
       a->setRcode(RCode::ServFail);
       S.inc("servfail-packets");
-      S.ringAccount("servfail-queries",q->qdomain.toLogString());
+      S.ringAccount("servfail-queries", q->qdomain, q->qtype);
     } else {
       g_log<<Logger::Notice<<"Backend error (retry once): "<<e.reason<<endl;
       goto retry;
@@ -301,7 +301,7 @@ retry:
 
       a->setRcode(RCode::ServFail);
       S.inc("servfail-packets");
-      S.ringAccount("servfail-queries",q->qdomain.toLogString());
+      S.ringAccount("servfail-queries", q->qdomain, q->qtype);
     } else {
       g_log<<Logger::Warning<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<" (retry once)"<<endl;
       goto retry;
index f21a9b767cbfbcee3f332a18788f6449882ee349..5f12ecd33ee2d2c5136d680afb2cf0e3bf929e76 100644 (file)
@@ -17,6 +17,7 @@ struct Question
   int q;
   DTime d_dt;
   DNSName qdomain;
+  QType qtype;
   DNSPacket* replyPacket()
   {
     return new DNSPacket(false);
@@ -141,6 +142,7 @@ BOOST_AUTO_TEST_CASE(test_distributor_dies) {
       auto q = new Question();
       q->d_dt.set(); 
       q->qdomain=DNSName(std::to_string(n));
+      q->qtype = QType(QType::A);
       d->question(q, report2);
     }