]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Ignore extra ALIAS records and warn about them. 16884/head
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 16 Feb 2026 10:03:19 +0000 (11:03 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 16 Feb 2026 13:54:52 +0000 (14:54 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
docs/guides/alias.rst
pdns/packethandler.cc

index 6d179aa8d1234fe46466d48f2c16bde201488c82..390aee5c9e95bf301a656101fa669542280a0db5 100644 (file)
@@ -40,6 +40,13 @@ If the ALIAS target cannot be resolved (SERVFAIL) or does not exist (NXDOMAIN) t
   You should make sure that the :ref:`setting-resolver` does not point to
   PowerDNS itself, to prevent infinite query loops.
 
+
+It is strongly advised to only have one ALIAS record per RRset.
+If there are multiple ALIAS records with the same name, only the first one
+will be used to query the resolver. Prior to version 5.1.0, the last one
+was used instead. Remember that the order in which ALIAS records will be
+retrieved is backend-dependent.
+
 .. _alias_axfr:
 
 AXFR Zone transfers
index 76694830de1c7e219708f969799a08b4f82445f9..69e44d251518e84e83addde32dc771bdb99233d0 100644 (file)
@@ -1833,8 +1833,16 @@ bool PacketHandler::opcodeQueryInner2(DNSPacket& pkt, queryState &state, bool re
         g_log<<Logger::Info<<"ALIAS record found for "<<state.target<<", but ALIAS expansion is disabled."<<endl;
         continue;
       }
-      haveAlias=getRR<ALIASRecordContent>(zrr.dr)->getContent();
-      aliasScopeMask=zrr.scopeMask;
+      // DNSProxy::completePacket(), in its current state, can only process one
+      // alias if !state.r->d_tcp, so ignore any further ALIAS results (but
+      // warn about them)
+      if (haveAlias.empty()) {
+        haveAlias=getRR<ALIASRecordContent>(zrr.dr)->getContent();
+        aliasScopeMask=zrr.scopeMask;
+      }
+      else {
+        g_log << Logger::Warning << "extra ALIAS record for " << state.target << ", contents " << getRR<ALIASRecordContent>(zrr.dr)->getContent() << " ignored." << endl;
+      }
     }
 
     // Filter out all SOA's and add them in later