]> granicus.if.org Git - pdns/commitdiff
implement pseudo-type 'ADDR' lookup, plus finally tell powerdns that authoritative...
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 10 Feb 2008 19:04:36 +0000 (19:04 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 10 Feb 2008 19:04:36 +0000 (19:04 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1137 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/qtype.cc
pdns/qtype.hh
pdns/recursor_cache.cc

index 0b9f58679adc69bd56303ee099cd5a71c64c8be3..bf4354056e8c2bffd2e39eb9585e32e59d244ce8 100644 (file)
@@ -70,6 +70,7 @@ QType::QType()
       insert("URL",256);
       insert("MBOXFW",257);
       insert("CURL",258);
+      insert("ADDR",259);
     }
 }
 
index 3817f204dfce4b78d778d239f7efe459ad44250e..4951db5b1ba1c7e02efaed694fc0b228a1969fcc 100644 (file)
@@ -73,7 +73,7 @@ public:
   static int chartocode(const char *p); //!< convert a character string to a code
   
   enum typeenum {A=1,NS=2,CNAME=5,SOA=6, MR=9, PTR=12,HINFO=13,MX=15,TXT=16,RP=17,AFSDB=18,KEY=25,AAAA=28,LOC=29,SRV=33,NAPTR=35, OPT=41,
-                SPF=99, AXFR=252, IXFR=251, ANY=255, URL=256, MBOXFW=257, CURL=258} types;
+                SPF=99, AXFR=252, IXFR=251, ANY=255, URL=256, MBOXFW=257, CURL=258, ADDR=259} types;
 private:
   short int code;
   typedef pair<string,int> namenum; 
index 3ca070645d95e5a74234301e00f1dbbd28cbfbcf..b91b4e266a50a0faf6a95b22c4d003aed190a485 100644 (file)
@@ -196,7 +196,9 @@ int MemRecursorCache::get(time_t now, const string &qname, const QType& qt, set<
 
   if(d_cachecache.first!=d_cachecache.second) { 
     for(cache_t::const_iterator i=d_cachecache.first; i != d_cachecache.second; ++i) 
-      if(i->d_qtype == qt.getCode() || qt.getCode()==QType::ANY) {
+      if(i->d_qtype == qt.getCode() || qt.getCode()==QType::ANY || 
+        (qt.getCode()==QType::ADDR && (i->d_qtype == QType::A || i->d_qtype == QType::AAAA) )
+        ) {
        typedef cache_t::nth_index<1>::type sequence_t;
        sequence_t& sidx=d_cache.get<1>();
        sequence_t::iterator si=d_cache.project<1>(i);
@@ -216,7 +218,7 @@ int MemRecursorCache::get(time_t now, const string &qname, const QType& qt, set<
          else
            sidx.relocate(sidx.end(), si); 
        }
-       if(qt.getCode()!=QType::ANY) // normally if we have a hit, we are done
+       if(qt.getCode()!=QType::ANY && qt.getCode()!=QType::ADDR) // normally if we have a hit, we are done
          break;
       }
 
@@ -251,7 +253,7 @@ void MemRecursorCache::replace(time_t now, const string &qname, const QType& qt,
   if(qt.getCode()==QType::SOA || qt.getCode()==QType::CNAME)  // you can only have one (1) each of these
     ce.d_records.clear();
 
-  if(auth && !ce.d_auth) {
+  if(auth /* && !ce.d_auth */ ) {
     ce.d_records.clear(); // clear non-auth data
     ce.d_auth = true;
     isNew=true;           // data should be sorted again