]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
snap
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 14 May 2015 14:40:02 +0000 (16:40 +0200)
committermind04 <mind04@monshouwer.org>
Mon, 29 Jun 2015 18:40:15 +0000 (20:40 +0200)
pdns/common_startup.cc
pdns/communicator.hh
pdns/distributor.hh
pdns/dnsname.hh
pdns/dnsproxy.cc
pdns/dnsproxy.hh
pdns/mastercommunicator.cc

index 118373aa0999f87bcaf98286014dd23601a9a32f..cca7037609f9b374d68b102e81ac77035ac7187f 100644 (file)
@@ -369,7 +369,7 @@ void *qthread(void *number)
      if(P->d.qr)
        continue;
 
-    S.ringAccount("queries", P->qdomain+"/"+P->qtype.getName());
+    S.ringAccount("queries", P->qdomain.toString()+"/"+P->qtype.getName());
     S.ringAccount("remotes",P->d_remote);
     if(logDNSQueries) {
       string remote;
@@ -377,7 +377,7 @@ void *qthread(void *number)
         remote = P->getRemote() + "<-" + P->getRealRemote().toString();
       else
         remote = P->getRemote();
-      L << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain<<"|"<<P->qtype.getName() << 
+      L << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain.toString()<<"|"<<P->qtype.getName() << 
             "', do = " <<P->d_dnssecOk <<", bufsize = "<< P->getMaxReplyLen()<<": ";
     }
 
