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: Implement LuaFFIRule, LuaFFIAction and LuaFFIResponseAction #8505

Merged
merged 20 commits into from
Feb 18, 2020

Conversation

rgacogne
Copy link
Member

@rgacogne rgacogne commented Nov 4, 2019

Short description

This PR implements:

  • LuaFFIRule: to be able to write a query/response selector in Lua using the FFI interface ;
  • LuaFFIAction: to be able to write actions in Lua using the FFI interface ;
  • LuaFFIResponseAction: to be able to write response actions in Lua using the FFI interface ;
  • LuaRule(): to be able to write a query/response selector in Lua (non-FFI version) ;
  • setServerPolicyLuaFFI: to be able to write server load-balancing policies in Lua using the FFI interface.

It also refactor the code around the server selection policies and backends, slightly speeding up some of the built-in C++ policies in the process, and adding unit tests for them.

Closes #7617.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@rgacogne
Copy link
Member Author

rgacogne commented Nov 4, 2019

I also spotted some remaining debug messages in the code :-)

@lgtm-com
Copy link

lgtm-com bot commented Nov 4, 2019

This pull request introduces 1 alert when merging 4eea956 into 930ed0c - view on LGTM.com

new alerts:

  • 1 for Missing header guard

@rgacogne
Copy link
Member Author

rgacogne commented Feb 7, 2020

Rebased to fix conflicts.

pdns/dnsdistdist/docs/reference/config.rst Outdated Show resolved Hide resolved
pdns/dnsdistdist/docs/guides/serverselection.rst Outdated Show resolved Hide resolved
pdns/dnsdist.hh Outdated Show resolved Hide resolved
pdns/dnsdistdist/docs/reference/netmask.rst Outdated Show resolved Hide resolved
@@ -172,6 +174,29 @@ void setupLuaBindings(bool client)

/* ComboAddress */
g_lua.writeFunction("newCA", [](const std::string& name) { return ComboAddress(name); });
g_lua.writeFunction("newCAFromRaw", [](const std::string& raw, boost::optional<uint16_t> port) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe document the new functions introduced here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is very specific to what we do with our own Lua FFI code, I'll ponder if it's worth documenting it.

@rgacogne
Copy link
Member Author

Thanks a lot for the review!

@rgacogne rgacogne merged commit d153929 into PowerDNS:master Feb 18, 2020
@rgacogne rgacogne deleted the dnsdist-lua-ffi branch February 18, 2020 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dnsdist: Lua FFI interface to selectors and actions
2 participants