]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
If we get NODATA on an AAAA in followCNAMERecords, try dns64
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 14 Feb 2022 14:39:17 +0000 (15:39 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 15 Feb 2022 12:41:50 +0000 (13:41 +0100)
Fixes #11320

pdns/pdns_recursor.cc

index 9aad7e01eeddbe8c0fe2cbf671064c2f25c86be8..29298cd19c15cde06f437d275fec200a4dc3b2c3 100644 (file)
@@ -613,6 +613,8 @@ static bool udrCheckUniqueDNSRecord(const shared_ptr<Logr::Logger>& nodlogger, c
 }
 #endif /* NOD_ENABLED */
 
+static bool answerIsNOData(uint16_t requestedType, int rcode, const std::vector<DNSRecord>& records);
+
 int followCNAMERecords(vector<DNSRecord>& ret, const QType qtype, int rcode)
 {
   vector<DNSRecord> resolved;
@@ -633,8 +635,14 @@ int followCNAMERecords(vector<DNSRecord>& ret, const QType qtype, int rcode)
 
   rcode = directResolve(target, qtype, QClass::IN, resolved, t_pdl);
 
+  if (g_dns64Prefix && qtype == QType::AAAA && answerIsNOData(qtype, rcode, resolved)) {
+    rcode = getFakeAAAARecords(target, *g_dns64Prefix, resolved);
+  }
+
   for (DNSRecord& rr : resolved) {
-    ret.push_back(std::move(rr));
+    if (rr.d_place == DNSResourceRecord::ANSWER) {
+      ret.push_back(std::move(rr));
+    }
   }
   return rcode;
 }