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: Add an option to use several source ports toward a backend #6317

Merged
merged 5 commits into from Mar 22, 2018

Conversation

Projects
None yet
3 participants
@rgacogne
Member

rgacogne commented Mar 1, 2018

Short description

This is very useful if the backend is distributing queries based only on (source IP, source port, destination IP, destination port), which is for example the case of PowerDNS Recursor with several
threads, reuseport set and pdns-distribute-queries not set.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled and tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
@@ -216,6 +217,10 @@ void setupLuaConfig(bool client)
}
}
if(vars.count("sockets")) {
numberOfSockets=std::stoi(boost::get<string>(vars["sockets"]));

This comment has been minimized.

@zeha

zeha Mar 1, 2018

Collaborator

maybe add a check > 0

@rgacogne rgacogne changed the title from [WIP] dnsdist: Add an option to use several source ports toward a backend to dnsdist: Add an option to use several source ports toward a backend Mar 5, 2018

@rgacogne

This comment has been minimized.

Member

rgacogne commented Mar 5, 2018

Added a check that the number of sockets is greater than 0, handle more gracefully a failed (re-)connection, and updated the file descriptors check to account for more than one socket per backend.

@rgacogne

This comment has been minimized.

Member

rgacogne commented Mar 5, 2018

Note that the current implementation will not perform well with a large number of sockets per backend since it currently uses poll(). It would be better to use our existing multiplexer classes, but it requires:

  • removing / adding the socket descriptors to the multiplexer on reconnection ;
  • refactoring the existing code to support the multiplexer callback interface, or adding a new function to the multiplexer interface that would return a list of 'ready' file descriptors.

rgacogne added some commits Mar 1, 2018

dnsdist: Add an option to use several source ports toward a backend
This is very useful if the backend is distributing queries based
only on (source IP, source port, destination IP, destination port),
which is for example the case of PowerDNS Recursor with several
threads, reuseport set and pdns-distribute-queries not set.

@rgacogne rgacogne force-pushed the rgacogne:dnsdist-source-ports branch from 82c291b to cd73cee Mar 6, 2018

@rgacogne

This comment has been minimized.

Member

rgacogne commented Mar 15, 2018

Pushed an additional commit using our existing multiplexer code. I went with the second option described above, adding a new function to the multiplexer interface that returns a list of 'ready' file descriptors. This code needs a serious review before merging!

@pieterlexis pieterlexis merged commit bb066a4 into PowerDNS:master Mar 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rgacogne rgacogne deleted the rgacogne:dnsdist-source-ports branch Mar 22, 2018

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