From: Peter van Dijk Date: Thu, 14 May 2015 14:40:02 +0000 (+0200) Subject: snap X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~58^2~21^2~5^2~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fca2e23d65bcba8cae66a73da27b23f43711d7e;p=thirdparty%2Fpdns.git snap --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 118373aa09..cca7037609 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -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<<"|"<qtype.getName() << + L << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain.toString()<<"|"<qtype.getName() << "', do = " <d_dnssecOk <<", bufsize = "<< P->getMaxReplyLen()<<": "; } diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 1be3673ba8..17f3f459e8 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -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::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(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,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; diff --git a/pdns/distributor.hh b/pdns/distributor.hh index f50e65fabf..bbc59a8802 100644 --- a/pdns/distributor.hh +++ b/pdns/distributor.hh @@ -194,7 +194,7 @@ templatevoid *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 @@ templatevoid *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 @@ templateint 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<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; diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index 542c85fa3c..14e73754b5 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -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 diff --git a/pdns/dnsproxy.cc b/pdns/dnsproxy.cc index 522b80b1f1..65a7845797 100644 --- a/pdns/dnsproxy.cc +++ b/pdns/dnsproxy.cc @@ -234,7 +234,7 @@ void DNSProxy::mainloop(void) if(p.qtype.getCode() != i->second.qtype || p.qdomain != i->second.qname) { L<second.qtype<<", "<second.qname<<")"<second.qtype<<", "<second.qname.toString()<<")"< 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<