]> 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)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2019 14:08:18 +0000 (16:08 +0200)
This was broken since eb029b8efe0217b39c5cf34235b565b4c8d6e95e
which introduced a specific type of DNSName,qtype ring.

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

index ecc1509cd49525ca92f663e1c764e17845039642..6f99c62a6c1421788130bcfdacb070857822c892 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);
     }