unsigned int &numanswered6=*S.getPointer("udp6-answers");
numreceived=-1;
int diff;
-
+ bool logDNSDetails= ::arg().mustDo("log-dns-details");
+
for(;;) {
if(number==0) { // only run on main thread
if(!((numreceived++)%250)) { // maintenance tasks
S.ringAccount("queries", P->qdomain+"/"+P->qtype.getName());
S.ringAccount("remotes",P->getRemote());
+ if(logDNSDetails)
+ L << Logger::Notice<<"Remote "<< P->remote.toString() <<" wants '" << P->qdomain<<"|"<<P->qtype.getName() <<
+ "', do = " <<P->d_dnssecOk <<", bufsize = "<< P->getMaxReplyLen()<<": ";
- if((P->d.opcode != Opcode::Notify) && !P->d_dnssecOk && P->couldBeCached() && PC.get(P, &cached)) { // short circuit - does the PacketCache recognize this question?
+ if((P->d.opcode != Opcode::Notify) && P->couldBeCached() && PC.get(P, &cached)) { // short circuit - does the PacketCache recognize this question?
+ if(logDNSDetails)
+ L<<"packetcache HIT"<<endl;
cached.setRemote(&P->remote); // inlined
cached.setSocket(P->getSocket()); // inlined
cached.setMaxReplyLen(P->getMaxReplyLen());
continue;
}
+ if(logDNSDetails)
+ L<<"packetcache MISS"<<endl;
if(g_mustlockdistributor) {
Lock l(&d_distributorlock);
g_distributor->question(P, &sendout); // otherwise, give to the distributor
DNSPacket *r=0;
try {
- L << Logger::Notice<<"Remote "<< p->remote.toString() <<" wants " << p->qtype.getName() << " for '"<<p->qdomain <<
- "', do = " <<p->d_dnssecOk <<", bufsize = "<< p->getMaxReplyLen()<< endl;
if(p->d.qr) { // QR bit from dns packet (thanks RA from N)
L<<Logger::Error<<"Received an answer (non-query) packet from "<<p->getRemote()<<", dropping"<<endl;
// XXX FIXME do this in DNSPacket::parse ?
if(!validDNSName(p->qdomain)) {
- if(::arg().mustDo("log-dns-details"))
+ if(d_logDNSDetails)
L<<Logger::Error<<"Received a malformed qdomain from "<<p->getRemote()<<", '"<<p->qdomain<<"': sending servfail"<<endl;
S.inc("corrupt-packets");
r=p->replyPacket();
char mesg[512];
DLOG(L<<"TCP Connection accepted on fd "<<fd<<endl);
-
+ bool logDNSDetails= ::arg().mustDo("log-dns-details");
for(;;) {
ComboAddress remote;
socklen_t remotelen=sizeof(remote);
shared_ptr<DNSPacket> reply;
shared_ptr<DNSPacket> cached= shared_ptr<DNSPacket>(new DNSPacket);
+ if(logDNSDetails)
+ L << Logger::Notice<<"Remote "<< packet->remote.toString() <<" wants '" << packet->qdomain<<"|"<<packet->qtype.getName() <<
+ "', do = " <<packet->d_dnssecOk <<", bufsize = "<< packet->getMaxReplyLen()<<": ";
+
- if(!packet->d.rd && !packet->d_dnssecOk && packet->couldBeCached() && PC.get(packet.get(), cached.get())) { // short circuit - does the PacketCache recognize this question?
+ if(!packet->d.rd && packet->couldBeCached() && PC.get(packet.get(), cached.get())) { // short circuit - does the PacketCache recognize this question?
+ if(logDNSDetails)
+ L<<"packetcache HIT"<<endl;
cached->setRemote(&packet->remote);
cached->d.id=packet->d.id;
cached->d.rd=packet->d.rd; // copy in recursion desired bit
S.inc("tcp-answers");
continue;
}
-
+ if(logDNSDetails)
+ L<<"packetcache MISS"<<endl;
{
Lock l(&s_plock);
if(!s_P) {