From: Remi Gacogne Date: Tue, 20 Dec 2016 08:45:23 +0000 (+0100) Subject: Merge pull request #4758 from rgacogne/rec-dq-on-stack X-Git-Tag: dnsdist-1.1.0~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8689227aed53094b9c569181616edcd7fe5af70;p=pdns Merge pull request #4758 from rgacogne/rec-dq-on-stack rec: Allocate the DNSQuestion `dq` object on the stack --- c8689227aed53094b9c569181616edcd7fe5af70 diff --cc pdns/pdns_recursor.cc index 7bcbbbfa4,08ee4d101..9608e298b --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@@ -760,22 -740,18 +760,19 @@@ void startDoResolve(void *p bool variableAnswer = false; bool shouldNotValidate = false; - int res; + /* preresolve expects res (dq.rcode) to be set to RCode::NoError by default */ + int res = RCode::NoError; DNSFilterEngine::Policy appliedPolicy; DNSRecord spoofed; - std::shared_ptr dq = nullptr; - if (t_pdl->get() && (*t_pdl)->needDQ()) { - dq = std::make_shared(dc->d_remote, dc->d_local, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_tcp, variableAnswer, wantsRPZ); - dq->ednsFlags = &edo.d_Z; - dq->ednsOptions = &dc->d_ednsOpts; - dq->tag = dc->d_tag; - dq->discardedPolicies = &sr.d_discardedPolicies; - dq->policyTags = &dc->d_policyTags; - dq->appliedPolicy = &appliedPolicy; - dq->currentRecords = &ret; - dq->dh = &dc->d_mdp.d_header; - } + RecursorLua4::DNSQuestion dq(dc->d_remote, dc->d_local, dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_tcp, variableAnswer, wantsRPZ); + dq.ednsFlags = &edo.d_Z; + dq.ednsOptions = &dc->d_ednsOpts; + dq.tag = dc->d_tag; + dq.discardedPolicies = &sr.d_discardedPolicies; + dq.policyTags = &dc->d_policyTags; + dq.appliedPolicy = &appliedPolicy; + dq.currentRecords = &ret; + dq.dh = &dc->d_mdp.d_header; if(dc->d_mdp.d_qtype==QType::ANY && !dc->d_tcp && g_anyToTcp) { pw.getHeader()->tc = 1;