SyncRes::SyncRes(const struct timeval& now) : d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0), d_unreachables(0),
d_totUsec(0), d_now(now),
- d_cacheonly(false), d_nocache(false), d_doDNSSEC(false), d_doEDNS0(false), d_lm(s_lm)
+ d_cacheonly(false), d_doDNSSEC(false), d_doEDNS0(false), d_lm(s_lm)
{
}
int res=0;
// This is a difficult way of expressing "this is a normal query", i.e. not getRootNS.
- if(!(d_nocache && qtype.getCode()==QType::NS && qname.isRoot())) {
+ if(!(d_updatingRootNS && qtype.getCode()==QType::NS && qname.isRoot())) {
if(d_cacheonly) { // very limited OOB support
LWResult lwr;
LOG(prefix<<qname<<": Recursion not requested for '"<<qname<<"|"<<qtype.getName()<<"', peeking at auth/forward zones"<<endl);
// We lost the root NS records
primeHints();
LOG(prefix<<qname<<": reprimed the root"<<endl);
- getRootNS(d_now, d_asyncResolve);
+ /* let's prevent an infinite loop */
+ if (!d_updatingRootNS) {
+ getRootNS(d_now, d_asyncResolve);
+ }
}
}while(subdomain.chopOff());
}
int SyncRes::getRootNS(struct timeval now, asyncresolve_t asyncCallback) {
SyncRes sr(now);
sr.setDoEDNS0(true);
- sr.setNoCache();
+ sr.setUpdatingRootNS();
sr.setDoDNSSEC(g_dnssecmode != DNSSECMode::Off);
sr.setAsyncCallback(asyncCallback);
{
d_cacheonly=state;
}
- void setNoCache(bool state=true)
- {
- d_nocache=state;
- }
void setDoEDNS0(bool state=true)
{
boost::optional<Netmask> getEDNSSubnetMask(const ComboAddress& local, const DNSName&dn, const ComboAddress& rem);
+ void setUpdatingRootNS()
+ {
+ d_updatingRootNS = true;
+ }
+
+
ostringstream d_trace;
shared_ptr<RecursorLua4> d_pdl;
boost::optional<const EDNSSubnetOpts&> d_incomingECS;
* This is set when the RD bit is unset in the incoming query
*/
bool d_cacheonly;
- /* d_nocache is *only* set in getRootNS() (in pdns_recursor.cc).
- * It forces us to not look in the cache or local auth.
- */
- bool d_nocache;
bool d_doDNSSEC;
bool d_doEDNS0{true};
bool d_incomingECSFound{false};
bool d_skipCNAMECheck{false};
+ bool d_updatingRootNS{false};
bool d_wantsRPZ{true};
bool d_wasOutOfBand{false};
bool d_wasVariable{false};