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 expungeBySuffix function #5159

Merged
merged 1 commit into from Mar 17, 2017

Conversation

Projects
None yet
2 participants
@RobinGeuze
Contributor

RobinGeuze commented Mar 15, 2017

Short description

Adds an expungeBySuffix function that allows removing all names matching a suffix from cache. Closes #5109

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

Thanks a lot for this PR, very much appreciated! A few minor things to fix and it should be all good!

const CacheValue& value = it->second;
uint16_t cqtype = 0;
uint16_t cqclass = 0;
DNSName cqname(value.value.c_str(), value.len, sizeof(dnsheader), false, &cqtype, &cqclass, nullptr);

This comment has been minimized.

@rgacogne

rgacogne Mar 15, 2017

Member

The qname, qtype and qclass are stored in the cache entry, we don't need to parse them again. I just noticed DNSDistPacketCache::expungeByName() does the parsing too, which is awful, we should fix that!
Thinking about it a bit more, we should probably just add a boolean parameter to DNSDistPacketCache::expungeByName() and do an equal comparison or an isPartOf() one depending on the boolean value.

"""
misses = 0
ttl = 600
name = 'expungebyname.cache.tests.powerdns.com.'

This comment has been minimized.

@rgacogne

rgacogne Mar 15, 2017

Member

You are reusing the exact same qname than a previous test in the same suite (expungebyname.cache.tests.powerdns.com) so depending on the execution order it might already be cached and the expected miss below will fail. I'd advise using a different qname for each test to prevent this kind of issues.

"""
misses = 0
ttl = 600
name = 'expungebynameandtype.cache.tests.powerdns.com.'

This comment has been minimized.

@rgacogne

rgacogne Mar 15, 2017

Member

Same issue here, this name is used by another test of the same suite.

@rgacogne rgacogne added this to the dnsdist-1.2.0 milestone Mar 15, 2017

@RobinGeuze

This comment has been minimized.

Contributor

RobinGeuze commented Mar 16, 2017

I think the last commit should fix all your points.

@rgacogne

This comment has been minimized.

Member

rgacogne commented Mar 17, 2017

Looks good, thank you! Would you mind squashing a bit before I merge?

@RobinGeuze RobinGeuze force-pushed the RobinGeuze:addExpungeBySuffix branch from 8237526 to 490dc58 Mar 17, 2017

@RobinGeuze

This comment has been minimized.

Contributor

RobinGeuze commented Mar 17, 2017

All squashed :)

@rgacogne rgacogne merged commit e045624 into PowerDNS:master Mar 17, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment