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

Make dnsdist dynamic truncate do right thing on TCP/IP #5647

Merged
merged 3 commits into from Aug 28, 2017

Conversation

@ahupowerdns
Copy link
Contributor

@ahupowerdns ahupowerdns commented Aug 24, 2017

Winfried noted that our new dynamic truncation rule worked fine on UDP, but on TCP/IP a truncate would be converted into a drop, which was not the intended effect.
This commit makes dynamic truncate a NOOP on TCP.

Short description

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)
  • checked that this code was merged to master
Winfried noted that our new dynamic truncation rule worked fine on UDP, but on TCP/IP a truncate would be converted into a drop, which was not the intended effect.
This commit makes dynamic truncate a NOOP on TCP.
@ahupowerdns
Copy link
Contributor Author

@ahupowerdns ahupowerdns commented Aug 24, 2017

Note: there is already a test that should have caught this bug. However, that test did not function it appears. Still investigating.

@ahupowerdns
Copy link
Contributor Author

@ahupowerdns ahupowerdns commented Aug 24, 2017

test_DynBlocks.py:TestDynBlockQPSActionTruncated.testDynBlocksQRate

… dynamic truncation
@ahupowerdns ahupowerdns requested a review from pieterlexis Aug 25, 2017
Copy link
Member

@pieterlexis pieterlexis left a comment

2 nits, 2 questions. Test and code look as advertised in the PR 👍

dq.dh->qr = true;
return true;
}
else {

This comment has been minimized.

@pieterlexis

pieterlexis Aug 25, 2017
Member

nit: Personally, I am not a fan superfluous else statements. As there is already a return in the body of the if.

}
else {
vinfolog("Query from %s for %s over TCP *not* truncated because of dynamic block", dq.remote->toStringWithPort(), dq.qname->toString());
}
}
else {

This comment has been minimized.

@pieterlexis

pieterlexis Aug 25, 2017
Member

Shouldn't this block also do

g_stats.dynBlocked++;
got->blocks++;

This comment has been minimized.

@ahupowerdns

ahupowerdns Aug 25, 2017
Author Contributor

See above.

else {
vinfolog("Query from %s for %s over TCP *not* truncated because of dynamic block", dq.remote->toStringWithPort(), dq.qname->toString());
}

}
else {

This comment has been minimized.

@pieterlexis

pieterlexis Aug 25, 2017
Member

Shouldn't this block also do

g_stats.dynBlocked++;
got->blocks++;

This comment has been minimized.

@ahupowerdns

ahupowerdns Aug 25, 2017
Author Contributor

No, it precisely should not do that - on TCP "truncate" does nothing.

This comment has been minimized.

@pieterlexis

pieterlexis Aug 25, 2017
Member

This is in the 'dropped' block

This comment has been minimized.

@ahupowerdns

ahupowerdns Aug 25, 2017
Author Contributor

good catch, redoing.

dq.dh->qr = true;
return true;
}
else {

This comment has been minimized.

@pieterlexis

pieterlexis Aug 25, 2017
Member

nit: Personally, I am not a fan superfluous else statements. As there is already a return in the body of the if.

…the updating to a function
@ahupowerdns ahupowerdns merged commit 9600dfc into PowerDNS:master Aug 28, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
rgacogne added a commit to rgacogne/pdns that referenced this pull request Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants