From: bert hubert Date: Tue, 21 May 2013 12:41:02 +0000 (+0200) Subject: first steps towards --any-to-tcp feature X-Git-Tag: auth-3.3-rc1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abc8f3f945b82ec1dc2f49b76858741f3dbf36d9;p=pdns first steps towards --any-to-tcp feature --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index bf1734a07..6cb90fd94 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -1,11 +1,10 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2005 - 2011 PowerDNS.COM BV + Copyright (C) 2005 - 2013 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,6 +30,8 @@ UDPNameserver *N; int avg_latency; TCPNameserver *TN; +bool g_anyToTCP; + ArgvMap &arg() { return theArg; @@ -280,6 +281,8 @@ void *qthread(void *number) L << Logger::Notice<<"Remote "<< remote <<" wants '" << P->qdomain<<"|"<qtype.getName() << "', do = " <d_dnssecOk <<", bufsize = "<< P->getMaxReplyLen()<<": "; } + + if((P->d.opcode != Opcode::Notify) && P->couldBeCached() && PC.get(P, &cached)) { // short circuit - does the PacketCache recognize this question? if(logDNSQueries) L<<"packetcache HIT"<qr=d.qr; pw.getHeader()->id=d.id; pw.getHeader()->rd=d.rd; - + pw.getHeader()->tc=d.tc; + DNSPacketWriter::optvect_t opts; if(d_wantsnsid) { opts.push_back(make_pair(3, ::arg()["server-id"])); diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index a11034c3c..067a33e60 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -410,7 +410,6 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled) } } - DLOG(L<<"Received a packet " << len <<" bytes long from "<< remote.toString()<d_anyLocal = dest; } - if(packet->parse(mesg, len)<0) { S.inc("corrupt-packets"); S.ringAccount("remotes-corrupt", packet->getRemote()); diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 6b2533f53..8f8d1ef4e 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1165,7 +1165,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) return r; } - // L<qdomain<<"' "<qtype.getName()<<" from "<getRemote()<qdomain<<"' "<qtype.getName()<<" from "<getRemote()<d.ra = (p->d.rd && d_doRecursion && DP->recurseFor(p)); // make sure we set ra if rd was set, and we'll do it @@ -1185,6 +1185,13 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) if(doVersionRequest(p,r,target)) // catch version.bind requests goto sendit; + if(p->qtype.getCode() == QType::ANY) { + cerr<<"Shunted it to TCP.."<d.tc = 1; + r->commitD(); + return r; + } + if(p->qclass==255) // any class query r->setA(false); else if(p->qclass != QClass::IN) // we only know about IN, so we don't find anything