#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "syncres.hh"
#include "utility.hh"
#include "rec_channel.hh"
#include <boost/bind.hpp>
#endif
#include "misc.hh"
#include "recursor_cache.hh"
-#include "syncres.hh"
#include "negcache.hh"
#include <boost/function.hpp>
#include <boost/optional.hpp>
#include "namespaces.hh"
pthread_mutex_t g_carbon_config_lock=PTHREAD_MUTEX_INITIALIZER;
-map<string, const uint32_t*> d_get32bitpointers;
-map<string, const uint64_t*> d_get64bitpointers;
-map<string, const std::atomic<uint64_t>*> d_getatomics;
-map<string, function< uint64_t() > > d_get64bitmembers;
-pthread_mutex_t d_dynmetricslock = PTHREAD_MUTEX_INITIALIZER;
-map<string, std::atomic<unsigned long>* > d_dynmetrics;
-void addGetStat(const string& name, const uint32_t* place)
+static map<string, const uint32_t*> d_get32bitpointers;
+static map<string, const uint64_t*> d_get64bitpointers;
+static map<string, const std::atomic<uint64_t>*> d_getatomics;
+static map<string, function< uint64_t() > > d_get64bitmembers;
+static pthread_mutex_t d_dynmetricslock = PTHREAD_MUTEX_INITIALIZER;
+static map<string, std::atomic<unsigned long>* > d_dynmetrics;
+
+static void addGetStat(const string& name, const uint32_t* place)
{
d_get32bitpointers[name]=place;
}
-void addGetStat(const string& name, const uint64_t* place)
-{
- d_get64bitpointers[name]=place;
-}
-void addGetStat(const string& name, const std::atomic<uint64_t>* place)
+static void addGetStat(const string& name, const std::atomic<uint64_t>* place)
{
d_getatomics[name]=place;
}
-
-void addGetStat(const string& name, function<uint64_t ()> f )
+static void addGetStat(const string& name, function<uint64_t ()> f )
{
d_get64bitmembers[name]=f;
}
-
std::atomic<unsigned long>* getDynMetric(const std::string& str)
{
Lock l(&d_dynmetricslock);
try {
total = broadcastAccFunction<uint64_t>(boost::bind(pleaseDumpNSSpeeds, fd));
}
- catch(...){}
+ catch(std::exception& e)
+ {
+ close(fd);
+ return "error dumping NS speeds: "+string(e.what())+"\n";
+ }
+ catch(PDNSException& e)
+ {
+ close(fd);
+ return "error dumping NS speeds: "+e.reason+"\n";
+ }
close(fd);
return "dumped "+std::to_string(total)+" records\n";
g_luaconfs.modify([who, why](LuaConfigItems& lci) {
lci.negAnchors[who] = why;
});
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, who, true));
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, who, true));
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, who, true));
return "Added Negative Trust Anchor for " + who.toLogString() + " with reason '" + why + "'\n";
}
g_luaconfs.modify([entry](LuaConfigItems& lci) {
lci.negAnchors.erase(entry);
});
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, entry, true));
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, entry, true));
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, entry, true));
if (!first) {
first = false;
removed += ",";
auto ds = unique_ptr<DSRecordContent>(dynamic_cast<DSRecordContent*>(DSRecordContent::make(what)));
lci.dsAnchors[who].insert(*ds);
});
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, who, true));
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, who, true));
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, who, true));
L<<Logger::Warning<<endl;
return "Added Trust Anchor for " + who.toStringRootDot() + " with data " + what + "\n";
}
g_luaconfs.modify([entry](LuaConfigItems& lci) {
lci.dsAnchors.erase(entry);
});
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, entry, true));
broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, entry, true));
+ broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, entry, true));
if (!first) {
first = false;
removed += ",";
addGetStat("client-parse-errors", &g_stats.clientParseError);
addGetStat("server-parse-errors", &g_stats.serverParseError);
addGetStat("too-old-drops", &g_stats.tooOldDrops);
+ addGetStat("query-pipe-full-drops", &g_stats.queryPipeFullDrops);
addGetStat("answers0-1", &g_stats.answers0_1);
addGetStat("answers1-10", &g_stats.answers1_10);
addGetStat("answers100-1000", &g_stats.answers100_1000);
addGetStat("answers-slow", &g_stats.answersSlow);
+ addGetStat("x-ourtime0-1", &g_stats.ourtime0_1);
+ addGetStat("x-ourtime1-2", &g_stats.ourtime1_2);
+ addGetStat("x-ourtime2-4", &g_stats.ourtime2_4);
+ addGetStat("x-ourtime4-8", &g_stats.ourtime4_8);
+ addGetStat("x-ourtime8-16", &g_stats.ourtime8_16);
+ addGetStat("x-ourtime16-32", &g_stats.ourtime16_32);
+ addGetStat("x-ourtime-slow", &g_stats.ourtimeSlow);
+
addGetStat("auth4-answers0-1", &g_stats.auth4Answers0_1);
addGetStat("auth4-answers1-10", &g_stats.auth4Answers1_10);
addGetStat("auth4-answers10-100", &g_stats.auth4Answers10_100);
addGetStat("qa-latency", doGetAvgLatencyUsec);
+ addGetStat("x-our-latency", []() { return g_stats.avgLatencyOursUsec; });
addGetStat("unexpected-packets", &g_stats.unexpectedCount);
addGetStat("case-mismatches", &g_stats.caseMismatchCount);
addGetStat("spoof-prevents", &g_stats.spoofCount);
addGetStat("outgoing-timeouts", &SyncRes::s_outgoingtimeouts);
addGetStat("outgoing4-timeouts", &SyncRes::s_outgoing4timeouts);
addGetStat("outgoing6-timeouts", &SyncRes::s_outgoing6timeouts);
+ addGetStat("auth-zone-queries", &SyncRes::s_authzonequeries);
addGetStat("tcp-outqueries", &SyncRes::s_tcpoutqueries);
addGetStat("all-outqueries", &SyncRes::s_outqueries);
addGetStat("ipv6-outqueries", &g_stats.ipv6queries);
::arg().set("lua-config-file") = *begin;
try {
- loadRecursorLuaConfig(::arg()["lua-config-file"], false);
+ luaConfigDelayedThreads delayedLuaThreads;
+ loadRecursorLuaConfig(::arg()["lua-config-file"], delayedLuaThreads);
+ startLuaConfigDelayedThreads(delayedLuaThreads);
L<<Logger::Warning<<"Reloaded Lua configuration file '"<<::arg()["lua-config-file"]<<"', requested via control channel"<<endl;
return "Reloaded Lua configuration file '"+::arg()["lua-config-file"]+"'\n";
}