Permalink
Browse files

ignore non-query packets, closing #945

  • Loading branch information...
1 parent 66cf384 commit 35bc40d990f21d6f9e4d722234ab1adc8896dfb1 @Habbie Habbie committed Aug 14, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 pdns/pdns_recursor.cc
@@ -785,6 +785,11 @@ void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
L<<Logger::Error<<"Ignoring answer on server socket!"<<endl;
return;
}
+ if(dc->d_mdp.d_header.opcode) {
+ delete dc;
+ L<<Logger::Error<<"Ignoring non-query opcode on server socket!"<<endl;
+ return;
+ }
else {
++g_stats.qcounter;
++g_stats.tcpqcounter;
@@ -905,6 +910,10 @@ void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var)
if(g_logCommonErrors)
L<<Logger::Error<<"Ignoring answer from "<<fromaddr.toString()<<" on server socket!"<<endl;
}
+ else if(dh->opcode) {
+ if(g_logCommonErrors)
+ L<<Logger::Error<<"Ignoring non-query opcode "<<dh->opcode<<" from "<<fromaddr.toString()<<" on server socket!"<<endl;
+ }
else {
string question(data, len);
if(g_weDistributeQueries)

0 comments on commit 35bc40d

Please sign in to comment.