Permalink
Browse files

first steps towards --any-to-tcp feature

  • Loading branch information...
1 parent c997c3b commit abc8f3f945b82ec1dc2f49b76858741f3dbf36d9 @ahupowerdns ahupowerdns committed May 21, 2013
Showing with 15 additions and 6 deletions.
  1. +5 −2 pdns/common_startup.cc
  2. +2 −1 pdns/dnspacket.cc
  3. +0 −2 pdns/nameserver.cc
  4. +8 −1 pdns/packethandler.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<<"|"<<P->qtype.getName() <<
"', do = " <<P->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"<<endl;
View
@@ -274,7 +274,8 @@ void DNSPacket::wrapup()
pw.getHeader()->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"]));
View
@@ -410,7 +410,6 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled)
}
}
-
DLOG(L<<"Received a packet " << len <<" bytes long from "<< remote.toString()<<endl);
DNSPacket *packet;
@@ -428,7 +427,6 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled)
packet->d_anyLocal = dest;
}
-
if(packet->parse(mesg, len)<0) {
S.inc("corrupt-packets");
S.ringAccount("remotes-corrupt", packet->getRemote());
@@ -1165,7 +1165,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
return r;
}
- // L<<Logger::Warning<<"Query for '"<<p->qdomain<<"' "<<p->qtype.getName()<<" from "<<p->getRemote()<<endl;
+ L<<Logger::Warning<<"Query for '"<<p->qdomain<<"' "<<p->qtype.getName()<<" from "<<p->getRemote()<<endl;
r->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.."<<endl;
+ r->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

0 comments on commit abc8f3f

Please sign in to comment.