]> granicus.if.org Git - pdns/commitdiff
with this, EDNS Client Subnet becomes compatible with the packet cache, using the...
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 14 Jun 2017 06:35:53 +0000 (08:35 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 14 Jun 2017 06:35:53 +0000 (08:35 +0200)
pdns/recursor_cache.cc
pdns/recursor_cache.hh
pdns/syncres.cc

index bc483e9df852e7c8a619dc66b32fa20fbbb266c8..6d0eb5eb618ee71714dd04f203b084efd0e361e1 100644 (file)
@@ -34,7 +34,7 @@ unsigned int MemRecursorCache::bytes()
 }
 
 // returns -1 for no hits
-int32_t MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures)
+int32_t MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures, bool* variable)
 {
   time_t ttd=0;
   //  cerr<<"looking up "<< qname<<"|"+qt.getName()<<"\n";
@@ -56,7 +56,9 @@ int32_t MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt,
                            (qt.getCode()==QType::ADDR && (i->d_qtype == QType::A || i->d_qtype == QType::AAAA) )) 
                            && (i->d_netmask.empty() || i->d_netmask.match(who)))
          ) {
-
+        if(variable && !i->d_netmask.empty()) {
+          *variable=true;
+        }
        ttd = i->d_ttd; 
         //        cerr<<"Looking at "<<i->d_records.size()<<" records for this name"<<endl;
        for(auto k=i->d_records.begin(); k != i->d_records.end(); ++k) {
index 8999335f9ab306e2ddd57300fc6f9d317bcb1539..c6da875174bc1905d5023eaa695680df690308a6 100644 (file)
@@ -53,7 +53,7 @@ public:
   }
   unsigned int size();
   unsigned int bytes();
-  int32_t get(time_t, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures=0);
+  int32_t get(time_t, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures=0, bool* variable=0);
 
   void replace(time_t, const DNSName &qname, const QType& qt,  const vector<DNSRecord>& content, const vector<shared_ptr<RRSIGRecordContent>>& signatures, bool auth, boost::optional<Netmask> ednsmask=boost::optional<Netmask>());
   void doPrune(void);
index 4652fb1754f885f3032f6abd9e4728e85c42ebf2..279ad956f739f0986ce217134eeb6b693f3d743a 100644 (file)
@@ -794,7 +794,7 @@ bool SyncRes::doCNAMECacheCheck(const DNSName &qname, const QType &qtype, vector
   LOG(prefix<<qname<<": Looking for CNAME cache hit of '"<<qname<<"|CNAME"<<"'"<<endl);
   vector<DNSRecord> cset;
   vector<std::shared_ptr<RRSIGRecordContent>> signatures;
-  if(t_RC->get(d_now.tv_sec, qname,QType(QType::CNAME), &cset, d_requestor, &signatures) > 0) {
+  if(t_RC->get(d_now.tv_sec, qname,QType(QType::CNAME), &cset, d_requestor, &signatures, &d_wasVariable) > 0) {
 
     for(auto j=cset.cbegin() ; j != cset.cend() ; ++j) {
       if(j->d_ttl>(unsigned int) d_now.tv_sec) {
@@ -913,7 +913,7 @@ bool SyncRes::doCacheCheck(const DNSName &qname, const QType &qtype, vector<DNSR
   bool found=false, expired=false;
   vector<std::shared_ptr<RRSIGRecordContent>> signatures;
   uint32_t ttl=0;
-  if(t_RC->get(d_now.tv_sec, sqname, sqt, &cset, d_requestor, d_doDNSSEC ? &signatures : 0) > 0) {
+  if(t_RC->get(d_now.tv_sec, sqname, sqt, &cset, d_requestor, d_doDNSSEC ? &signatures : 0, &d_wasVariable) > 0) {
     LOG(prefix<<sqname<<": Found cache hit for "<<sqt.getName()<<": ");
     for(auto j=cset.cbegin() ; j != cset.cend() ; ++j) {
       LOG(j->d_content->getZoneRepresentation());