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

[dnsdist] method getEDNSOptions on DNSResponse is nil #10262

Closed
leshow opened this issue Apr 5, 2021 · 1 comment · Fixed by #10267
Closed

[dnsdist] method getEDNSOptions on DNSResponse is nil #10262

leshow opened this issue Apr 5, 2021 · 1 comment · Fixed by #10267

Comments

@leshow
Copy link

leshow commented Apr 5, 2021

  • Program: dnsdist
  • Issue type: Bug report

Short description

calling getEDNSOptions() in:

function response(dr)
    opts = dr:getEDNSOptions()
    return DNSResponseAction.None
end
addResponseAction(AllRule(), LuaResponseAction(response))

Environment

Steps to reproduce

put the above in a dnsdist.conf, start with:

dnsdist -l 127.0.0.1:1953 1.1.1.1 --config dnsdist.conf

in another terminal query:

dig @127.0.0.1 -p 1953 google.com 
// +noedns or not will not make a difference here

dnsdist will output

Marking downstream 1.1.1.1:53 as 'up'
> Polled security status of version 1.5.1 at startup, no known issues reported: OK
LuaResponseAction failed inside Lua, returning ServFail: [string "chunk"]:12: attempt to call method 'getEDNSOptions' (a nil value)

Expected behaviour

getEDNSOptions should be callable and return a table of EDNSOptionsView

Actual behaviour

the method does not appear to exist

Other information

The docs say a DNSResponse "has all functions and members of DNSQuestion" and this method is available on DNSQuestion https://dnsdist.org/reference/dq.html#dnsresponse-object

Bit of a tangent here but, is it possible to mutate edns of a query through getEDNSOption? I'm not that familiar with lua but I'd like to add something to the opt section in this function

@leshow leshow changed the title [dnsdist] getEDNSOptions on DNSResponse is nil [dnsdist] method getEDNSOptions on DNSResponse is nil Apr 5, 2021
@Habbie Habbie added the dnsdist label Apr 5, 2021
@rgacogne
Copy link
Member

rgacogne commented Apr 6, 2021

We are once again bitten by LuaWrapper not supporting inheritance. I'll add the binding for the DNSResponse object as well.

Bit of a tangent here but, is it possible to mutate edns of a query through getEDNSOption? I'm not that familiar with lua but I'd like to add something to the opt section in this function

No, you will need to parse and edit the raw data using Lua if you want to edit the content of the response.

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

Successfully merging a pull request may close this issue.

3 participants