if(now.tv_sec - last_rootupdate > 7200) {
int res = SyncRes::getRootNS(g_now, nullptr);
- if (!res)
+ if (!res) {
last_rootupdate=now.tv_sec;
+ primeRootNSZones(g_dnssecmode != DNSSECMode::Off);
+ }
}
if(isHandlerThread()) {
extern int g_argc;
extern char** g_argv;
+static thread_local set<DNSName> t_rootNSZones;
+
void primeHints(void)
{
// prime root cache
const vState validationState = Insecure;
vector<DNSRecord> nsset;
+ t_rootNSZones.clear();
if(!t_RC)
t_RC = std::unique_ptr<MemRecursorCache>(new MemRecursorCache());
templ[sizeof(templ)-1] = '\0';
*templ=c;
aaaarr.d_name=arr.d_name=DNSName(templ);
+ t_rootNSZones.insert(arr.d_name.getLastLabel());
nsrr.d_content=std::make_shared<NSRecordContent>(DNSName(templ));
arr.d_content=std::make_shared<ARecordContent>(ComboAddress(rootIps4[c-'a']));
vector<DNSRecord> aset;
rr.content=toLower(rr.content);
nsset.push_back(DNSRecord(rr));
}
+ t_rootNSZones.insert(rr.qname.getLastLabel());
}
}
t_RC->doWipeCache(g_rootdnsname, false, QType::NS);
t_RC->replace(time(0), g_rootdnsname, QType(QType::NS), nsset, vector<std::shared_ptr<RRSIGRecordContent>>(), vector<std::shared_ptr<DNSRecord>>(), false, boost::none, validationState); // and stuff in the cache
+
+
+
+}
+
+void primeRootNSZones(bool dnssecmode)
+{
+ struct timeval now;
+ gettimeofday(&now, 0);
+ SyncRes sr(now);
+
+ if (dnssecmode) {
+ sr.setDoDNSSEC(true);
+ sr.setDNSSECValidationRequested(true);
+ }
+ for (const auto & qname: t_rootNSZones) {
+ vector<DNSRecord> ret;
+ sr.beginResolve(qname, QType(QType::NS), QClass::IN, ret);
+ }
}
static void makeNameToIPZone(std::shared_ptr<SyncRes::domainmap_t> newMap, const DNSName& hostname, const string& ip)
}
return newMap;
}
-
uint64_t* pleaseWipeAndCountNegCache(const DNSName& canon, bool subtree=false);
void doCarbonDump(void*);
void primeHints(void);
+void primeRootNSZones(bool);
extern __thread struct timeval g_now;