]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Update pdns/dnsdist-lua-bindings.cc
authorY7n05h <Y7n05h@protonmail.com>
Thu, 14 Apr 2022 09:57:29 +0000 (17:57 +0800)
committerY7n05h <Y7n05h@protonmail.com>
Thu, 14 Apr 2022 11:10:17 +0000 (19:10 +0800)
Co-authored-by: Remi Gacogne <github@coredump.fr>
pdns/dnsdist-lua-bindings.cc

index 877a6f3fe4b99293b843d170e67b864befe46e34..7b5c837d6c1c22158b3d65730afe229110cf5cdf 100644 (file)
@@ -433,11 +433,13 @@ void setupLuaBindings(LuaContext& luaCtx, bool client)
       std::unordered_map<std::string, BPFFilter::MapConfiguration> mapsConfig;
 
       const auto convertParamsToConfig = [&](const std::string name, BPFFilter::MapType type) {
-        if (!opts.count(name))
+        if (!opts.count(name)) {
           return;
+        }
         const auto& tmp = opts.at(name);
-        if (tmp.type() != typeid(bpfFilterMapParams))
+        if (tmp.type() != typeid(bpfFilterMapParams)) {
           throw std::runtime_error("params is invalid");
+        }
         const auto& params = boost::get<bpfFilterMapParams>(tmp);
         BPFFilter::MapConfiguration config;
         config.d_type = type;
@@ -464,10 +466,12 @@ void setupLuaBindings(LuaContext& luaCtx, bool client)
       bool external = false;
       if (opts.count("external")) {
         const auto& tmp = opts.at("external");
-        if (tmp.type() != typeid(bool))
+        if (tmp.type() != typeid(bool)) {
           throw std::runtime_error("params is invalid");
-        if ((external = boost::get<bool>(tmp)))
+        }
+        if ((external = boost::get<bool>(tmp))) {
           format = BPFFilter::MapFormat::WithActions;
+        }
       }
 
       return std::make_shared<BPFFilter>(mapsConfig, format, external);