From: Otto Moerbeek Date: Mon, 16 Dec 2024 16:13:49 +0000 (+0100) Subject: if *fromCache is already true, no need to check CNAME chain X-Git-Tag: dnsdist-2.0.0-alpha1~203^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3455105d0de1b738156440b70f6711fd1e6128fa;p=thirdparty%2Fpdns.git if *fromCache is already true, no need to check CNAME chain Co-authored-by: Remi Gacogne --- diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index a3591e9311..20a7c3d4b4 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -2014,7 +2014,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName& qname, const QType qtyp } // This handles the case mentioned above: if the full CNAME chain leading to the answer was // constructed from the cache, indicate that. - if (fromCache != nullptr && haveFinalAnswer(qname, qtype, res, ret)) { + if (fromCache != nullptr && *fromCache == false && haveFinalAnswer(qname, qtype, res, ret)) { *fromCache = true; } return res; @@ -2066,7 +2066,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName& qname, const QType qtyp } } } - if (fromCache != nullptr && haveFinalAnswer(qname, qtype, res, ret)) { + if (fromCache != nullptr && *fromCache == false && haveFinalAnswer(qname, qtype, res, ret)) { *fromCache = true; } return res;