From: Bert Hubert Date: Tue, 11 Jan 2011 19:52:55 +0000 (+0000) Subject: quiet query logging with log-dns-details, move query logging to place where cache... X-Git-Tag: auth-3.0~379 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb5903e27286fad4df3a8a406e75b4bacc3152dc;p=pdns quiet query logging with log-dns-details, move query logging to place where cache hits are also seen, take first step for dnssec packet caching git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1868 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index 1913edc39..74431b14d 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -228,7 +228,8 @@ void *qthread(void *number) 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 @@ -250,8 +251,13 @@ void *qthread(void *number) 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<<"|"<qtype.getName() << + "', do = " <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"<remote); // inlined cached.setSocket(P->getSocket()); // inlined cached.setMaxReplyLen(P->getMaxReplyLen()); @@ -271,6 +277,8 @@ void *qthread(void *number) continue; } + if(logDNSDetails) + L<<"packetcache MISS"<question(P, &sendout); // otherwise, give to the distributor diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 1ad758a07..fca25b115 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1139,8 +1139,6 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) DNSPacket *r=0; try { - L << Logger::Notice<<"Remote "<< p->remote.toString() <<" wants " << p->qtype.getName() << " for '"<qdomain << - "', do = " <d_dnssecOk <<", bufsize = "<< p->getMaxReplyLen()<< endl; if(p->d.qr) { // QR bit from dns packet (thanks RA from N) L<getRemote()<<", dropping"<qdomain)) { - if(::arg().mustDo("log-dns-details")) + if(d_logDNSDetails) L<getRemote()<<", '"<qdomain<<"': sending servfail"<replyPacket(); diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 950041cbf..0d2f92f01 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -244,7 +244,7 @@ void *TCPNameserver::doConnection(void *data) char mesg[512]; DLOG(L<<"TCP Connection accepted on fd "< reply; shared_ptr cached= shared_ptr(new DNSPacket); + if(logDNSDetails) + L << Logger::Notice<<"Remote "<< packet->remote.toString() <<" wants '" << packet->qdomain<<"|"<qtype.getName() << + "', do = " <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"<setRemote(&packet->remote); cached->d.id=packet->d.id; cached->d.rd=packet->d.rd; // copy in recursion desired bit @@ -293,7 +299,8 @@ void *TCPNameserver::doConnection(void *data) S.inc("tcp-answers"); continue; } - + if(logDNSDetails) + L<<"packetcache MISS"<