From 93f0da943a590d7bca75ee3623f0d0342f6f56e4 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Mon, 28 Dec 2015 10:01:26 +0000 Subject: [PATCH] we were passing the wrong dnsheader to the ipfilter lua hook --- pdns/pdns_recursor.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index a002446cf..83991f7c9 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -779,6 +779,7 @@ void startDoResolve(void *p) (*t_pdl)->postresolve(dc->d_remote,local, dc->d_mdp.d_qname, QType(dc->d_mdp.d_qtype), ret, res, &variableAnswer); + } } haveAnswer:; @@ -1135,6 +1136,7 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr g_stats.ipv6qcounter++; string response; + const struct dnsheader* dh = (struct dnsheader*)question.c_str(); try { uint32_t age; #ifdef MALLOC_TRACE @@ -1149,7 +1151,7 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr */ #endif bool needsDNSSEC=false; - const struct dnsheader* dh = (struct dnsheader*)question.c_str(); + if(dh->arcount) { unsigned int consumed=0; DNSName qname(question.c_str(), question.length(), sizeof(dnsheader), false, 0, 0, &consumed); @@ -1194,10 +1196,7 @@ string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fr } if(t_pdl->get()) { - struct dnsheader dh; - memcpy(&dh, response.c_str(), sizeof(dh)); - - if((*t_pdl)->ipfilter(fromaddr, destaddr, dh)) { + if((*t_pdl)->ipfilter(fromaddr, destaddr, *dh)) { if(!g_quiet) L<getTid()<<"/"<numProcesses()<<"] DROPPED question from "<