Permalink
Browse files

send empty SERVFAIL after a backend throws a DBException

  • Loading branch information...
1 parent 65d3cb2 commit 25e7af37fe02225782f53c079793afa90efb78e2 @mind04 mind04 committed with mind04 Sep 23, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 pdns/packethandler.cc
@@ -1317,6 +1317,8 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
}
catch(DBException &e) {
L<<Logger::Error<<"Backend reported condition which prevented lookup ("+e.reason+") sending out servfail"<<endl;
+ delete r;
+ r=p->replyPacket(); // generate an empty reply packet
r->setRcode(RCode::ServFail);
S.inc("servfail-packets");
S.ringAccount("servfail-queries",p->qdomain);
@@ -1328,7 +1330,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
catch(std::exception &e) {
L<<Logger::Error<<"Exception building answer packet ("<<e.what()<<") sending out servfail"<<endl;
delete r;
- r=p->replyPacket(); // generate an empty reply packet
+ r=p->replyPacket(); // generate an empty reply packet
r->setRcode(RCode::ServFail);
S.inc("servfail-packets");
S.ringAccount("servfail-queries",p->qdomain);

0 comments on commit 25e7af3

Please sign in to comment.