]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: optimize processing of additionals 14503/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 17 Jul 2024 08:46:58 +0000 (10:46 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 18 Jul 2024 11:16:38 +0000 (13:16 +0200)
(cherry picked from commit cd2de2ee7ad55f295a00dfce5488ee3863d974d6)

pdns/recursordist/syncres.cc

index 812e36732149b21890517697bcccddc74a562718..04681ca5b11008b87609ff372cf3274e0a446e7f 100644 (file)
@@ -4078,6 +4078,12 @@ void SyncRes::fixupAnswer(const std::string& prefix, LWResult& lwr, const DNSNam
 
 static void allowAdditionalEntry(std::unordered_set<DNSName>& allowedAdditionals, const DNSRecord& rec)
 {
+  // As we only use a limited amount of NS names for resolving, limit number of additional names as
+  // well.  s_maxnsperresolve is a proper limit for the NS case and is also reasonable for other
+  // qtypes.  Allow one extra for qname itself, which is always in allowedAdditionals.
+  if (SyncRes::s_maxnsperresolve > 0 && allowedAdditionals.size() > SyncRes::s_maxnsperresolve + 1) {
+    return;
+  }
   switch (rec.d_type) {
   case QType::MX:
     if (auto mxContent = getRR<MXRecordContent>(rec)) {