]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Extract ECS even w/o gettag. Wake worker when exiting. 3640/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 30 Mar 2016 16:12:03 +0000 (18:12 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 30 Mar 2016 16:12:03 +0000 (18:12 +0200)
pdns/pdns_recursor.cc
pdns/remote_logger.cc

index 704074ec4af132bb178e05c97ffa7a695a18b14d..006e1c30f8d6a37b64ec0c33306d30a08a3f0577 100644 (file)
@@ -1327,6 +1327,10 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr
   string response;
   const struct dnsheader* dh = (struct dnsheader*)question.c_str();
   unsigned int ctag=0;
+  bool needECS = false;
+#ifdef HAVE_PROTOBUF
+  needECS = true;
+#endif
   Netmask ednssubnet;
   try {
     uint32_t age;
@@ -1341,27 +1345,28 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr
     g_mtracer->clearAllocators();
     */
 #endif
-    if(t_pdl->get() && (*t_pdl)->d_gettag) {
 
+    if(needECS || (t_pdl->get() && (*t_pdl)->d_gettag)) {
       uint16_t qtype=0;
       try {
         DNSName qname;
-        
         getQNameAndSubnet(question, &qname, &qtype, &ednssubnet);
-       
-        try {
-          ctag=(*t_pdl)->gettag(fromaddr, ednssubnet, destaddr, qname, qtype);
-        }
-        catch(std::exception& e)  {
-          if(g_logCommonErrors)
-            L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
+
+        if(t_pdl->get() && (*t_pdl)->d_gettag) {
+          try {
+            ctag=(*t_pdl)->gettag(fromaddr, ednssubnet, destaddr, qname, qtype);
+          }
+          catch(std::exception& e)  {
+            if(g_logCommonErrors)
+              L<<Logger::Warning<<"Error parsing a query packet qname='"<<qname<<"' for tag determination, setting tag=0: "<<e.what()<<endl;
+          }
         }
       }
       catch(std::exception& e)
       {
         if(g_logCommonErrors)
           L<<Logger::Warning<<"Error parsing a query packet for tag determination, setting tag=0: "<<e.what()<<endl;
-      } 
+      }
     }
 
     if(!SyncRes::s_nopacketcache && t_packetCache->getResponsePacket(ctag, question, g_now.tv_sec, &response, &age)) {
index 4a237e98a3350e50c9d39ade2443c81bd6de34f9..a71018f64eeec7d44f803178832f8e846759fd74 100644 (file)
@@ -97,6 +97,7 @@ RemoteLogger::~RemoteLogger()
   d_exiting = true;
   if (d_socket >= 0)
     close(d_socket);
+  d_queueCond.notify_one();
   d_thread.join();
 }