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

rec: Refactor Protobuf options, add query/response selection #6698

Merged
merged 3 commits into from
Aug 6, 2018

Conversation

rgacogne
Copy link
Member

Short description

  • Turn the protobuf options into a table because there are already too many of them
  • Split the masks applied to the initiator to a separate setProtobufMasks directive
  • Add the possibility to log only queries, or only responses
  • Add the possibility to select queries (FFI only) and responses for export from the Lua hooks
  • Add regression tests for the protobuf features

Closes #6361.

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)

@@ -1713,7 +1716,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
try {
const struct dnsheader* dh = (const struct dnsheader*) conn->data;

if (!luaconfsLocal->protobufTaggedOnly) {
if (logQuery && (!luaconfsLocal->protobufExportConfig.taggedOnly || !dc->d_policyTags.empty())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel writing it like this makes it easier to read:

if (logQuery && !(luaconfsLocal->protobufExportConfig.taggedOnly && dc->d_policyTags.empty())) {
...
}

Copy link
Member

@chbruyand chbruyand left a comment

Choose a reason for hiding this comment

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

LGTM

* ``asyncConnect``: bool - When set to false (default) the first connection to the server during startup will block up to ``timeout`` seconds, otherwise the connection is done in a separate thread, after the first message has been queued
* ``logQueries=true``: bool - Whether to export queries
* ``logResponses=true``: bool - Whether to export responses

Copy link
Member

Choose a reason for hiding this comment

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

Maybe adding a reference to setProtobufMasks() here would be great.

Copy link
Member

Choose a reason for hiding this comment

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

Just a curiosity, is there an option (would it be useful) to anonymize IPs using ipcipher ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe adding a reference to setProtobufMasks() here would be great.

Done!

Just a curiosity, is there an option (would it be useful) to anonymize IPs using ipcipher?

There isn't. While I totally agree it would be nice to have it, it's probably out of scope for this PR.

try {
ComboAddress server(server_);
lci.protobufExportConfig.server = ComboAddress(server_);
Copy link
Member

Choose a reason for hiding this comment

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

This will change protobuf server's IP address no matter it has already been enabled or not. I think it should be moved after line 365 (if (!lci.protobufExportConfig.enabled) {).

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, thanks!

- Turn the protobuf options into a table because there are already
too many of them
- Split the masks applied to the initiator to a separate
`setProtobufMasks` directive
- Add the possibility to log only queries, or only responses
- Add the possibility to select queries (FFI only) and responses
for export from the Lua hooks
- Add regression tests for the protobuf features
@rgacogne rgacogne merged commit 59d39a8 into PowerDNS:master Aug 6, 2018
@rgacogne rgacogne deleted the rec-pb-options branch August 6, 2018 07:25
@Habbie Habbie mentioned this pull request Aug 7, 2018
8 tasks
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.

recursor: add a flag to optionally send only questions or responses to the protobufServer
3 participants