index 1be3673ba8b70034cdcbbdefe9e6ae5953c99332..17f3f459e86afa3c51a62cbe25e26f4558e54cea 100644 (file)
@@ -44,7 +44,7 @@ using namespace boost::multi_index;
 
 struct SuckRequest
 {
-  string domain;
+  DNSName domain;
   string master;
   bool operator<(const SuckRequest& b) const
   {
@@ -66,7 +66,7 @@ typedef UniQueue::index<IDTag>::type domains_by_name_t;
 class NotificationQueue
 {
 public:
-  void add(const string &domain, const string &ip)
+  void add(const DNSName &domain, const string &ip)
   {
     const ComboAddress caIp(ip);
 
@@ -80,7 +80,7 @@ public:
     d_nqueue.push_back(nr);
   }
 
-  bool removeIf(const string &remote, uint16_t id, const string &domain)
+  bool removeIf(const string &remote, uint16_t id, const DNSName &domain)
   {
     ServiceTuple stRemote, stQueued;
     parseService(remote, stRemote);
@@ -95,7 +95,7 @@ public:
     return false;
   }
 
-  bool getOne(string &domain, string &ip, uint16_t *id, bool &purged)
+  bool getOne(DNSName &domain, string &ip, uint16_t *id, bool &purged)
   {
     for(d_nqueue_t::iterator i=d_nqueue.begin();i!=d_nqueue.end();++i) 
       if(i->next <= time(0)) {
@@ -128,7 +128,7 @@ public:
 private:
   struct NotificationRequest
   {
-    string domain;
+    DNSName domain;
     string ip;
     int attempts;
     uint16_t id;
@@ -158,15 +158,15 @@ public:
   void go();
   
   
-  void drillHole(const string &domain, const string &ip);
-  bool justNotified(const string &domain, const string &ip);
-  void addSuckRequest(const string &domain, const string &master);
+  void drillHole(const DNSName &domain, const string &ip);
+  bool justNotified(const DNSName &domain, const string &ip);
+  void addSuckRequest(const DNSName &domain, const string &master);
   void addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote);
   void addTrySuperMasterRequest(DNSPacket *p);
-  void notify(const string &domain, const string &ip);
+  void notify(const DNSName &domain, const string &ip);
   void mainloop();
   void retrievalLoopThread();
-  void sendNotification(int sock, const string &domain, const ComboAddress& remote, uint16_t id);
+  void sendNotification(int sock, const DNSName &domain, const ComboAddress& remote, uint16_t id);
 
   static void *launchhelper(void *p)
   {
@@ -178,15 +178,15 @@ public:
     static_cast<CommunicatorClass *>(p)->retrievalLoopThread();
     return 0;
   }
-  bool notifyDomain(const string &domain);
+  bool notifyDomain(const DNSName &domain);
 private:
   void makeNotifySockets();
-  void queueNotifyDomain(const string &domain, UeberBackend *B);
+  void queueNotifyDomain(const DNSName &domain, UeberBackend *B);
   int d_nsock4, d_nsock6;
   map<pair<string,string>,time_t>d_holes;
   pthread_mutex_t d_holelock;
   void launchRetrievalThreads();
-  void suck(const string &domain, const string &remote);
+  void suck(const DNSName &domain, const string &remote);
   void slaveRefresh(PacketHandler *P);
   void masterUpdateCheck(PacketHandler *P);
   pthread_mutex_t d_lock;
index f50e65fabfcfe62d94c5d4183a8166b231ad1625..bbc59a88023f0d59527536a38b685af7cf65822a 100644 (file)
@@ -194,7 +194,7 @@ template<class Answer, class Question, class Backend>void *MultiThreadDistributo
 
         a->setRcode(RCode::ServFail);
         S.inc("servfail-packets");
-        S.ringAccount("servfail-queries",QD->Q->qdomain);
+        S.ringAccount("servfail-queries",QD->Q->qdomain.toString());
 
        delete QD->Q;
       }
@@ -206,7 +206,7 @@ template<class Answer, class Question, class Backend>void *MultiThreadDistributo
        
         a->setRcode(RCode::ServFail);
         S.inc("servfail-packets");
-        S.ringAccount("servfail-queries",QD->Q->qdomain);
+        S.ringAccount("servfail-queries",QD->Q->qdomain.toString());
        delete QD->Q;
       }
 
@@ -238,7 +238,7 @@ template<class Answer, class Question, class Backend>int SingleThreadDistributor
     a=q->replyPacket();
     a->setRcode(RCode::ServFail);
     S.inc("servfail-packets");
-    S.ringAccount("servfail-queries",q->qdomain);
+    S.ringAccount("servfail-queries",q->qdomain.toString());
   }
   catch(...) {
     L<<Logger::Error<<"Caught unknown exception in Distributor thread "<<(unsigned long)pthread_self()<<endl;
@@ -247,7 +247,7 @@ template<class Answer, class Question, class Backend>int SingleThreadDistributor
     a=q->replyPacket();
     a->setRcode(RCode::ServFail);
     S.inc("servfail-packets");
-    S.ringAccount("servfail-queries",q->qdomain);
+    S.ringAccount("servfail-queries",q->qdomain.toString());
   }
   callback(a);
   return 0;
index 542c85fa3cd01e136a0faf8c6336a2d311dcd346..14e73754b5684d6443d2af7b4dac83a482159a71 100644 (file)
@@ -30,6 +30,8 @@ public:
   
   bool isPartOf(const DNSName& rhs) const;   //!< Are we part of the rhs name?
   bool operator==(const DNSName& rhs) const; //!< DNS-native comparison (case insensitive)
+  bool operator!=(const DNSName& other) const { return !(*this == other); }
+
   std::string toString() const;              //!< Our human-friendly, escaped, representation
   std::string toDNSString() const;           //!< Our representation in DNS native format
   void appendRawLabel(const std::string& str); //!< Append this unescaped label
index 522b80b1f185b45ce6ccd821dd976595997a4be4..65a7845797672850ebb3e6902c46f560d2968740 100644 (file)
@@ -234,7 +234,7 @@ void DNSProxy::mainloop(void)
 
         if(p.qtype.getCode() != i->second.qtype || p.qdomain != i->second.qname) {
           L<<Logger::Error<<"Discarding packet from recursor backend with id "<<(d.id^d_xor)<<
-            ", qname or qtype mismatch ("<<p.qtype.getCode()<<" v " <<i->second.qtype<<", "<<p.qdomain<<" v "<<i->second.qname<<")"<<endl;
+            ", qname or qtype mismatch ("<<p.qtype.getCode()<<" v " <<i->second.qtype<<", "<<p.qdomain.toString()<<" v "<<i->second.qname.toString()<<")"<<endl;
           continue;
         }
 
index c6eda47fac08dc4647586282ceeaa73bbcf643cf..94510d47270dddee2aea9963ab49515aa178c527 100644 (file)
@@ -79,7 +79,7 @@ private:
     ComboAddress remote;
     int outsock;
     time_t created;
-    string qname;
+    DNSName qname;
     uint16_t qtype;
     DNSPacket* complete;
     string aname;
index 3c801200752716c8c6df7cec90cb19caa82cc5b1..d1658f0086385e03671d3981acccbfcfff01bbb9 100644 (file)
@@ -43,7 +43,7 @@
 #include "namespaces.hh"
 
 
-void CommunicatorClass::queueNotifyDomain(const string &domain, UeberBackend *B)
+void CommunicatorClass::queueNotifyDomain(const DNSName &domain, UeberBackend *B)
 {
   bool hasQueuedItem=false;
   set<string> nsset, ips;
@@ -99,7 +99,7 @@ void CommunicatorClass::queueNotifyDomain(const string &domain, UeberBackend *B)
 }
 
 
-bool CommunicatorClass::notifyDomain(const string &domain)
+bool CommunicatorClass::notifyDomain(const DNSName &domain)
 {
   DomainInfo di;
   UeberBackend B;
@@ -177,12 +177,12 @@ time_t CommunicatorClass::doNotifications()
     }
 
     if(p.d.rcode)
-      L<<Logger::Warning<<"Received unsuccessful notification report for '"<<p.qdomain<<"' from "<<from.toStringWithPort()<<", error: "<<RCode::to_s(p.d.rcode)<<endl;      
+      L<<Logger::Warning<<"Received unsuccessful notification report for '"<<p.qdomain.toString()<<"' from "<<from.toStringWithPort()<<", error: "<<RCode::to_s(p.d.rcode)<<endl;      
 
     if(d_nq.removeIf(from.toStringWithPort(), p.d.id, p.qdomain))
-      L<<Logger::Warning<<"Removed from notification list: '"<<p.qdomain<<"' to "<<from.toStringWithPort()<<" "<< (p.d.rcode ? RCode::to_s(p.d.rcode) : "(was acknowledged)")<<endl;      
+      L<<Logger::Warning<<"Removed from notification list: '"<<p.qdomain.toString()<<"' to "<<from.toStringWithPort()<<" "<< (p.d.rcode ? RCode::to_s(p.d.rcode) : "(was acknowledged)")<<endl;      
     else {
-      L<<Logger::Warning<<"Received spurious notify answer for '"<<p.qdomain<<"' from "<< from.toStringWithPort()<<endl;
+      L<<Logger::Warning<<"Received spurious notify answer for '"<<p.qdomain.toString()<<"' from "<< from.toStringWithPort()<<endl;
       //d_nq.dump();
     }
   }
@@ -228,13 +228,13 @@ void CommunicatorClass::sendNotification(int sock, const string& domain, const C
   }
 }
 
-void CommunicatorClass::drillHole(const string &domain, const string &ip)
+void CommunicatorClass::drillHole(const DNSName &domain, const string &ip)
 {
   Lock l(&d_holelock);
   d_holes[make_pair(domain,ip)]=time(0);
 }
 
-bool CommunicatorClass::justNotified(const string &domain, const string &ip)
+bool CommunicatorClass::justNotified(const DNSName &domain, const string &ip)
 {
   Lock l(&d_holelock);
   if(d_holes.find(make_pair(domain,ip))==d_holes.end()) // no hole
@@ -256,7 +256,7 @@ void CommunicatorClass::makeNotifySockets()
     d_nsock6 = -1;
 }
 
-void CommunicatorClass::notify(const string &domain, const string &ip)
+void CommunicatorClass::notify(const DNSName &domain, const string &ip)
 {
   d_nq.add(domain, ip);
   d_any_sem.post();