t_allowFrom = g_initialAllowFrom;
t_udpclientsocks = std::unique_ptr<UDPClientSocks>(new UDPClientSocks());
t_tcpClientCounts = std::unique_ptr<tcpClientCounts_t>(new tcpClientCounts_t());
+
if (threadInfo.isHandler) {
- primeHints();
+ if (!primeHints()) {
+ throw PDNSException("Priming cache failed, stopping");
+ }
g_log<<Logger::Warning<<"Done priming cache with root hints"<<endl;
}
#include "root-addresses.hh"
-void primeHints(void)
+bool primeHints(void)
{
vector<DNSRecord> nsset;
if (!s_RC)
nsset.push_back(nsrr);
}
s_RC->replace(time(nullptr), g_rootdnsname, QType(QType::NS), nsset, vector<std::shared_ptr<RRSIGRecordContent>>(), vector<std::shared_ptr<DNSRecord>>(), false); // and stuff in the cache
+ return true;
}
LuaConfigItems::LuaConfigItems()
}
}
-void primeHints(void)
+bool primeHints(void)
{
// prime root cache
const vState validationState = Insecure;
}
}
if (SyncRes::s_doIPv4 && !SyncRes::s_doIPv6 && !reachableA) {
- g_log<<Logger::Critical<<"Running IPv4 only but no IPv4 root hints, stopping"<<endl;
- // XXX exit() trips an exception in ~ThreadInfo, to be investigated
- _exit(99);
+ g_log<<Logger::Error<<"Running IPv4 only but no IPv4 root hints"<<endl;
+ return false;
}
if (!SyncRes::s_doIPv4 && SyncRes::s_doIPv6 && !reachableAAAA) {
- g_log<<Logger::Critical<<"Running IPv6 only but no IPv6 root hints, stopping"<<endl;
- _exit(99);
+ g_log<<Logger::Error<<"Running IPv6 only but no IPv6 root hints"<<endl;
+ return false;
}
if (SyncRes::s_doIPv4 && SyncRes::s_doIPv6 && !reachableA && !reachableAAAA) {
- g_log<<Logger::Critical<<"No valid root hints, stopping"<<endl;
- _exit(99);
+ g_log<<Logger::Error<<"No valid root hints"<<endl;
+ return false;
}
}
s_RC->doWipeCache(g_rootdnsname, false, QType::NS);
s_RC->replace(time(0), g_rootdnsname, QType(QType::NS), nsset, vector<std::shared_ptr<RRSIGRecordContent>>(), vector<std::shared_ptr<DNSRecord>>(), false, boost::none, boost::none, validationState); // and stuff in the cache
+ return true;
}
uint64_t* pleaseWipePacketCache(const DNSName& canon, bool subtree, uint16_t qtype=0xffff);
uint64_t* pleaseWipeAndCountNegCache(const DNSName& canon, bool subtree=false);
void doCarbonDump(void*);
-void primeHints(void);
+bool primeHints(void);
void primeRootNSZones(bool, unsigned int depth);
extern __thread struct timeval g_now;