dns_random.cc \
lua-pdns.cc lua-pdns.hh lua-recursor.cc lua-recursor.hh randomhelper.cc \
recpacketcache.cc recpacketcache.hh dns.cc nsecrecords.cc base32.cc cachecleaner.hh json_ws.cc json_ws.hh \
-json.cc json.hh version.hh version.cc
+json.cc json.hh version.hh version.cc responsestats.cc
pdns_recursor_LDFLAGS= $(LUA_LIBS)
pdns_recursor_LDADD= $(POLARSSL_LIBS)
#include "config.h"
#include "lua-recursor.hh"
#include "version.hh"
+#include "responsestats.hh"
#ifndef RECURSOR
#include "statbag.hh"
}
}
+ResponseStats g_rs;
+
void startDoResolve(void *p)
{
DNSComboWriter* dc=(DNSComboWriter *)p;
}
if(res == RecursorBehaviour::DROP) {
+ g_rs.submitResponse(dc->d_mdp.d_qtype, 0, !dc->d_tcp);
delete dc;
dc=0;
return;
}
}
}
-
+
if(res == RecursorBehaviour::PASS) {
pw.getHeader()->rcode=RCode::ServFail;
// no commit here, because no record
if(ret.size()) {
orderAndShuffle(ret);
-
for(vector<DNSResourceRecord>::const_iterator i=ret.begin(); i!=ret.end(); ++i) {
pw.startRecord(i->qname, i->qtype.getCode(), i->ttl, i->qclass, (DNSPacketWriter::Place)i->d_place);
minTTL = min(minTTL, i->ttl);
}
}
sendit:;
+ g_rs.submitResponse(dc->d_mdp.d_qtype, packet.size(), !dc->d_tcp);
if(!dc->d_tcp) {
sendto(dc->d_socket, (const char*)&*packet.begin(), packet.size(), 0, (struct sockaddr *)(&dc->d_remote), dc->d_remote.getSocklen());
if(!SyncRes::s_nopacketcache && !variableAnswer ) {
- t_packetCache->insertResponsePacket(string((const char*)&*packet.begin(), packet.size()), g_now.tv_sec,
- min(minTTL,
- (pw.getHeader()->rcode == RCode::ServFail) ? SyncRes::s_packetcacheservfailttl : SyncRes::s_packetcachettl
- )
- );
+ t_packetCache->insertResponsePacket(string((const char*)&*packet.begin(), packet.size()),
+ g_now.tv_sec,
+ min(minTTL,
+ (pw.getHeader()->rcode == RCode::ServFail) ? SyncRes::s_packetcacheservfailttl : SyncRes::s_packetcachettl
+ )
+ );
}
}
else {
#include "arguments.hh"
#include <sys/resource.h>
#include <sys/time.h>
+#include "responsestats.hh"
#include "namespaces.hh"
return 0;
}
+extern ResponseStats g_rs;
+
+string qtypeList()
+{
+ typedef map<uint16_t, uint64_t> qtypenums_t;
+ qtypenums_t qtypenums = g_rs.getQTypeResponseCounts();
+ ostringstream os;
+ boost::format fmt("%s\t%d\n");
+ BOOST_FOREACH(const qtypenums_t::value_type& val, qtypenums) {
+ os << (fmt %DNSRecordContent::NumberToType( val.first) % val.second).str();
+ }
+ return os.str();
+}
+
RecursorControlParser::RecursorControlParser()
{
addGetStat("questions", &g_stats.qcounter);
return reloadAuthAndForwards();
}
+ if(cmd=="get-qtypelist") {
+ return qtypeList();
+ }
+
return "Unknown command '"+cmd+"', try 'help'\n";
}