From aa59465e46b6fd617bf992a80da400ae14fbb4ec Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 14 Feb 2022 15:39:17 +0100 Subject: [PATCH] If we get NODATA on an AAAA in followCNAMERecords, try dns64 Fixes #11320 --- pdns/pdns_recursor.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- 2.47.2