From: Kees Monshouwer Date: Tue, 30 Jun 2015 10:58:48 +0000 (+0200) Subject: Merge branch 'more-dnsname' X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~58^2~21^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b6fa0eb932c1e9cc12e746c4d6edf6571e43a29;p=thirdparty%2Fpdns.git Merge branch 'more-dnsname' --- 0b6fa0eb932c1e9cc12e746c4d6edf6571e43a29 diff --cc modules/bindbackend/bindbackend2.hh index 4fdfb72c2f,55df152a3e..b03c7d623f --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@@ -153,19 -151,20 +151,19 @@@ public //! configure how often this domain should be checked for changes (on disk) void setCheckInterval(time_t seconds); - string d_name; //!< actual name of the domain - bool d_loaded; //!< if a domain is loaded - string d_status; //!< message describing status of a domain, for human consumption - mutable bool d_checknow; //!< if this domain has been flagged for a check - time_t d_ctime; //!< last known ctime of the file on disk + DNSName d_name; //!< actual name of the domain string d_filename; //!< full absolute filename of the zone on disk - unsigned int d_id; //!< internal id of the domain - time_t d_lastcheck; //!< last time domain was checked for freshness + string d_status; //!< message describing status of a domain, for human consumption vector d_masters; //!< IP address of the master of this domain set d_also_notify; //!< IP list of hosts to also notify - + LookButDontTouch d_records; //!< the actual records belonging to this domain + time_t d_ctime; //!< last known ctime of the file on disk + time_t d_lastcheck; //!< last time domain was checked for freshness uint32_t d_lastnotified; //!< Last serial number we notified our slaves of + unsigned int d_id; //!< internal id of the domain + mutable bool d_checknow; //!< if this domain has been flagged for a check + bool d_loaded; //!< if a domain is loaded - LookButDontTouch d_records; //!< the actual records belonging to this domain private: time_t getCtime(); time_t d_checkinterval; @@@ -245,11 -244,12 +243,11 @@@ private void release(SSqlStatement**); static bool safeGetBBDomainInfo(int id, BB2DomainInfo* bbd); static void safePutBBDomainInfo(const BB2DomainInfo& bbd); - static bool safeGetBBDomainInfo(const std::string& name, BB2DomainInfo* bbd); - static bool safeRemoveBBDomainInfo(const std::string& name); + static bool safeGetBBDomainInfo(const DNSName& name, BB2DomainInfo* bbd); + static bool safeRemoveBBDomainInfo(const DNSName& name); bool GetBBDomainInfo(int id, BB2DomainInfo** bbd); shared_ptr d_dnssecdb; - bool getNSEC3PARAM(const std::string& zname, NSEC3PARAMRecordContent* ns3p); - bool d_hybrid; + bool getNSEC3PARAM(const DNSName& zname, NSEC3PARAMRecordContent* ns3p); class handle { public: @@@ -262,12 -262,13 +260,12 @@@ recordstorage_t::const_iterator d_iter, d_end_iter; recordstorage_t::const_iterator d_qname_iter; recordstorage_t::const_iterator d_qname_end; - string qname; - string domain; - - bool d_list; - int id; - + DNSName qname; + DNSName domain; + + int id; QType qtype; + bool d_list; bool mustlog; private: @@@ -278,35 -279,24 +276,35 @@@ handle(const handle &); }; - static int s_first; //!< this is raised on construction to prevent multiple instances of us being generated - static bool s_ignore_broken_records; + SSqlStatement* d_getAllDomainMetadataQuery_stmt; + SSqlStatement* d_getDomainMetadataQuery_stmt; + SSqlStatement* d_deleteDomainMetadataQuery_stmt; + SSqlStatement* d_insertDomainMetadataQuery_stmt; + SSqlStatement* d_getDomainKeysQuery_stmt; + SSqlStatement* d_deleteDomainKeyQuery_stmt; + SSqlStatement* d_insertDomainKeyQuery_stmt; + SSqlStatement* d_activateDomainKeyQuery_stmt; + SSqlStatement* d_deactivateDomainKeyQuery_stmt; + SSqlStatement* d_getTSIGKeyQuery_stmt; + SSqlStatement* d_setTSIGKeyQuery_stmt; + SSqlStatement* d_deleteTSIGKeyQuery_stmt; + SSqlStatement* d_getTSIGKeysQuery_stmt; - static string s_binddirectory; //!< this is used to store the 'directory' setting of the bind configuration + string d_transaction_tmpname; string d_logprefix; - set alsoNotify; //!< this is used to store the also-notify list of interested peers. - - BB2DomainInfo createDomainEntry(const DNSName& domain, const string &filename); //!< does not insert in s_state - - int d_transaction_id; - string d_transaction_tmpname; - ofstream *d_of; handle d_handle; + static string s_binddirectory; //!< this is used to store the 'directory' setting of the bind configuration + static int s_first; //!< this is raised on construction to prevent multiple instances of us being generated + int d_transaction_id; + static bool s_ignore_broken_records; + bool d_hybrid; + - BB2DomainInfo createDomainEntry(const string &domain, const string &filename); //!< does not insert in s_state ++ BB2DomainInfo createDomainEntry(const DNSName& domain, const string &filename); //!< does not insert in s_state void queueReloadAndStore(unsigned int id); - bool findBeforeAndAfterUnhashed(BB2DomainInfo& bbd, const std::string& qname, std::string& unhashed, std::string& before, std::string& after); + bool findBeforeAndAfterUnhashed(BB2DomainInfo& bbd, const DNSName& qname, DNSName& unhashed, string& before, string& after); void reload(); static string DLDomStatusHandler(const vector&parts, Utility::pid_t ppid); static string DLListRejectsHandler(const vector&parts, Utility::pid_t ppid); diff --cc pdns/bindparserclasses.hh index a43fee5aac,0dc424e8d9..2faced2ae4 --- a/pdns/bindparserclasses.hh +++ b/pdns/bindparserclasses.hh @@@ -90,10 -90,10 +90,10 @@@ class BindParse set & getAlsoNotify() { return this->alsoNotify; } private: string d_dir; - typedef map zonedomain_t; - bool d_verbose; + typedef map zonedomain_t; set alsoNotify; vector d_zonedomains; + bool d_verbose; }; #endif /* BINDPARSER_HH */ diff --cc pdns/communicator.hh index 8d5aef859d,e2de7b07c8..f234222a77 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@@ -128,11 -128,11 +128,11 @@@ public private: struct NotificationRequest { - string domain; + DNSName domain; string ip; + time_t next; int attempts; uint16_t id; - time_t next; }; typedef std::list d_nqueue_t; diff --cc pdns/dns.hh index 768c26992c,1fb6840b7c..2c0b763e62 --- a/pdns/dns.hh +++ b/pdns/dns.hh @@@ -37,11 -38,11 +38,11 @@@ class DNSName; // FIXM struct SOAData { - SOAData() : ttl(0), serial(0), refresh(0), retry(0), expire(0), domain_id(-1), db(0), scopeMask(0) {}; + SOAData() : ttl(0), serial(0), refresh(0), retry(0), expire(0), db(0), domain_id(-1), scopeMask(0) {}; - string qname; - string nameserver; - string hostmaster; + DNSName qname; + DNSName nameserver; + DNSName hostmaster; uint32_t ttl; uint32_t serial; uint32_t refresh; @@@ -81,25 -81,22 +82,25 @@@ public string getZoneRepresentation() const; // data - string qname; //!< the name of this record, for example: www.powerdns.com - string wildcardname; - - QType qtype; //!< qtype of this record, ie A, CNAME, MX etc - uint16_t qclass; //!< class of this record + DNSName qname; //!< the name of this record, for example: www.powerdns.com + DNSName wildcardname; string content; //!< what this record points to. Example: 10.1.2.3 + + // Aligned on 8-byte boundries on systems where time_t is 8 bytes and int + // is 4 bytes, aka modern linux on x86_64 + time_t last_modified; //!< For autocalculating SOA serial numbers - the backend needs to fill this in + uint32_t ttl; //!< Time To Live of this record uint32_t signttl; //!< If non-zero, use this TTL as original TTL in the RRSIG + int domain_id; //!< If a backend implements this, the domain_id of the zone this record is in - time_t last_modified; //!< For autocalculating SOA serial numbers - the backend needs to fill this in - enum Place {QUESTION=0, ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; //!< Type describing the positioning of a DNSResourceRecord within, say, a DNSPacket - Place d_place; //!< This specifies where a record goes within the packet + QType qtype; //!< qtype of this record, ie A, CNAME, MX etc + uint16_t qclass; //!< class of this record + Place d_place; //!< This specifies where a record goes within the packet + uint8_t scopeMask; bool auth; bool disabled; - uint8_t scopeMask; template void serialize(Archive & ar, const unsigned int version) diff --cc pdns/dnsbackend.hh index f729622bba,4dfaa25802..fdefa31bbc --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@@ -45,18 -46,15 +46,18 @@@ class DNSBackend struct DomainInfo { DomainInfo() : backend(0) {} - uint32_t id; + - string zone; + DNSName zone; - vector masters; - uint32_t notified_serial; - uint32_t serial; time_t last_check; string account; - enum DomainKind { Master, Slave, Native } kind; + vector masters; DNSBackend *backend; + + uint32_t id; + uint32_t notified_serial; + + uint32_t serial; + enum DomainKind : uint8_t { Master, Slave, Native } kind; bool operator<(const DomainInfo& rhs) const { @@@ -166,27 -164,27 +167,27 @@@ public virtual void getAllDomains(vector *domains, bool include_disabled=false) { } /** Determines if we are authoritative for a zone, and at what level */ - virtual bool getAuth(DNSPacket *p, SOAData *sd, const string &target, const int best_match_len); + virtual bool getAuth(DNSPacket *p, SOAData *sd, const DNSName &target, const int best_match_len); struct KeyData { + std::string content; unsigned int id; unsigned int flags; bool active; - std::string content; }; - virtual bool getDomainKeys(const string& name, unsigned int kind, std::vector& keys) { return false;} - virtual bool removeDomainKey(const string& name, unsigned int id) { return false; } - virtual int addDomainKey(const string& name, const KeyData& key){ return -1; } - virtual bool activateDomainKey(const string& name, unsigned int id) { return false; } - virtual bool deactivateDomainKey(const string& name, unsigned int id) { return false; } + virtual bool getDomainKeys(const DNSName& name, unsigned int kind, std::vector& keys) { return false;} + virtual bool removeDomainKey(const DNSName& name, unsigned int id) { return false; } + virtual int addDomainKey(const DNSName& name, const KeyData& key){ return -1; } + virtual bool activateDomainKey(const DNSName& name, unsigned int id) { return false; } + virtual bool deactivateDomainKey(const DNSName& name, unsigned int id) { return false; } - virtual bool getTSIGKey(const string& name, string* algorithm, string* content) { return false; } - virtual bool setTSIGKey(const string& name, const string& algorithm, const string& content) { return false; } - virtual bool deleteTSIGKey(const string& name) { return false; } + virtual bool getTSIGKey(const DNSName& name, DNSName* algorithm, string* content) { return false; } + virtual bool setTSIGKey(const DNSName& name, const DNSName& algorithm, const string& content) { return false; } + virtual bool deleteTSIGKey(const DNSName& name) { return false; } virtual bool getTSIGKeys(std::vector< struct TSIGKey > &keys) { return false; } - virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string& qname, std::string& unhashed, std::string& before, std::string& after) + virtual bool getBeforeAndAfterNamesAbsolute(uint32_t id, const string& qname, DNSName& unhashed, string& before, string& after) { std::cerr<<"Default beforeAndAfterAbsolute called!"<& getRRS() { return d_rrs; } - TSIGRecordContent d_trc; static bool s_doEDNSSubnetProcessing; - static uint16_t s_udpTruncationThreshold; + static uint16_t s_udpTruncationThreshold; //2 private: void pasteQ(const char *question, int length); //!< set the question of this packet, useful for crafting replies bool d_wrapped; // 1 - bool d_compress; // 1 - uint16_t d_qlen; // length of the question (including class & type) in this packet 2 - int d_socket; // 4 - string d_rawpacket; // this is where everything lives 4 - int d_maxreplylen; - string d_ednsping; - bool d_wantsnsid; - bool d_haveednssubnet; - bool d_haveednssection; - EDNSSubnetOpts d_eso; string d_tsigsecret; - string d_tsigkeyname; + DNSName d_tsigkeyname; string d_tsigprevious; - bool d_tsigtimersonly; - vector d_rrs; // 4 + vector d_rrs; // 8 + string d_rawpacket; // this is where everything lives 8 + string d_ednsping; + EDNSSubnetOpts d_eso; + + int d_maxreplylen; + uint16_t d_qlen; // length of the question (including class & type) in this packet 2 + + bool d_compress; // 1 + bool d_tsigtimersonly; + bool d_wantsnsid; + bool d_haveednssubnet; + bool d_haveednssection; }; diff --cc pdns/dnsparser.hh index eff94e4e9c,814740cc62..70266c4816 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@@ -263,8 -262,7 +263,8 @@@ protected struct DNSRecord { - std::string d_label; + DNSName d_label; //FIXME rename + std::shared_ptr d_content; uint16_t d_type; uint16_t d_class; uint32_t d_ttl; @@@ -320,10 -319,10 +320,10 @@@ public init(packet, len); } - string d_qname; - dnsheader d_header; + DNSName d_qname; uint16_t d_qclass, d_qtype; //uint8_t d_rcode; + dnsheader d_header; typedef vector > answers_t; diff --cc pdns/dnsproxy.hh index c4bf4baf33,fc103f562a..c48dec7128 --- a/pdns/dnsproxy.hh +++ b/pdns/dnsproxy.hh @@@ -65,17 -65,25 +65,17 @@@ public } bool recurseFor(DNSPacket* p); private: - NetmaskGroup d_ng; - int d_sock; - AtomicCounter* d_resanswers; - AtomicCounter* d_udpanswers; - AtomicCounter* d_resquestions; - pthread_mutex_t d_lock; - uint16_t d_xor; - int getID_locked(); struct ConntrackEntry { - uint16_t id; - ComboAddress remote; - int outsock; time_t created; + boost::optional anyLocal; - string qname; + DNSName qname; - uint16_t qtype; DNSPacket* complete; - string aname; + DNSName aname; - boost::optional anyLocal; + ComboAddress remote; + uint16_t id; + uint16_t qtype; + int outsock; }; typedef map map_t; diff --cc pdns/dnsrecords.cc index 3df4c6a778,e30583494a..14a7d67fe3 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@@ -225,8 -222,8 +222,8 @@@ boilerplate_conv(NAPTR, QType::NAPTR ) - SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const string& target) + SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, const DNSName& target) -: DNSRecordContent(QType::SRV), d_preference(preference), d_weight(weight), d_port(port), d_target(target) +: DNSRecordContent(QType::SRV), d_weight(weight), d_port(port), d_target(target), d_preference(preference) {} boilerplate_conv(SRV, QType::SRV, diff --cc pdns/dnsrecords.hh index 36e9b5acf1,4664eb030c..016fa8a39e --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@@ -108,10 -109,11 +109,11 @@@ public includeboilerplate(IPSECKEY) private: - uint8_t d_preference, d_gatewaytype, d_algorithm; + uint32_t d_ip4; - string d_gateway, d_publickey; + DNSName d_gateway; + string d_publickey; - uint32_t d_ip4; string d_ip6; + uint8_t d_preference, d_gatewaytype, d_algorithm; }; class DHCIDRecordContent : public DNSRecordContent @@@ -131,9 -133,8 +133,9 @@@ public includeboilerplate(SRV) - uint16_t d_preference, d_weight, d_port; + uint16_t d_weight, d_port; - string d_target; + DNSName d_target; + uint16_t d_preference; }; class TSIGRecordContent : public DNSRecordContent @@@ -142,16 -143,15 +144,16 @@@ public includeboilerplate(TSIG) TSIGRecordContent() : DNSRecordContent(QType::TSIG) {} - DNSName d_algoName; - uint64_t d_time; // 48 bits + uint16_t d_origID; uint16_t d_fudge; - // uint16_t d_macSize; + - string d_algoName; ++ DNSName d_algoName; string d_mac; - uint16_t d_origID; + string d_otherData; + uint64_t d_time; + // uint16_t d_macSize; uint16_t d_eRcode; // uint16_t d_otherLen - string d_otherData; }; @@@ -366,12 -366,15 +368,13 @@@ public includeboilerplate(RRSIG) uint16_t d_type; - uint8_t d_algorithm, d_labels; - uint32_t d_originalttl, d_sigexpire, d_siginception; uint16_t d_tag; - string d_signer, d_signature; + DNSName d_signer; + string d_signature; + uint32_t d_originalttl, d_sigexpire, d_siginception; + uint8_t d_algorithm, d_labels; }; - - //namespace { struct soatimes { @@@ -397,11 -400,11 +400,11 @@@ class SOARecordContent : public DNSReco { public: includeboilerplate(SOA) - SOARecordContent(const string& mname, const string& rname, const struct soatimes& st); + SOARecordContent(const DNSName& mname, const DNSName& rname, const struct soatimes& st); + struct soatimes d_st; - string d_mname; - string d_rname; + DNSName d_mname; + DNSName d_rname; - struct soatimes d_st; }; class NSECRecordContent : public DNSRecordContent @@@ -540,17 -543,15 +543,17 @@@ public includeboilerplate(TKEY) // storage for the bytes - DNSName d_algo; + uint16_t d_othersize; + uint16_t d_mode; uint32_t d_inception; uint32_t d_expiration; - uint16_t d_mode; - uint16_t d_error; - uint16_t d_keysize; + - string d_algo; ++ DNSName d_algo; string d_key; - uint16_t d_othersize; string d_other; + + uint16_t d_error; + uint16_t d_keysize; private: }; diff --cc pdns/dnsseckeeper.hh index 4deb945f0c,87bcd7ac7c..3643c60d23 --- a/pdns/dnsseckeeper.hh +++ b/pdns/dnsseckeeper.hh @@@ -117,9 -117,9 +117,9 @@@ private return d_ttd; } - string d_domain; + DNSName d_domain; - unsigned int d_ttd; mutable keys_t d_keys; + unsigned int d_ttd; }; struct METACacheEntry @@@ -129,10 -129,10 +129,10 @@@ return d_ttd; } - string d_domain; + DNSName d_domain; + mutable std::string d_key, d_value; unsigned int d_ttd; - mutable std::string d_key, d_value; }; diff --cc pdns/dnswriter.cc index 5286439a25,ddd8e357cb..6ac0aa71db --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@@ -160,11 -160,12 +160,12 @@@ void DNSPacketWriter::xfrText(const str } } - DNSPacketWriter::lmap_t::iterator find(DNSPacketWriter::lmap_t& lmap, const string& label) + /* FIXME400: check that this beats a map */ -DNSPacketWriter::nmap_t::iterator find(DNSPacketWriter::nmap_t& nmap, const DNSName& name) ++DNSPacketWriter::lmap_t::iterator find(DNSPacketWriter::lmap_t& nmap, const DNSName& name) { - DNSPacketWriter::nmap_t::iterator ret; + DNSPacketWriter::lmap_t::iterator ret; - for(ret=lmap.begin(); ret != lmap.end(); ++ret) - if(pdns_iequals(ret->first ,label)) + for(ret=nmap.begin(); ret != nmap.end(); ++ret) + if(pdns_iequals(ret->first ,name)) break; return ret; } @@@ -219,18 -222,19 +222,19 @@@ void DNSPacketWriter::xfrName(const DNS unsigned int startRecordSize=d_record.size(); unsigned int startPos; - for(labelparts_t::const_iterator i=parts.begin(); i!=parts.end(); ++i) { - if(deDot) - chopped.assign(label.c_str() + i->first, labellen - i->first -1); - else - chopped.assign(label.c_str() + i->first); + DNSName towrite = name; + /* FIXME400: if we are not compressing, there is no reason to work per-label */ + for(auto &label: parts) { + if(d_lowerCase) label=toLower(label); + //cerr<<"xfrName labelpart ["<second< 253) // chopped does not include a length octet for the first label and the root label - //cerr<<"compress="<first.toString()<<"]"<second< 253) // chopped does not include a length octet for the first label and the root label throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name"); uint16_t offset=li->second; offset|=0xc000; @@@ -239,9 -243,10 +243,10 @@@ goto out; // skip trailing 0 in case of compression } - if(li==d_namemap.end() && pos< 16384) { + if(li==d_labelmap.end() && pos< 16384) { // cerr<<"\tStoring a compression pointer to '"< 16384, won't work - d_namemap.push_back(make_pair(towrite, pos)); // if untrue, we need to count - also, don't store offsets > 16384, won't work ++ d_labelmap.push_back(make_pair(towrite, pos)); // if untrue, we need to count - also, don't store offsets > 16384, won't work + //cerr<<"stored ["< > lmap_t; - typedef vector > nmap_t; - enum Place {ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; ++ typedef vector > lmap_t; + enum Place : uint8_t {ANSWER=1, AUTHORITY=2, ADDITIONAL=3}; //! Start a DNS Packet in the vector passed, with question qname, qtype and qclass - DNSPacketWriter(vector& content, const string& qname, uint16_t qtype, uint16_t qclass=QClass::IN, uint8_t opcode=0); - - /** Start a new DNS record within this packet for namq, qtype, ttl, class and in the requested place. Note that packets can only be written in natural order - + DNSPacketWriter(vector& content, const DNSName& qname, uint16_t qtype, uint16_t qclass=QClass::IN, uint8_t opcode=0); + + /** Start a new DNS record within this packet for namq, qtype, ttl, class and in the requested place. Note that packets can only be written in natural order - ANSWER, AUTHORITY, ADDITIONAL */ - void startRecord(const string& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=QClass::IN, Place place=ANSWER, bool compress=true); + void startRecord(const DNSName& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=QClass::IN, Place place=ANSWER, bool compress=true); /** Shorthand way to add an Opt-record, for example for EDNS0 purposes */ typedef vector > optvect_t; @@@ -114,20 -115,16 +115,20 @@@ bool eof() { return true; } // we don't know how long the record should be private: + // We declare 1 uint_16 in the public section, these 3 align on a 8-byte boundry + uint16_t d_stuff; + uint16_t d_sor; + uint16_t d_rollbackmarker; // start of last complete packet, for rollback + vector & d_content; vector d_record; - string d_qname; - string d_recordqname; + DNSName d_qname; + DNSName d_recordqname; - uint16_t d_recordqtype, d_recordqclass; + lmap_t d_labelmap; + uint32_t d_recordttl; - nmap_t d_namemap; - uint16_t d_stuff; - uint16_t d_sor; - uint16_t d_rollbackmarker; // start of last complete packet, for rollback + uint16_t d_recordqtype, d_recordqclass; + uint16_t d_truncatemarker; // end of header, for truncate Place d_recordplace; bool d_canonic, d_lowerCase; diff --cc pdns/signingpipe.cc index e3f4f634d9,9030a40934..e0e32e321e --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@@ -70,9 -70,9 +70,9 @@@ catch(...) return 0; } - ChunkedSigningPipe::ChunkedSigningPipe(const string& signerName, bool mustSign, const string& servers, unsigned int workers) -ChunkedSigningPipe::ChunkedSigningPipe(const DNSName& signerName, bool mustSign, const string& servers, unsigned int workers) - : d_queued(0), d_outstanding(0), d_signer(signerName), d_maxchunkrecords(100), d_numworkers(workers), d_tids(d_numworkers), - d_mustSign(mustSign), d_final(false), d_submitted(0) ++ChunkedSigningPipe::ChunkedSigningPipe(const DNSName& signerName, bool mustSign, const string& servers, unsigned int workers) + : d_queued(0), d_outstanding(0), d_numworkers(workers), d_submitted(0), d_signer(signerName), + d_maxchunkrecords(100), d_tids(d_numworkers), d_mustSign(mustSign), d_final(false) { d_rrsetToSign = new rrset_t; d_chunks.push_back(vector()); // load an empty chunk diff --cc pdns/signingpipe.hh index b7f906477f,4c63aea72e..01b030f183 --- a/pdns/signingpipe.hh +++ b/pdns/signingpipe.hh @@@ -38,13 -37,9 +38,13 @@@ private void worker(int n, int fd); static void* helperWorker(void* p); + + unsigned int d_numworkers; + int d_submitted; + rrset_t* d_rrsetToSign; std::deque< std::vector > d_chunks; - string d_signer; + DNSName d_signer; chunk_t::size_type d_maxchunkrecords; diff --cc pdns/ueberbackend.hh index 9002125afe,f67d94ed93..4df70b7331 --- a/pdns/ueberbackend.hh +++ b/pdns/ueberbackend.hh @@@ -88,14 -88,13 +88,14 @@@ public //! The current real backend, which is answering questions DNSBackend *d_hinterBackend; - //! Index of the current backend within the backends vector - unsigned int i; - //! DNSPacket who asked this question DNSPacket *pkt_p; - string qname; + DNSName qname; + + //! Index of the current backend within the backends vector + unsigned int i; QType qtype; + private: static AtomicCounter instances; @@@ -138,30 -137,20 +138,30 @@@ void rediscover(string* status=0); void reload(); private: - unsigned int d_cache_ttl, d_negcache_ttl; - pthread_t tid; handle d_handle; - bool d_negcached; - bool d_cached; + vector d_answers; + vector::const_iterator d_cachehandleiter; + + static pthread_mutex_t d_mut; + static pthread_cond_t d_cond; + static sem_t d_dynserialize; + struct Question { - string qname; - QType qtype; + DNSName qname; int zoneId; + QType qtype; }d_question; - vector d_answers; - vector::const_iterator d_cachehandleiter; + + unsigned int d_cache_ttl, d_negcache_ttl; + int domain_id; + int d_ancount; + + bool d_negcached; + bool d_cached; + static bool d_go; + bool stale; int cacheHas(const Question &q, vector &rrs); void addNegCache(const Question &q); diff --cc pdns/zoneparser-tng.hh index ca4f71204d,89888b0efd..a743acc2ca --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@@ -45,26 -45,26 +45,26 @@@ private void stackFile(const std::string& fname); unsigned makeTTLFromZone(const std::string& str); string getLineOfFile(); + struct filestate { + filestate(FILE* fp, string filename) : d_fp(fp), d_filename(filename), d_lineno(0){} + FILE *d_fp; + string d_filename; + int d_lineno; + }; + string d_reldir; string d_line; - string d_prevqname; - string d_zonename; + DNSName d_prevqname; + DNSName d_zonename; + string d_templateline; vector d_zonedata; vector::iterator d_zonedataline; + std::stack d_filestates; + parts_t d_templateparts; int d_defaultttl; + uint32_t d_templatecounter, d_templatestop, d_templatestep; bool d_havedollarttl; bool d_fromfile; - uint32_t d_templatecounter, d_templatestop, d_templatestep; - string d_templateline; - parts_t d_templateparts; - - struct filestate { - filestate(FILE* fp, string filename) : d_fp(fp), d_filename(filename), d_lineno(0){} - FILE *d_fp; - string d_filename; - int d_lineno; - }; - std::stack d_filestates; }; #endif