Permalink
Browse files

with this, EDNS Client Subnet becomes compatible with the packet cach…

…e, using the existing variable answer facility.

(cherry picked from commit 8bec43b)
  • Loading branch information...
ahupowerdns authored and rgacogne committed Jun 14, 2017
1 parent 66f894b commit 2325010e69333c090189d045043b29027e597a43
Showing with 7 additions and 4 deletions.
  1. +4 −1 pdns/recursor_cache.cc
  2. +1 −1 pdns/recursor_cache.hh
  3. +2 −2 pdns/syncres.cc
View
@@ -31,7 +31,7 @@ unsigned int MemRecursorCache::bytes()
}
// returns -1 for no hits
int MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures)
int 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)
{
unsigned int ttd=0;
// cerr<<"looking up "<< qname<<"|"+qt.getName()<<"\n";
@@ -54,6 +54,9 @@ int MemRecursorCache::get(time_t now, const DNSName &qname, const QType& qt, vec
(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;
View
@@ -53,7 +53,7 @@ public:
}
unsigned int size();
unsigned int bytes();
int get(time_t, const DNSName &qname, const QType& qt, vector<DNSRecord>* res, const ComboAddress& who, vector<std::shared_ptr<RRSIGRecordContent>>* signatures=0);
int 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);
View
@@ -713,7 +713,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) {
@@ -842,7 +842,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());

0 comments on commit 2325010

Please sign in to comment.