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

Get rid of some allocs/copies in DNS parsing #6831

merged 5 commits into from Aug 8, 2018


Copy link

@rgacogne rgacogne commented Aug 7, 2018

Short description

This PR:

  • Prevents an allocation and copy of the DNS query or response passed to MOADNSParser, and get rid of the weird -12 dance (auth, rec) ;
  • Makes PacketReader accepts a string instead of a vector<uint18_t> so we don't need to allocate a vector and copy our data to it (auth, rec, dnsdist) ;
  • Removes a useless copy of the response in arecvfrom() (rec) ;
  • Removes some string allocations and copies during EDNS processing (dnsdist) ;
  • replaces a fixed 65k buffer allocated for every TCP connection by a dynamically allocated one (rec).


I have:

  • read the 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 added 4 commits Jul 20, 2018
Copy link

@chbruyand chbruyand left a comment


@@ -273,11 +273,12 @@ bool fixUpResponse(char** response, uint16_t* responseLen, size_t* responseSize,

if (ednsAdded || ecsAdded) {
char * optStart = NULL;
uint16_t optStart = NULL;

This comment has been minimized.


chbruyand Aug 7, 2018

Initializing this to NULL is confusing

This comment has been minimized.


rgacogne Aug 7, 2018
Author Member


@rgacogne rgacogne merged commit f8c8066 into PowerDNS:master Aug 8, 2018
4 checks passed
4 checks passed
LGTM analysis: C/C++ No alert changes
LGTM analysis: JavaScript No alert changes
LGTM analysis: Python No alert changes
continuous-integration/travis-ci/pr The Travis CI build passed
@rgacogne rgacogne deleted the rgacogne:no-moadns-copy branch Aug 8, 2018
@rgacogne rgacogne mentioned this pull request Aug 8, 2018
7 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants