Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaAction is underdocumented #6346

Closed
Habbie opened this issue Mar 14, 2018 · 0 comments
Closed

LuaAction is underdocumented #6346

Habbie opened this issue Mar 14, 2018 · 0 comments

Comments

@Habbie
Copy link
Member

@Habbie Habbie commented Mar 14, 2018

  • Program: dnsdist
  • Issue type: Bug report

Short description

https://dnsdist.org/rules-actions.html#addLuaAction which links to https://dnsdist.org/reference/constants.html#dnsaction suggests that the Lua function should return a single value, being one of the DNSAction constants. However, this fails with LuaAction failed inside lua, returning ServFail: Trying to cast a lua variable from "number" to "NSt3__15tupleIJiNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEE" because dnsdist expects that constant plus a string. The dnsdistconf.lua example script in the repo does show this.

Environment

  • Operating system:
  • Software version: git master as of 385aa46
  • Software source: git

Steps to reproduce

  1. dnsdist.conf: (compare to the version in #6348 which does work as far as this ticket is concerned)
newServer('8.8.8.8')
function luarule(dq) if (dq.qtype==dnsdist.NAPTR) then return DNSAction.Nxdomain else return DNSAction.Allow end end
addLuaAction(AllRule(), luarule)
  1. [sudo] ./dnsdist -C dnsdist.conf
  2. send any query to dnsdist

Expected behaviour

A spoofed NXDOMAIN for NAPTR queries, normal processing otherwise.

Actual behaviour

dnsdist reports LuaAction failed inside lua, returning ServFail: Trying to cast a lua variable from "number" to "NSt3__15tupleIJiNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEEEE" and the client receives a SERVFAIL.

Other information

Proposed fixes (why not both):

  1. Improve the documentation in this area.
  2. Make the second return value optional for cases where it does not make sense (I think Nxdomain would qualify for that).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants