From: Bert Hubert Date: Sun, 10 Feb 2008 19:04:36 +0000 (+0000) Subject: implement pseudo-type 'ADDR' lookup, plus finally tell powerdns that authoritative... X-Git-Tag: rec-3.1.7.1~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=573051c75266c5aee34b34bba4505317c7905c62;p=pdns implement pseudo-type 'ADDR' lookup, plus finally tell powerdns that authoritative data also displaces current non-auth data git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1137 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/qtype.cc b/pdns/qtype.cc index 0b9f58679..bf4354056 100644 --- a/pdns/qtype.cc +++ b/pdns/qtype.cc @@ -70,6 +70,7 @@ QType::QType() insert("URL",256); insert("MBOXFW",257); insert("CURL",258); + insert("ADDR",259); } } diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 3817f204d..4951db5b1 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -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 namenum; diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index 3ca070645..b91b4e266 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -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