) {
ttd = i->d_ttd;
- auto records = &i->d_records;
- for(auto k=records->begin(); k != records->end(); ++k) {
+ for(auto k=i->d_records.begin(); k != i->d_records.end(); ++k) {
if(res) {
DNSRecord dr;
dr.d_name = qname;
d_cachecachevalid=false;
cache_t::iterator stored;
- if(ednsmask) {
- auto key=boost::make_tuple(qname, qt.getCode(), *ednsmask);
- stored=d_cache.find(key);
- if(stored == d_cache.end()) {
- stored=d_cache.insert(CacheEntry(key,CacheEntry::records_t(), auth)).first;
- }
- }
- else {
- auto key=boost::make_tuple(qname, qt.getCode(),Netmask());
- stored=d_cache.find(key);
- if(stored == d_cache.end()) {
- stored=d_cache.insert(CacheEntry(key,CacheEntry::records_t(), auth)).first;
- }
+ auto key=boost::make_tuple(qname, qt.getCode(), ednsmask ? *ednsmask : Netmask());
+ stored=d_cache.find(key);
+ if(stored == d_cache.end()) {
+ stored=d_cache.insert(CacheEntry(key,CacheEntry::records_t(), auth)).first;
}
-
uint32_t maxTTD=UINT_MAX;
CacheEntry ce=*stored;
ce.d_qtype=qt.getCode();
for(auto i=content.cbegin(); i != content.cend(); ++i) {
- // cerr<<"To store: "<<i->content<<" with ttl/ttd "<<i->ttl<<endl;
+ // cerr<<"To store: "<<i->d_content->getZoneRepresentation()<<" with ttl/ttd "<<i->d_ttl<<endl;
ce.d_ttd=min(maxTTD, i->d_ttl); // XXX this does weird things if TTLs differ in the set
ce.d_records.push_back(i->d_content);
// there was code here that did things with TTL and auth. Unsure if it was good. XXX
return 0;
}
fprintf(fp, "; main record cache dump from thread follows\n;\n");
-
auto& sidx=d_cache.get<0>();
uint64_t count=0;
for(auto j=i->d_records.cbegin(); j != i->d_records.cend(); ++j) {
count++;
try {
- fprintf(fp, "%s %d IN %s %s ; %s\n", i->d_qname.toString().c_str(), (int32_t)(i->d_ttd - now), DNSRecordContent::NumberToType(i->d_qtype).c_str(), (*j)->getZoneRepresentation().c_str(), i->d_netmask.toString().c_str());
+ fprintf(fp, "%s %d IN %s %s ; %s\n", i->d_qname.toString().c_str(), (int32_t)(i->d_ttd - now), DNSRecordContent::NumberToType(i->d_qtype).c_str(), (*j)->getZoneRepresentation().c_str(), i->d_netmask.empty() ? "" : i->d_netmask.toString().c_str());
}
catch(...) {
- fprintf(fp, "; error printing '%s'\n", i->d_qname.toString().c_str());
+ fprintf(fp, "; error printing '%s'\n", i->d_qname.empty() ? "EMPTY" : i->d_qname.toString().c_str());
}
}
}
int SyncRes::beginResolve(const DNSName &qname, const QType &qtype, uint16_t qclass, vector<DNSRecord>&ret)
{
s_queries++;
+ d_wasVariable=false;
if( (qtype.getCode() == QType::AXFR))
return -1;
// cout<<"Have "<<i->second.records.size()<<" records and "<<i->second.signatures.size()<<" signatures for "<<i->first.first.toString();
// cout<<'|'<<DNSRecordContent::NumberToType(i->first.second.getCode())<<endl;
t_RC->replace(d_now.tv_sec, i->first.name, QType(i->first.type), i->second.records, i->second.signatures, lwr.d_aabit, i->first.place == DNSResourceRecord::ANSWER ? ednsmask : boost::optional<Netmask>());
+ if(i->first.place == DNSResourceRecord::ANSWER && ednsmask)
+ d_wasVariable=true;
}
set<DNSName> nsset;
LOG(prefix<<qname.toString()<<": determining status after receiving this packet"<<endl);
d_pdl = pdl;
}
+ bool wasVariable() const
+ {
+ return d_wasVariable;
+ }
int asyncresolveWrapper(const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, struct timeval* now, boost::optional<Netmask>& srcmask, LWResult* res);
unsigned int d_totUsec;
ComboAddress d_requestor;
bool d_doDNSSEC;
-
+
+ bool d_wasVariable{false};
+
typedef multi_index_container <
NegCacheEntry,
indexed_by <
static bool s_nopacketcache;
static string s_serverID;
-
struct StaticStorage {
negcache_t negcache;
nsspeeds_t nsSpeeds;