Skip to content

Commit e26c334

Browse files
committed
Dedup only in specific places
1 parent fb4e019 commit e26c334

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

pdns/recursordist/pdns_recursor.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,9 @@ int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSReco
779779
}),
780780
ret.end());
781781
}
782+
else {
783+
pdns::dedupRecords(ret);
784+
}
782785
t_Counters.at(rec::Counter::dns64prefixanswers)++;
783786
return rcode;
784787
}
@@ -1509,7 +1512,9 @@ void startDoResolve(void* arg) // NOLINT(readability-function-cognitive-complexi
15091512
}
15101513

15111514
if (!ret.empty()) {
1515+
#ifdef notyet
15121516
pdns::dedupRecords(ret);
1517+
#endif
15131518
pdns::orderAndShuffle(ret, false);
15141519
if (auto listToSort = luaconfsLocal->sortlist.getOrderCmp(comboWriter->d_source)) {
15151520
stable_sort(ret.begin(), ret.end(), *listToSort);

pdns/recursordist/syncres.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,7 @@ bool SyncRes::doCNAMECacheCheck(const DNSName& qname, const QType qtype, vector<
27272727
// so you can't trust that a real lookup will have been made.
27282728
res = doResolve(newTarget, qtype, ret, depth + 1, beenthere, cnameContext);
27292729
LOG(prefix << qname << ": Updating validation state for response to " << qname << " from " << context.state << " with the state from the DNAME/CNAME quest: " << cnameContext.state << endl);
2730+
pdns::dedupRecords(ret); // multiple NSECS coudl be added, #14120
27302731
updateValidationState(qname, context.state, cnameContext.state, prefix);
27312732

27322733
return true;
@@ -4434,9 +4435,11 @@ void SyncRes::sanitizeRecordsPass2(const std::string& prefix, LWResult& lwr, con
44344435
}
44354436
lwr.d_records = std::move(vec);
44364437
}
4438+
#ifdef notyet
44374439
if (auto count = pdns::dedupRecords(lwr.d_records); count > 0) {
44384440
LOG(prefix << qname << ": Removed " << count << " duplicate records from response received from " << auth << endl);
44394441
}
4442+
#endif
44404443
}
44414444

44424445
void SyncRes::rememberParentSetIfNeeded(const DNSName& domain, const vector<DNSRecord>& newRecords, unsigned int depth, const string& prefix)

pdns/recursordist/test-syncres_cc5.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,7 @@ BOOST_AUTO_TEST_CASE(test_dnssec_validation_nsec3_nodata_nowildcard_duplicated_n
15751575
addRecordToLW(res, "a.gtld-servers.com.", QType::A, "192.0.2.1", DNSResourceRecord::ADDITIONAL, 3600);
15761576
return LWResult::Result::Success;
15771577
}
1578+
// The code below introduces duplicate NSEC3 records
15781579
if (address == ComboAddress("192.0.2.1:53")) {
15791580
setLWResult(res, 0, true, false, true);
15801581
/* no data */
@@ -1603,17 +1604,17 @@ BOOST_AUTO_TEST_CASE(test_dnssec_validation_nsec3_nodata_nowildcard_duplicated_n
16031604
int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret);
16041605
BOOST_CHECK_EQUAL(res, RCode::NoError);
16051606
BOOST_CHECK_EQUAL(sr->getValidationState(), vState::Secure);
1606-
/* the duplicated NSEC3 should have been dedupped */
1607-
BOOST_REQUIRE_EQUAL(ret.size(), 8U);
1607+
/* the duplicated NSEC3 have not been dedupped */
1608+
BOOST_REQUIRE_EQUAL(ret.size(), 9U);
16081609
BOOST_CHECK_EQUAL(queriesCount, 4U);
16091610

16101611
/* again, to test the cache */
16111612
ret.clear();
16121613
res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret);
16131614
BOOST_CHECK_EQUAL(res, RCode::NoError);
16141615
BOOST_CHECK_EQUAL(sr->getValidationState(), vState::Secure);
1615-
/* the duplicated NSEC3 should have been dedupped */
1616-
BOOST_REQUIRE_EQUAL(ret.size(), 8U);
1616+
/* the duplicated NSEC3 have not been dedupped */
1617+
BOOST_REQUIRE_EQUAL(ret.size(), 9U);
16171618
BOOST_CHECK_EQUAL(queriesCount, 4U);
16181619
}
16191620

0 commit comments

Comments
 (0)