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
merged 5 commits into from Aug 8, 2018

Conversation

Projects
None yet
2 participants
@rgacogne
Member

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).

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 added some commits Jul 20, 2018

@chbruyand

LGTM!

@@ -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

chbruyand Aug 7, 2018

Member

Initializing this to NULL is confusing

This comment has been minimized.

@rgacogne

rgacogne Aug 7, 2018

Member

Indeed!

@rgacogne rgacogne merged commit f8c8066 into PowerDNS:master Aug 8, 2018

4 checks passed

LGTM analysis: C/C++ No alert changes
Details
LGTM analysis: JavaScript No alert changes
Details
LGTM analysis: Python No alert changes
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rgacogne rgacogne deleted the rgacogne:no-moadns-copy branch Aug 8, 2018

@rgacogne rgacogne referenced this pull request Aug 8, 2018

Merged

dnsdist: add EDNSOptionRule #6803

7 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment