From: Otto Moerbeek Date: Mon, 14 Feb 2022 14:39:17 +0000 (+0100) Subject: If we get NODATA on an AAAA in followCNAMERecords, try dns64 X-Git-Tag: rec-4.7.0-alpha1~16^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa59465e46b6fd617bf992a80da400ae14fbb4ec;p=thirdparty%2Fpdns.git If we get NODATA on an AAAA in followCNAMERecords, try dns64 Fixes #11320 --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 9aad7e01ee..29298cd19c 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -613,6 +613,8 @@ static bool udrCheckUniqueDNSRecord(const shared_ptr& nodlogger, c } #endif /* NOD_ENABLED */ +static bool answerIsNOData(uint16_t requestedType, int rcode, const std::vector& records); + int followCNAMERecords(vector& ret, const QType qtype, int rcode) { vector resolved; @@ -633,8 +635,14 @@ int followCNAMERecords(vector& 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; }