make asynchronous UDP Lua queries work again in 4.x #3293

Merged
merged 2 commits into from Jan 23, 2016

Projects

None yet

2 participants

@ahupowerdns
Member

Closes #3276 when merged.

@ahupowerdns ahupowerdns merged commit 335dd12 into PowerDNS:master Jan 23, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ahupowerdns ahupowerdns deleted the ahupowerdns:udpasy branch Jan 23, 2016
@janeczku janeczku commented on the diff Jan 23, 2016
pdns/lua-recursor4.cc
- if(!func) {
- theL()<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl;
- return false;
- }
- goto loop;
+ dq->udpAnswer = GenUDPQueryResponse(dq->udpQueryDest, dq->udpQuery);
+ auto func = d_lw->readVariable<boost::optional<luacall_t>>(dq->udpCallback).get_value_or(0);
+ if(!func) {
+ theL()<<Logger::Error<<"Attempted callback for Lua UDP Query/Response which could not be found"<<endl;
+ return false;
+ }
+ bool res=func(dq);
+ if(variable) *variable |= dq->variable; // could still be set to indicate this *name* is variable
+ if(!res) {
+ return false;
+ }
@janeczku
janeczku Jan 23, 2016

@ahupowerdns Thanks for fixing!
I think there is a ret=dq->rcode; missing here.
Otherwise setting dq.rcode in the callback will not take effect...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment