From: Otto Moerbeek Date: Tue, 4 Aug 2020 08:46:46 +0000 (+0200) Subject: Simplified getClientPolicy() X-Git-Tag: rec-4.4.0-beta1~1^2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe1b1fd00008a87445953ea1aec0e96144e62000;p=thirdparty%2Fpdns.git Simplified getClientPolicy() --- diff --git a/pdns/filterpo.cc b/pdns/filterpo.cc index 4e9ac6bc8e..4b329734b9 100644 --- a/pdns/filterpo.cc +++ b/pdns/filterpo.cc @@ -200,41 +200,13 @@ bool DNSFilterEngine::getProcessingPolicy(const ComboAddress& address, const std bool DNSFilterEngine::getClientPolicy(const ComboAddress& ca, const std::unordered_map& discardedPolicies, Policy& pol) const { - // cout<<"Got question for "< zoneEnabled(d_zones.size()); - size_t count = 0; - bool allEmpty = true; + // cout<<"Got question from "<getPriority() >= pol.getPriority()) { - enabled = false; - } else { - const auto& zoneName = z->getName(); - if (discardedPolicies.find(zoneName) != discardedPolicies.end()) { - enabled = false; - } - else { - if (z->hasClientPolicies()) { - allEmpty = false; - } - else { - enabled = false; - } - } + break; } - - zoneEnabled[count] = enabled; - ++count; - } - - if (allEmpty) { - return false; - } - - count = 0; - for (const auto& z : d_zones) { - if (!zoneEnabled[count]) { - ++count; + const auto& zoneName = z->getName(); + if (discardedPolicies.find(zoneName) != discardedPolicies.end()) { continue; } @@ -242,10 +214,7 @@ bool DNSFilterEngine::getClientPolicy(const ComboAddress& ca, const std::unorder // cerr<<"Had a hit on the IP address ("<