From f237dbd53b8b796a94782a27ab237936e09d7a70 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 4 May 2021 15:16:20 +0200 Subject: [PATCH] rec: Avoid a loop when checking if we missed a cut We just went Bogus because of the signer, not because of the name currently being checked, so we only need to check the status of zones above the signer. Moreover, if we went Bogus because of the DS of the signer, we should even skip the zone of the signer but check for a missed cut above that. --- pdns/syncres.cc | 27 ++++++++++++++++++++------- pdns/syncres.hh | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index a60339e062..87c2ae40dc 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -2618,7 +2618,7 @@ vState SyncRes::getDSRecords(const DNSName& zone, dsmap_t& ds, bool taOnly, unsi return vState::BogusUnableToGetDSs; } -vState SyncRes::getValidationStatus(const DNSName& name, bool hasSignatures, bool typeIsDS, unsigned int depth) +vState SyncRes::getValidationStatus(const DNSName& name, bool wouldBeValid, bool typeIsDS, unsigned int depth) { vState result = vState::Indeterminate; @@ -2657,9 +2657,9 @@ vState SyncRes::getValidationStatus(const DNSName& name, bool hasSignatures, boo but we don't know if we missed a cut (or several). We could see if we have DS (or denial of) in cache but let's not worry for now, we will if we don't have a signature, or if the signer doesn't match what we expect */ - if (!hasSignatures && best != subdomain) { - /* no signatures, we likely missed a cut, let's try to find it */ - LOG(d_prefix<<": no signatures for "< labelsToAdd = subdomain.makeRelative(ds).getRawLabels(); @@ -2809,6 +2809,10 @@ vState SyncRes::getDNSKeys(const DNSName& signer, skeyset_t& keys, unsigned int return state; } + if (state == vState::Insecure) { + return state; + } + LOG(d_prefix<<"Returning Bogus state from "<<__func__<<"("<