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

SpoofAction constructor with (single-ip, options) does not work #9783

Closed
hhoffstaette opened this issue Nov 27, 2020 · 3 comments
Closed

SpoofAction constructor with (single-ip, options) does not work #9783

hhoffstaette opened this issue Nov 27, 2020 · 3 comments

Comments

@hhoffstaette
Copy link
Contributor

  • Program: dnsdist
  • Issue type: Bug report

Short description

Since 1.5 it should be possible to pass an options table to a SpoofAction constructor in order to set the TTL of the generated record. However this does not seem to work as expected:

dnsdist> SpoofAction("192.168.100.223", {ttl=3600})
Error: Unable to convert parameter from table to N5boost8optionalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE> 

On the other hand supplying a list of two or more addresses plus the trailing options works fine.

Environment

  • Operating system: Linux (Gentoo)
  • Software version: 1.5.1
  • Software source: package / built from source (gcc-10.2, boost-1.74)

Steps to reproduce

  1. SpoofAction("192.168.100.223") -> works
  2. SpoofAction("192.168.100.223", {ttl=3600}) -> does not work
  3. SpoofAction("192.168.100.223", "192.168.100.223", {ttl=3600}) -> works, but with duplicated entry

Other information

I suspect the function untangling the arguments has problems distinguishing between a single string and a list of strings, here. I don't understand enough about Lua/C++ value coercion and how boost::variant works to fix this myself though.

@hhoffstaette hhoffstaette changed the title SpoofAction with only (single-ip, options) does not work SpoofAction constructor with (single-ip, options) does not work Nov 27, 2020
@pieterlexis
Copy link
Contributor

in the docs the syntax is SpoofAction({ip|ips}[, options]), in the code it looks like SpoofAction({ip|ips}[, ip[, options]]). I wonder what the second argument is all about.

@rgacogne
Copy link
Member

I honestly don't know because we also take a list.. Let's get rid of it for 1.6.0?

@phonedph1
Copy link
Contributor

If anyone runs into this before they are on an updated version, @rgacogne pointed out this work around SpoofAction("10.10.10.10", nil, {aa=true})

chbruyand pushed a commit to chbruyand/pdns that referenced this issue Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants