]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix review comments wrt YAML errors
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 10 Nov 2025 12:59:55 +0000 (13:59 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 10 Nov 2025 12:59:55 +0000 (13:59 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-configuration-yaml.cc

index c31033b3e389d2f88770da3841cdc45358057a4c..774d3603127dedd13f0c2f6aa1a5dc43caeb478c 100644 (file)
@@ -1226,13 +1226,16 @@ bool loadConfigurationFromFile(const std::string& fileName, [[maybe_unused]] boo
 
         if (!pool.packet_cache.empty()) {
           poolIt->second.packetCache = getRegisteredTypeByName<DNSDistPacketCache>(pool.packet_cache);
+          if (!poolIt->second.packetCache) {
+            throw std::runtime_error("Unable to find a cache named " + std::string(pool.packet_cache));
+          }
         }
         if (!pool.policy.empty()) {
           auto policy = getRegisteredTypeByName<ServerPolicy>(pool.policy);
           if (!policy) {
             throw std::runtime_error("Unable to find a load-balancing policy named " + std::string(pool.policy));
           }
-          poolIt->second.policy = policy;
+          poolIt->second.policy = std::move(policy);
         }
         poolIt->second.setECS(pool.use_ecs);
         poolIt->second.setZeroScope(pool.use_zero_scope);