From: Otto Moerbeek Date: Thu, 18 Dec 2025 15:46:34 +0000 (+0100) Subject: Do away with std::optional for Routing tag X-Git-Tag: rec-5.4.0-beta1~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87c5597771348d16586f022ebda18bb28376c33a;p=thirdparty%2Fpdns.git Do away with std::optional for Routing tag Signed-off-by: Otto Moerbeek --- diff --git a/pdns/recursordist/aggressive_nsec.cc b/pdns/recursordist/aggressive_nsec.cc index b89b9d7232..513b8665db 100644 --- a/pdns/recursordist/aggressive_nsec.cc +++ b/pdns/recursordist/aggressive_nsec.cc @@ -503,7 +503,7 @@ bool AggressiveNSECCache::synthesizeFromNSEC3Wildcard(time_t now, const DNSName& std::vector wcSet; MemRecursorCache::SigRecs wcSignatures = MemRecursorCache::s_emptySigRecs; - if (g_recCache->get(now, wildcardName, type, MemRecursorCache::RequireAuth, &wcSet, ComboAddress("127.0.0.1"), boost::none, doDNSSEC ? &wcSignatures : nullptr, nullptr, nullptr, &cachedState) <= 0 || cachedState != vState::Secure) { + if (g_recCache->get(now, wildcardName, type, MemRecursorCache::RequireAuth, &wcSet, ComboAddress("127.0.0.1"), MemRecursorCache::NOTAG, doDNSSEC ? &wcSignatures : nullptr, nullptr, nullptr, &cachedState) <= 0 || cachedState != vState::Secure) { VLOG(log, name << ": Unfortunately we don't have a valid entry for " << wildcardName << ", so we cannot synthesize from that wildcard" << endl); return false; } @@ -527,7 +527,7 @@ bool AggressiveNSECCache::synthesizeFromNSECWildcard(time_t now, const DNSName& std::vector wcSet; MemRecursorCache::SigRecs wcSignatures = MemRecursorCache::s_emptySigRecs; - if (g_recCache->get(now, wildcardName, type, MemRecursorCache::RequireAuth, &wcSet, ComboAddress("127.0.0.1"), boost::none, doDNSSEC ? &wcSignatures : nullptr, nullptr, nullptr, &cachedState) <= 0 || cachedState != vState::Secure) { + if (g_recCache->get(now, wildcardName, type, MemRecursorCache::RequireAuth, &wcSet, ComboAddress("127.0.0.1"), MemRecursorCache::NOTAG, doDNSSEC ? &wcSignatures : nullptr, nullptr, nullptr, &cachedState) <= 0 || cachedState != vState::Secure) { VLOG(log, name << ": Unfortunately we don't have a valid entry for " << wildcardName << ", so we cannot synthesize from that wildcard" << endl); return false; } @@ -780,7 +780,7 @@ bool AggressiveNSECCache::getNSEC3Denial(time_t now, std::shared_ptr& ret, int& res, const ComboAddress& who, const boost::optional& routingTag, bool doDNSSEC, pdns::validation::ValidationContext& validationContext, const OptLog& log) +bool AggressiveNSECCache::getDenial(time_t now, const DNSName& name, const QType& type, std::vector& ret, int& res, const ComboAddress& who, const std::string& routingTag, bool doDNSSEC, pdns::validation::ValidationContext& validationContext, const OptLog& log) { std::shared_ptr> zoneEntry; if (type == QType::DS) { diff --git a/pdns/recursordist/aggressive_nsec.hh b/pdns/recursordist/aggressive_nsec.hh index faee812726..d462b0d9ed 100644 --- a/pdns/recursordist/aggressive_nsec.hh +++ b/pdns/recursordist/aggressive_nsec.hh @@ -63,7 +63,7 @@ public: } void insertNSEC(const DNSName& zone, const DNSName& owner, const DNSRecord& record, const std::vector>& signatures, bool nsec3, const DNSName& qname = g_rootdnsname, QType qtype = QType::ENT); - bool getDenial(time_t, const DNSName& name, const QType& type, std::vector& ret, int& res, const ComboAddress& who, const boost::optional& routingTag, bool doDNSSEC, pdns::validation::ValidationContext& validationContext, const OptLog& log = std::nullopt); + bool getDenial(time_t, const DNSName& name, const QType& type, std::vector& ret, int& res, const ComboAddress& who, const MemRecursorCache::OptTag& routingTag, bool doDNSSEC, pdns::validation::ValidationContext& validationContext, const OptLog& log = std::nullopt); void removeZoneInfo(const DNSName& zone, bool subzones); diff --git a/pdns/recursordist/recursor_cache.cc b/pdns/recursordist/recursor_cache.cc index 9ba58c13bc..55ff55ab01 100644 --- a/pdns/recursordist/recursor_cache.cc +++ b/pdns/recursordist/recursor_cache.cc @@ -79,6 +79,7 @@ bool MemRecursorCache::s_limitQTypeAny = true; const MemRecursorCache::AuthRecs MemRecursorCache::s_emptyAuthRecs = std::make_shared(); const MemRecursorCache::SigRecs MemRecursorCache::s_emptySigRecs = std::make_shared(); +const MemRecursorCache::OptTag MemRecursorCache::NOTAG{""}; void MemRecursorCache::resetStaticsForTests() { @@ -223,7 +224,7 @@ time_t MemRecursorCache::handleHit(time_t now, MapCombo::LockedContent& content, } origTTL = entry->d_orig_ttl; - if (!entry->d_netmask.empty() || entry->d_rtag) { + if (!entry->d_netmask.empty() || !entry->d_rtag.empty()) { ptrAssign(variable, true); } @@ -328,7 +329,7 @@ MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSInde /* we have nothing more specific for you */ break; } - auto key = std::tuple(qname, qtype, boost::none, best); + auto key = std::tuple(qname, qtype, NOTAG, best); auto entry = map.d_map.find(key); if (entry == map.d_map.end()) { /* ecsIndex is not up-to-date */ @@ -360,7 +361,7 @@ MemRecursorCache::cache_t::const_iterator MemRecursorCache::getEntryUsingECSInde } /* we have nothing specific, let's see if we have a generic one */ - auto key = std::tuple(qname, qtype, boost::none, Netmask()); + auto key = std::tuple(qname, qtype, MemRecursorCache::NOTAG, Netmask()); auto entry = map.d_map.find(key); if (entry != map.d_map.end()) { handleServeStaleBookkeeping(now, serveStale, entry); @@ -454,7 +455,7 @@ time_t MemRecursorCache::get(time_t now, const DNSName& qname, const QType qtype /* If we don't have any netmask-specific entries at all, let's just skip this to be able to use the nice d_cachecache hack. */ - if (qtype != QType::ANY && !lockedShard->d_ecsIndex.empty() && !routingTag) { + if (qtype != QType::ANY && !lockedShard->d_ecsIndex.empty() && routingTag.empty()) { if (qtype == QType::ADDR) { time_t ret = -1; @@ -494,7 +495,7 @@ time_t MemRecursorCache::get(time_t now, const DNSName& qname, const QType qtype return -1; } - if (routingTag) { + if (!routingTag.empty()) { auto entries = getEntries(*lockedShard, qname, qtype, routingTag); unsigned int found = 0; time_t ttd{}; @@ -541,7 +542,7 @@ time_t MemRecursorCache::get(time_t now, const DNSName& qname, const QType qtype } } // Try (again) without tag - auto entries = getEntries(*lockedShard, qname, qtype, boost::none); + auto entries = getEntries(*lockedShard, qname, qtype, NOTAG); if (entries.first != entries.second) { OrderedTagIterator_t firstIndexIterator; @@ -632,7 +633,7 @@ bool MemRecursorCache::CacheEntry::shouldReplace(time_t now, bool auth, vState s bool MemRecursorCache::replace(CacheEntry&& entry) { - if (!entry.d_netmask.empty() || entry.d_rtag) { + if (!entry.d_netmask.empty() || !entry.d_rtag.empty()) { // We don't handle that yet return false; } @@ -662,7 +663,7 @@ void MemRecursorCache::replace(time_t now, const DNSName& qname, const QType qty // We only store with a tag if we have an ednsmask and the tag is available // We only store an ednsmask if we do not have a tag and we do have a mask. - auto key = std::tuple(qname, qtype.getCode(), ednsmask ? routingTag : boost::none, (ednsmask && !routingTag) ? *ednsmask : Netmask()); + auto key = std::tuple(qname, qtype.getCode(), ednsmask ? routingTag : NOTAG, (ednsmask && routingTag.empty()) ? *ednsmask : Netmask()); bool isNew = false; cache_t::iterator stored = lockedShard->d_map.find(key); if (stored == lockedShard->d_map.end()) { @@ -678,7 +679,7 @@ void MemRecursorCache::replace(time_t now, const DNSName& qname, const QType qty */ if (isNew || stored->d_ttd <= now) { /* don't bother building an ecsIndex if we don't have any netmask-specific entries */ - if (!routingTag && ednsmask && !ednsmask->empty()) { + if (routingTag.empty() && ednsmask && !ednsmask->empty()) { auto ecsIndexKey = std::tuple(qname, qtype.getCode()); auto ecsIndex = lockedShard->d_ecsIndex.find(ecsIndexKey); if (ecsIndex == lockedShard->d_ecsIndex.end()) { @@ -881,7 +882,7 @@ bool MemRecursorCache::updateValidationStatus(time_t now, const DNSName& qname, auto map = content.lock(); bool updated = false; - if (!map->d_ecsIndex.empty() && !routingTag) { + if (!map->d_ecsIndex.empty() && routingTag.empty()) { auto entry = getEntryUsingECSIndex(*map, now, qname, qtype, requireAuth, who, false); // XXX serveStale? if (entry == map->d_map.end()) { return false; @@ -949,7 +950,7 @@ uint64_t MemRecursorCache::doDump(int fileDesc, size_t maxCacheEntries) for (const auto& record : recordSet.d_records) { count++; try { - fprintf(filePtr.get(), "%s %" PRIu32 " %" PRId64 " IN %s %s ; (%s) auth=%i zone=%s from=%s nm=%s rtag=%s ss=%hd%s%s\n", recordSet.d_qname.toString().c_str(), recordSet.d_orig_ttl, static_cast(recordSet.d_ttd - now), recordSet.d_qtype.toString().c_str(), record->getZoneRepresentation().c_str(), vStateToString(recordSet.d_state).c_str(), static_cast(recordSet.d_auth), recordSet.d_authZone.toLogString().c_str(), recordSet.d_from.toString().c_str(), recordSet.d_netmask.empty() ? "" : recordSet.d_netmask.toString().c_str(), recordSet.d_rtag.value_or("").c_str(), recordSet.d_servedStale, recordSet.d_tooBig ? " (too big!)" : "", recordSet.d_tcp ? " tcp" : ""); + fprintf(filePtr.get(), "%s %" PRIu32 " %" PRId64 " IN %s %s ; (%s) auth=%i zone=%s from=%s nm=%s rtag=%s ss=%hd%s%s\n", recordSet.d_qname.toString().c_str(), recordSet.d_orig_ttl, static_cast(recordSet.d_ttd - now), recordSet.d_qtype.toString().c_str(), record->getZoneRepresentation().c_str(), vStateToString(recordSet.d_state).c_str(), static_cast(recordSet.d_auth), recordSet.d_authZone.toLogString().c_str(), recordSet.d_from.toString().c_str(), recordSet.d_netmask.empty() ? "" : recordSet.d_netmask.toString().c_str(), recordSet.d_rtag.c_str(), recordSet.d_servedStale, recordSet.d_tooBig ? " (too big!)" : "", recordSet.d_tcp ? " tcp" : ""); } catch (...) { fprintf(filePtr.get(), "; error printing '%s'\n", recordSet.d_qname.empty() ? "EMPTY" : recordSet.d_qname.toString().c_str()); @@ -1049,8 +1050,8 @@ void MemRecursorCache::getRecordSet(T& message, U recordSet) message.add_bytes(PBCacheEntry::required_bytes_authZone, recordSet->d_authZone.toString()); encodeComboAddress(message, PBCacheEntry::required_message_from, recordSet->d_from); encodeNetmask(message, PBCacheEntry::optional_bytes_netmask, recordSet->d_netmask); - if (recordSet->d_rtag) { - message.add_bytes(PBCacheEntry::optional_bytes_rtag, *recordSet->d_rtag); + if (!recordSet->d_rtag.empty()) { + message.add_bytes(PBCacheEntry::optional_bytes_rtag, recordSet->d_rtag); } message.add_uint32(PBCacheEntry::required_uint32_state, static_cast(recordSet->d_state)); message.add_int64(PBCacheEntry::required_int64_ttd, recordSet->d_ttd); @@ -1151,7 +1152,7 @@ bool MemRecursorCache::putRecordSet(T& message) { AuthRecsVec authRecs; SigRecsVec sigRecs; - CacheEntry cacheEntry{{g_rootdnsname, QType::A, boost::none, Netmask()}, false}; + CacheEntry cacheEntry{{g_rootdnsname, QType::A, NOTAG, Netmask()}, false}; while (message.next()) { switch (message.tag()) { case PBCacheEntry::repeated_bytes_record: { @@ -1295,11 +1296,3 @@ size_t MemRecursorCache::putRecordSets(const std::string& pbuf) } return 0; } - -namespace boost -{ -size_t hash_value(const MemRecursorCache::OptTag& rtag) -{ - return rtag ? hash_value(rtag.value()) : 0xcafebaaf; -} -} diff --git a/pdns/recursordist/recursor_cache.hh b/pdns/recursordist/recursor_cache.hh index 5d64ce4ffc..bc70193ad8 100644 --- a/pdns/recursordist/recursor_cache.hh +++ b/pdns/recursordist/recursor_cache.hh @@ -65,7 +65,8 @@ public: size_t getRecordSets(size_t perShard, size_t maxSize, std::string& ret); size_t putRecordSets(const std::string& pbuf); - using OptTag = boost::optional; + using OptTag = std::string; + const static OptTag NOTAG; using Flags = uint8_t; static constexpr Flags None = 0; @@ -102,9 +103,9 @@ public: bool d_tcp{false}; }; - [[nodiscard]] time_t get(time_t, const DNSName& qname, QType qtype, Flags flags, vector* res, const ComboAddress& who, const OptTag& routingTag = boost::none, SigRecs* signatures = nullptr, AuthRecs* authorityRecs = nullptr, bool* variable = nullptr, vState* state = nullptr, bool* wasAuth = nullptr, DNSName* fromAuthZone = nullptr, Extra* extra = nullptr); + [[nodiscard]] time_t get(time_t, const DNSName& qname, QType qtype, Flags flags, vector* res, const ComboAddress& who, const OptTag& routingTag = NOTAG, SigRecs* signatures = nullptr, AuthRecs* authorityRecs = nullptr, bool* variable = nullptr, vState* state = nullptr, bool* wasAuth = nullptr, DNSName* fromAuthZone = nullptr, Extra* extra = nullptr); - void replace(time_t, const DNSName& qname, QType qtype, const vector& content, const SigRecsVec& signatures, const AuthRecsVec& authorityRecs, bool auth, const DNSName& authZone, const std::optional& ednsmask = std::nullopt, const OptTag& routingTag = boost::none, vState state = vState::Indeterminate, const std::optional& extra = std::nullopt, bool refresh = false, time_t ttl_time = time(nullptr)); + void replace(time_t, const DNSName& qname, QType qtype, const vector& content, const SigRecsVec& signatures, const AuthRecsVec& authorityRecs, bool auth, const DNSName& authZone, const std::optional& ednsmask = std::nullopt, const OptTag& routingTag = NOTAG, vState state = vState::Indeterminate, const std::optional& extra = std::nullopt, bool refresh = false, time_t ttl_time = time(nullptr)); void doPrune(time_t now, size_t keep); uint64_t doDump(int fileDesc, size_t maxCacheEntries); @@ -389,8 +390,3 @@ private: static void updateStaleEntry(time_t now, OrderedTagIterator_t& entry); static void handleServeStaleBookkeeping(time_t, bool, OrderedTagIterator_t&); }; - -namespace boost -{ -size_t hash_value(const MemRecursorCache::OptTag& rtag); -} diff --git a/pdns/recursordist/reczones-helpers.cc b/pdns/recursordist/reczones-helpers.cc index 0e9cf67fdf..943c322168 100644 --- a/pdns/recursordist/reczones-helpers.cc +++ b/pdns/recursordist/reczones-helpers.cc @@ -41,7 +41,7 @@ static void putIntoCache(time_t now, QType qtype, vState state, const ComboAddre // Put non-default root hints into cache as authoritative. As argued below in // putDefaultHintsIntoCache, this is actually wrong, but people might depend on it by having // root-hints that refer to servers that aren't actually capable or willing to serve root data. - g_recCache->replace(now, name, qtype, aset, {}, {}, true, g_rootdnsname, std::nullopt, boost::none, state, MemRecursorCache::Extra{from, false}); + g_recCache->replace(now, name, qtype, aset, {}, {}, true, g_rootdnsname, std::nullopt, MemRecursorCache::NOTAG, state, MemRecursorCache::Extra{from, false}); } } @@ -158,11 +158,11 @@ void putDefaultHintsIntoCache(time_t now, std::vector& nsvec) * auth and will expire at the same time. A re-prime is then triggered, as before, when the * records were inserted with the auth bit set and the TTD comes. */ - g_recCache->replace(now, DNSName(templ), QType::A, {arr}, {}, {}, false, g_rootdnsname, std::nullopt, boost::none, vState::Insecure, MemRecursorCache::Extra{from, false}); + g_recCache->replace(now, DNSName(templ), QType::A, {arr}, {}, {}, false, g_rootdnsname, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, MemRecursorCache::Extra{from, false}); } if (!rootIps6.at(letter).empty()) { aaaarr.setContent(std::make_shared(ComboAddress(rootIps6.at(letter)))); - g_recCache->replace(now, DNSName(templ), QType::AAAA, {aaaarr}, {}, {}, false, g_rootdnsname, std::nullopt, boost::none, vState::Insecure, MemRecursorCache::Extra{from, false}); + g_recCache->replace(now, DNSName(templ), QType::AAAA, {aaaarr}, {}, {}, false, g_rootdnsname, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, MemRecursorCache::Extra{from, false}); } } } diff --git a/pdns/recursordist/reczones.cc b/pdns/recursordist/reczones.cc index 501c06b440..8192a045ba 100644 --- a/pdns/recursordist/reczones.cc +++ b/pdns/recursordist/reczones.cc @@ -56,7 +56,7 @@ bool primeHints(time_t now) } g_recCache->doWipeCache(g_rootdnsname, false, QType::NS); - g_recCache->replace(now, g_rootdnsname, QType::NS, nsvec, {}, {}, false, g_rootdnsname, std::nullopt, boost::none, vState::Insecure, MemRecursorCache::Extra{ComboAddress("255.255.255.255"), false}); // and stuff in the cache + g_recCache->replace(now, g_rootdnsname, QType::NS, nsvec, {}, {}, false, g_rootdnsname, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, MemRecursorCache::Extra{ComboAddress("255.255.255.255"), false}); // and stuff in the cache return ret; } diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index dadb92bfb6..ed6df9974e 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -4836,7 +4836,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, const string& g_negCache->wipeTyped(tCacheEntry->first.name, tCacheEntry->first.type); } - if (g_aggressiveNSECCache && thisRRNeedsWildcardProof && recordState == vState::Secure && tCacheEntry->first.place == DNSResourceRecord::ANSWER && !tCacheEntry->second.signatures.empty() && !d_routingTag && !ednsmask) { + if (g_aggressiveNSECCache && thisRRNeedsWildcardProof && recordState == vState::Secure && tCacheEntry->first.place == DNSResourceRecord::ANSWER && !tCacheEntry->second.signatures.empty() && d_routingTag.empty() && !ednsmask) { /* we have an answer synthesized from a wildcard and aggressive NSEC is enabled, we need to store the wildcard in its non-expanded form in the cache to be able to synthesize wildcard answers later */ const auto& rrsig = tCacheEntry->second.signatures.at(0); @@ -4853,7 +4853,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, const string& content.push_back(std::move(nonExpandedRecord)); } - g_recCache->replace(d_now.tv_sec, realOwner, QType(tCacheEntry->first.type), content, tCacheEntry->second.signatures, /* no additional records in that case */ {}, tCacheEntry->first.type == QType::DS ? true : isAA, auth, std::nullopt, boost::none, recordState, MemRecursorCache::Extra{remoteIP, overTCP}, d_refresh, tCacheEntry->second.d_ttl_time); + g_recCache->replace(d_now.tv_sec, realOwner, QType(tCacheEntry->first.type), content, tCacheEntry->second.signatures, /* no additional records in that case */ {}, tCacheEntry->first.type == QType::DS ? true : isAA, auth, std::nullopt, MemRecursorCache::NOTAG, recordState, MemRecursorCache::Extra{remoteIP, overTCP}, d_refresh, tCacheEntry->second.d_ttl_time); } } } diff --git a/pdns/recursordist/syncres.hh b/pdns/recursordist/syncres.hh index 322f502d5b..870bd946d4 100644 --- a/pdns/recursordist/syncres.hh +++ b/pdns/recursordist/syncres.hh @@ -590,7 +590,7 @@ public: std::unordered_map d_discardedPolicies; DNSFilterEngine::Policy d_appliedPolicy; std::unordered_set d_policyTags; - boost::optional d_routingTag; + std::string d_routingTag; ComboAddress d_fromAuthIP; RecEventTrace d_eventTrace; pdns::trace::InitialSpanInfo d_otTrace; diff --git a/pdns/recursordist/test-aggressive_nsec_cc.cc b/pdns/recursordist/test-aggressive_nsec_cc.cc index a9cca57a1b..04a501e8df 100644 --- a/pdns/recursordist/test-aggressive_nsec_cc.cc +++ b/pdns/recursordist/test-aggressive_nsec_cc.cc @@ -1323,7 +1323,7 @@ static bool getDenialWrapper(std::unique_ptr& cache, time_t std::vector results; pdns::validation::ValidationContext validationContext; validationContext.d_nsec3IterationsRemainingQuota = std::numeric_limits::max(); - bool found = cache->getDenial(now, name, qtype, results, res, ComboAddress("192.0.2.1"), boost::none, true, validationContext); + bool found = cache->getDenial(now, name, qtype, results, res, ComboAddress("192.0.2.1"), MemRecursorCache::NOTAG, true, validationContext); if (expectedResult) { BOOST_CHECK_EQUAL(res, *expectedResult); } @@ -1356,7 +1356,7 @@ BOOST_AUTO_TEST_CASE(test_aggressive_nsec3_rollover) drSOA.d_place = DNSResourceRecord::ANSWER; records.push_back(drSOA); - g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, boost::none, vState::Secure); + g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, MemRecursorCache::NOTAG, vState::Secure); BOOST_CHECK_EQUAL(g_recCache->size(), 1U); std::string oldSalt = "ab"; @@ -1473,7 +1473,7 @@ BOOST_AUTO_TEST_CASE(test_aggressive_nsec_ancestor_cases) drSOA.d_place = DNSResourceRecord::ANSWER; records.push_back(drSOA); - g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, boost::none, vState::Secure); + g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, MemRecursorCache::NOTAG, vState::Secure); BOOST_CHECK_EQUAL(g_recCache->size(), 1U); { @@ -1631,7 +1631,7 @@ BOOST_AUTO_TEST_CASE(test_aggressive_nsec3_ancestor_cases) drSOA.d_place = DNSResourceRecord::ANSWER; records.push_back(drSOA); - g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, boost::none, vState::Secure); + g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, MemRecursorCache::NOTAG, vState::Secure); BOOST_CHECK_EQUAL(g_recCache->size(), 1U); const std::string salt("ab"); @@ -1951,7 +1951,7 @@ BOOST_AUTO_TEST_CASE(test_aggressive_max_nsec3_hash_cost) drSOA.d_place = DNSResourceRecord::ANSWER; records.push_back(drSOA); - g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, boost::none, vState::Secure); + g_recCache->replace(now, zone, QType(QType::SOA), records, {}, {}, true, zone, std::nullopt, MemRecursorCache::NOTAG, vState::Secure); BOOST_CHECK_EQUAL(g_recCache->size(), 1U); auto insertNSEC3s = [zone, now](std::unique_ptr& cache, const std::string& salt, unsigned int iterationsCount) -> void { diff --git a/pdns/recursordist/test-recursorcache_cc.cc b/pdns/recursordist/test-recursorcache_cc.cc index 9eb591e20a..42d9a274c3 100644 --- a/pdns/recursordist/test-recursorcache_cc.cc +++ b/pdns/recursordist/test-recursorcache_cc.cc @@ -283,20 +283,20 @@ static void simple(time_t now) // insert Secure record records.push_back(dr2); - MRC.replace(now, power, QType(QType::A), records, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::Secure); + MRC.replace(now, power, QType(QType::A), records, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::Secure); BOOST_CHECK_EQUAL(MRC.size(), 1U); vState retrievedState = vState::Indeterminate; bool wasAuth = false; - BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), boost::none, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), (ttd - now)); + BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), (ttd - now)); BOOST_CHECK_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(vStateToString(retrievedState), vStateToString(vState::Secure)); BOOST_CHECK_EQUAL(wasAuth, true); // try to replace that with a Bogus record - MRC.replace(now, power, QType(QType::A), records, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::BogusNoRRSIG); + MRC.replace(now, power, QType(QType::A), records, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::BogusNoRRSIG); BOOST_CHECK_EQUAL(MRC.size(), 1U); retrievedState = vState::Indeterminate; wasAuth = false; - BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), boost::none, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), (ttd - now)); + BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), (ttd - now)); BOOST_CHECK_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(vStateToString(retrievedState), vStateToString(vState::Secure)); BOOST_CHECK_EQUAL(wasAuth, true); @@ -584,11 +584,11 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingExpiredEntries) /* the remaining entry should be power2, but to get it we need to go back in the past a bit */ - BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), 1); + BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), 1); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr2Content.toString()); /* check that power1 is gone */ - BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); /* clear everything up */ MRC.doWipeCache(DNSName("."), true); @@ -605,7 +605,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingExpiredEntries) BOOST_CHECK_EQUAL(MRC.size(), 2U); /* trigger a miss (expired) for power2 */ - BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); /* power2 should have been moved to the front of the expunge queue, and should this time be removed first */ @@ -617,11 +617,11 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingExpiredEntries) /* the remaining entry should be power1, but to get it we need to go back in the past a bit */ - BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), 1); + BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), 1); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr1Content.toString()); /* check that power2 is gone */ - BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(ttd - 1, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); } BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingValidEntries) @@ -677,11 +677,11 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingValidEntries) BOOST_CHECK_EQUAL(MRC.size(), 1U); /* the remaining entry should be power2 */ - BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), ttd - now); + BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), ttd - now); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr2Content.toString()); /* check that power1 is gone */ - BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); /* clear everything up */ MRC.doWipeCache(DNSName("."), true); @@ -711,11 +711,11 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingValidEntries) BOOST_CHECK_EQUAL(MRC.size(), 1U); /* the remaining entry should be power1 */ - BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), ttd - now); + BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), ttd - now); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr1Content.toString()); /* check that power2 is gone */ - BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); /* clear everything up */ MRC.doWipeCache(DNSName("."), true); @@ -732,7 +732,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingValidEntries) BOOST_CHECK_EQUAL(MRC.size(), 2U); /* get a hit for power1 */ - BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), ttd - now); + BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), ttd - now); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr1Content.toString()); @@ -743,11 +743,11 @@ BOOST_AUTO_TEST_CASE(test_RecursorCache_ExpungingValidEntries) BOOST_CHECK_EQUAL(MRC.size(), 1U); /* the remaining entry should be power1 */ - BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), ttd - now); + BOOST_CHECK_EQUAL(MRC.get(now, power1, QType(dr1.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), ttd - now); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr1Content.toString()); /* check that power2 is gone */ - BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, boost::none, nullptr), -1); + BOOST_CHECK_EQUAL(MRC.get(now, power2, QType(dr2.d_type), MemRecursorCache::None, &retrieved, who, MemRecursorCache::NOTAG, nullptr), -1); MRC.doPrune(now, 0); BOOST_CHECK_EQUAL(MRC.size(), 0U); @@ -1090,7 +1090,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheTagged) BOOST_CHECK_EQUAL(MRC.size(), 0U); // An entry without edns subnet gets stored without tag as well - MRC.replace(ttd, DNSName("hello"), QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, boost::none); + MRC.replace(ttd, DNSName("hello"), QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG); MRC.replace(ttd, DNSName("hello"), QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, string("mytag")); BOOST_CHECK_EQUAL(MRC.size(), 1U); BOOST_CHECK_EQUAL(MRC.doWipeCache(DNSName("hello"), false, QType::A), 1U); @@ -1118,7 +1118,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheTagged) int64_t expected = counter; for (counter = 0; counter < 110; counter++) { - if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, nobody, boost::none) > 0) { + if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, nobody, MemRecursorCache::NOTAG) > 0) { matches++; BOOST_CHECK_EQUAL(retrieved.size(), rset0.size()); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr0Content.toString()); @@ -1155,7 +1155,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheTagged) matches = 0; for (counter = 0; counter < 110; counter++) { - if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, nobody, boost::none) > 0) { + if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, nobody, MemRecursorCache::NOTAG) > 0) { matches++; BOOST_CHECK_EQUAL(retrieved.size(), rset0.size()); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr0Content.toString()); @@ -1239,7 +1239,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheTagged) BOOST_CHECK_EQUAL(retrieved.size(), 0U); // insert a new entry without tag - MRC.replace(now, power, QType(QType::A), rset2, signatures, authRecords, true, authZone, std::optional("192.0.3.0/24"), boost::none); + MRC.replace(now, power, QType(QType::A), rset2, signatures, authRecords, true, authZone, std::optional("192.0.3.0/24"), MemRecursorCache::NOTAG); BOOST_CHECK_EQUAL(MRC.size(), 2U); // tagged specific should be returned for a matching tag @@ -1248,28 +1248,28 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheTagged) BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr1Content.toString()); // if no tag given nothing should be retrieved if address doesn't match - BOOST_CHECK_LT(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), boost::none), 0); + BOOST_CHECK_LT(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("127.0.0.1"), MemRecursorCache::NOTAG), 0); BOOST_REQUIRE_EQUAL(retrieved.size(), 0U); // if no tag given and no-non-tagged entries matches nothing should be returned - BOOST_CHECK_LT(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.2.2"), boost::none), 0); + BOOST_CHECK_LT(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.2.2"), MemRecursorCache::NOTAG), 0); BOOST_REQUIRE_EQUAL(retrieved.size(), 0U); // Insert untagged entry with no netmask - MRC.replace(now, power, QType(QType::A), rset3, signatures, authRecords, true, authZone, std::nullopt, boost::none); + MRC.replace(now, power, QType(QType::A), rset3, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG); BOOST_CHECK_EQUAL(MRC.size(), 3U); // Retrieval with no address and no tag should get that one - BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress(), boost::none), (ttd - now)); + BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress(), MemRecursorCache::NOTAG), (ttd - now)); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr3Content.toString()); // If no tag given match non-tagged entry - BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.2.2"), boost::none), (ttd - now)); + BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.2.2"), MemRecursorCache::NOTAG), (ttd - now)); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr3Content.toString()); // If no tag given we should be able to retrieve the netmask specific record - BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.3.1"), boost::none), (ttd - now)); + BOOST_CHECK_EQUAL(MRC.get(now, power, QType(QType::A), MemRecursorCache::None, &retrieved, ComboAddress("192.0.3.1"), MemRecursorCache::NOTAG), (ttd - now)); BOOST_REQUIRE_EQUAL(retrieved.size(), 1U); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr2Content.toString()); @@ -1333,7 +1333,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheDumpAndRestore) DNSName a = DNSName("hello ") + DNSName(std::to_string(counter)); BOOST_CHECK_EQUAL(DNSName(a.toString()), a); - MRC.replace(now, a, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::Insecure, authAddress, false, ttl_time); + MRC.replace(now, a, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, authAddress, false, ttl_time); } BOOST_CHECK_EQUAL(MRC.size(), expected); @@ -1349,7 +1349,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorCacheDumpAndRestore) bool wasAuth = false; DNSName fromZone; MemRecursorCache::Extra extra; - if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, somebody, boost::none, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { + if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, somebody, MemRecursorCache::NOTAG, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { matches++; BOOST_CHECK_EQUAL(retrieved.size(), rset0.size()); BOOST_CHECK_EQUAL(getRR(retrieved.at(0))->getCA().toString(), dr0Content.toString()); @@ -1425,8 +1425,8 @@ BOOST_AUTO_TEST_CASE(test_RecursorAuthRecords) const time_t ttl_time = 90; DNSName aname = DNSName("hello "); - MRC.replace(now, aname, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::Insecure, authAddress, false, ttl_time); - MRC.replace(now, aname, QType(QType::AAAA), rset0, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::Insecure, authAddress, false, ttl_time); + MRC.replace(now, aname, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, authAddress, false, ttl_time); + MRC.replace(now, aname, QType(QType::AAAA), rset0, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, authAddress, false, ttl_time); std::vector retrieved; MemRecursorCache::AuthRecs authRecs; @@ -1436,7 +1436,7 @@ BOOST_AUTO_TEST_CASE(test_RecursorAuthRecords) bool wasAuth = false; DNSName fromZone; MemRecursorCache::Extra extra; - if (MRC.get(now, aname, QType(QType::ANY), MemRecursorCache::None, &retrieved, somebody, boost::none, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { + if (MRC.get(now, aname, QType(QType::ANY), MemRecursorCache::None, &retrieved, somebody, MemRecursorCache::NOTAG, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { BOOST_CHECK_EQUAL(retrieved.size(), 2U); } } @@ -1537,7 +1537,7 @@ struct RecordsSpeedTest DNSName a = DNSName("hello ") + DNSName(std::to_string(counter)); BOOST_CHECK_EQUAL(DNSName(a.toString()), a); - MRC.replace(now, a, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, boost::none, vState::Insecure, MemRecursorCache::Extra{somebody, false}, false, ttl_time); + MRC.replace(now, a, QType(QType::A), rset0, signatures, authRecords, true, authZone, std::nullopt, MemRecursorCache::NOTAG, vState::Insecure, MemRecursorCache::Extra{somebody, false}, false, ttl_time); } BOOST_CHECK_EQUAL(MRC.size(), expected); @@ -1555,7 +1555,7 @@ struct RecordsSpeedTest bool wasAuth = false; DNSName fromZone; MemRecursorCache::Extra extra; - if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, somebody, boost::none, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { + if (MRC.get(now, DNSName("hello ") + DNSName(std::to_string(counter)), QType(QType::A), MemRecursorCache::None, &retrieved, somebody, MemRecursorCache::NOTAG, &sigs, &authRecs, &variable, &state, &wasAuth, &fromZone, &extra) > 0) { BOOST_CHECK_EQUAL(somebody.toString(), extra.d_address.toString()); BOOST_CHECK(!extra.d_tcp); matches++; diff --git a/pdns/recursordist/test-syncres_cc2.cc b/pdns/recursordist/test-syncres_cc2.cc index b46e41b65b..32a80fb38c 100644 --- a/pdns/recursordist/test-syncres_cc2.cc +++ b/pdns/recursordist/test-syncres_cc2.cc @@ -1851,12 +1851,12 @@ BOOST_AUTO_TEST_CASE(test_cache_almost_expired_ttl) std::vector> sigs; addRecordToList(records, target, QType::A, "192.0.2.2", DNSResourceRecord::ANSWER, now + 29); - g_recCache->replace(now - 30, target, QType(QType::A), records, sigs, {}, true, g_rootdnsname, std::optional(), boost::none, vState::Indeterminate, std::nullopt, false, now - 31); + g_recCache->replace(now - 30, target, QType(QType::A), records, sigs, {}, true, g_rootdnsname, std::optional(), MemRecursorCache::NOTAG, vState::Indeterminate, std::nullopt, false, now - 31); /* Same for the NS record */ std::vector ns; addRecordToList(ns, target, QType::NS, "pdns-public-ns1.powerdns.com", DNSResourceRecord::ANSWER, now + 29); - g_recCache->replace(now - 30, target, QType::NS, ns, sigs, {}, false, target, std::optional(), boost::none, vState::Indeterminate, std::nullopt, false, now - 31); + g_recCache->replace(now - 30, target, QType::NS, ns, sigs, {}, false, target, std::optional(), MemRecursorCache::NOTAG, vState::Indeterminate, std::nullopt, false, now - 31); vector ret; int res = sr->beginResolve(target, QType(QType::A), QClass::IN, ret); diff --git a/pdns/recursordist/test-syncres_cc3.cc b/pdns/recursordist/test-syncres_cc3.cc index 1f3101cc2c..db79d738b4 100644 --- a/pdns/recursordist/test-syncres_cc3.cc +++ b/pdns/recursordist/test-syncres_cc3.cc @@ -427,7 +427,7 @@ BOOST_AUTO_TEST_CASE(test_answer_no_aa) const ComboAddress who; vector cached; MemRecursorCache::SigRecs signatures; - BOOST_REQUIRE_GT(g_recCache->get(now, target, QType(QType::A), MemRecursorCache::None, &cached, who, boost::none, &signatures), 0); + BOOST_REQUIRE_GT(g_recCache->get(now, target, QType(QType::A), MemRecursorCache::None, &cached, who, MemRecursorCache::NOTAG, &signatures), 0); } BOOST_AUTO_TEST_CASE(test_special_types) diff --git a/pdns/recursordist/test-syncres_cc8.cc b/pdns/recursordist/test-syncres_cc8.cc index 49a5b631b1..190da7c6c8 100644 --- a/pdns/recursordist/test-syncres_cc8.cc +++ b/pdns/recursordist/test-syncres_cc8.cc @@ -1368,7 +1368,7 @@ BOOST_AUTO_TEST_CASE(test_dnssec_rrsig_cache_validity) const ComboAddress who; vector cached; MemRecursorCache::SigRecs signatures; - BOOST_REQUIRE_EQUAL(g_recCache->get(tnow, target, QType(QType::A), MemRecursorCache::RequireAuth, &cached, who, boost::none, &signatures), 1); + BOOST_REQUIRE_EQUAL(g_recCache->get(tnow, target, QType(QType::A), MemRecursorCache::RequireAuth, &cached, who, MemRecursorCache::NOTAG, &signatures), 1); BOOST_REQUIRE_EQUAL(cached.size(), 1U); BOOST_REQUIRE_EQUAL(signatures->size(), 1U); BOOST_CHECK_EQUAL((cached[0].d_ttl - tnow), 1); diff --git a/pdns/recursordist/test-syncres_cc9.cc b/pdns/recursordist/test-syncres_cc9.cc index 1e28d6f06c..4c330d7d56 100644 --- a/pdns/recursordist/test-syncres_cc9.cc +++ b/pdns/recursordist/test-syncres_cc9.cc @@ -940,7 +940,7 @@ BOOST_AUTO_TEST_CASE(test_cname_plus_authority_ns_ttl) vector cached; bool wasAuth = false; - auto ttl = g_recCache->get(now, DNSName("powerdns.com."), QType(QType::NS), MemRecursorCache::None, &cached, who, boost::none, nullptr, nullptr, nullptr, nullptr, &wasAuth); + auto ttl = g_recCache->get(now, DNSName("powerdns.com."), QType(QType::NS), MemRecursorCache::None, &cached, who, MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, nullptr, &wasAuth); BOOST_REQUIRE_GE(ttl, 1); BOOST_REQUIRE_LE(ttl, 42); BOOST_CHECK_EQUAL(cached.size(), 1U); @@ -949,7 +949,7 @@ BOOST_AUTO_TEST_CASE(test_cname_plus_authority_ns_ttl) cached.clear(); /* Also check that the part in additional is still not auth */ - BOOST_REQUIRE_GE(g_recCache->get(now, DNSName("a.gtld-servers.net."), QType(QType::A), MemRecursorCache::None, &cached, who, boost::none, nullptr, nullptr, nullptr, nullptr, &wasAuth), -1); + BOOST_REQUIRE_GE(g_recCache->get(now, DNSName("a.gtld-servers.net."), QType(QType::A), MemRecursorCache::None, &cached, who, MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, nullptr, &wasAuth), -1); BOOST_CHECK_EQUAL(cached.size(), 1U); BOOST_CHECK_EQUAL(wasAuth, false); } @@ -1017,7 +1017,7 @@ BOOST_AUTO_TEST_CASE(test_bogus_does_not_replace_secure_in_the_cache) vector cached; bool wasAuth = false; vState retrievedState = vState::Insecure; - BOOST_CHECK_GT(g_recCache->get(now, DNSName("powerdns.com."), QType(QType::SOA), MemRecursorCache::RequireAuth, &cached, who, boost::none, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), 0); + BOOST_CHECK_GT(g_recCache->get(now, DNSName("powerdns.com."), QType(QType::SOA), MemRecursorCache::RequireAuth, &cached, who, MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), 0); BOOST_CHECK_EQUAL(vStateToString(retrievedState), vStateToString(vState::Secure)); BOOST_CHECK_EQUAL(wasAuth, true); @@ -1027,7 +1027,7 @@ BOOST_AUTO_TEST_CASE(test_bogus_does_not_replace_secure_in_the_cache) BOOST_REQUIRE_EQUAL(ret.size(), 2U); cached.clear(); - BOOST_CHECK_GT(g_recCache->get(now, DNSName("powerdns.com."), QType(QType::SOA), MemRecursorCache::RequireAuth, &cached, who, boost::none, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), 0); + BOOST_CHECK_GT(g_recCache->get(now, DNSName("powerdns.com."), QType(QType::SOA), MemRecursorCache::RequireAuth, &cached, who, MemRecursorCache::NOTAG, nullptr, nullptr, nullptr, &retrievedState, &wasAuth), 0); BOOST_CHECK_EQUAL(vStateToString(retrievedState), vStateToString(vState::Secure)); BOOST_CHECK_EQUAL(wasAuth, true); }