Permalink
Browse files

Don't reply to truncated queries

  • Loading branch information...
1 parent 6efabf4 commit 8044a5d265fe78ba5b27efe92277a0f0ced2ad16 @zeha zeha committed with Habbie Oct 12, 2015
Showing with 8 additions and 0 deletions.
  1. +8 −0 pdns/packethandler.cc
@@ -996,6 +996,14 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
return 0;
}
+ if(p->d.tc) { // truncated query. MOADNSParser would silently parse this packet in an incomplete way.
+ if(d_logDNSDetails)
+ L<<Logger::Error<<"Received truncated query packet from "<<p->getRemote()<<", dropping"<<endl;
+ S.inc("corrupt-packets");
+ S.ringAccount("remotes-corrupt", p->getRemote());
+ return 0;
+ }
+
if (p->hasEDNS() && p->getEDNSVersion() > 0) {
r = p->replyPacket();
r->setRcode(16 & 0xF);

0 comments on commit 8044a5d

Please sign in to comment.