Skip to content

Commit

Permalink
Merge pull request #13543 from omoerbeek/rec-aggr-nsec3-empty
Browse files Browse the repository at this point in the history
rec: a single NSEC3 record covering everything is a special case
  • Loading branch information
omoerbeek committed Dec 1, 2023
2 parents 099d31d + 3f6fb38 commit a9fec78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pdns/recursordist/aggressive_nsec.cc
Expand Up @@ -261,6 +261,10 @@ static bool commonPrefixIsLong(const string& one, const string& two, size_t boun
bool AggressiveNSECCache::isSmallCoveringNSEC3(const DNSName& owner, const std::string& nextHash)
{
std::string ownerHash(fromBase32Hex(owner.getRawLabel(0)));
// Special case: empty zone, so the single NSEC3 covers everything. Prefix is long but we still want it cached.
if (ownerHash == nextHash) {
return false;
}
return commonPrefixIsLong(ownerHash, nextHash, AggressiveNSECCache::s_maxNSEC3CommonPrefix);
}

Expand Down
3 changes: 3 additions & 0 deletions pdns/recursordist/test-aggressive_nsec_cc.cc
Expand Up @@ -21,6 +21,9 @@ BOOST_AUTO_TEST_CASE(test_small_coverering_nsec3)
{"0ujhshp2lhmnpoo9qde4blg4gq3hgl99", "7ujhshp2lhmnpoo9qde4blg4gq3hgl9a", 2, false},
{"0ujhshp2lhmnpoo9qde4blg4gq3hgl99", "fujhshp2lhmnpoo9qde4blg4gq3hgl9a", 1, false},
{"0ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl9a", 1, false},
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 0, false},
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 1, false},
{"8ujhshp2lhmnpoo9qde4blg4gq3hgl99", "8ujhshp2lhmnpoo9qde4blg4gq3hgl99", 157, false},
};

for (const auto& [owner, next, boundary, result] : table) {
Expand Down

0 comments on commit a9fec78

Please sign in to comment.