]> granicus.if.org Git - pdns/commitdiff
make setACL() also accept a single netmask
authorbert hubert <bert.hubert@netherlabs.nl>
Sat, 21 Nov 2015 21:00:51 +0000 (22:00 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Sat, 21 Nov 2015 21:00:51 +0000 (22:00 +0100)
pdns/dnsdist-lua.cc
pdns/dnsdist.cc

index 7db5a4582d67cf2a46c60b019b55a644f37cb916..4ba8c1bd4516b59d7fdc37759b48b6d9f5f6c4d1 100644 (file)
@@ -292,9 +292,12 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
        g_outputBuffer="Error: "+string(e.what())+"\n";
       }
     });
-  g_lua.writeFunction("setACL", [](const vector<pair<int, string>>& parts) {
+  g_lua.writeFunction("setACL", [](boost::variant<string,vector<pair<int, string>>> inp) {
       NetmaskGroup nmg;
-      for(const auto& p : parts) {
+      if(auto str = boost::get<string>(&inp)) {
+       nmg.addMask(*str);
+      }
+      else for(const auto& p : boost::get<vector<pair<int,string>>>(inp)) {
        nmg.addMask(p.second);
       }
       g_ACL.setState(nmg);
index 5e2137743fbc14a22f58a075f85610dc8fb91c03..13c908e8e2828fbf97162a05d87cb65871795346 100644 (file)
@@ -412,7 +412,6 @@ try
   }
   auto acl = g_ACL.getLocal();
   auto localPolicy = g_policy.getLocal();
-
   auto localRulactions = g_rulactions.getLocal();
   auto localServers = g_dstates.getLocal();
   struct msghdr msgh;