From 85e4ce52b5567306e2d7e576a45ae58afb017d8f Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 10 Dec 2015 17:18:30 +0100 Subject: [PATCH] Warn that addLocal() and setLocal() can't be used at runtime --- pdns/dnsdist-lua.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 45a8d0c70..e1cd5badf 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -289,6 +289,10 @@ vector> setupLua(bool client, const std::string& confi g_lua.writeFunction("setLocal", [client](const std::string& addr, boost::optional doTCP) { if(client) return; + if (g_configurationDone) { + g_outputBuffer="setLocal cannot be used at runtime!\n"; + return; + } try { ComboAddress loc(addr, 53); g_locals.clear(); @@ -302,6 +306,10 @@ vector> setupLua(bool client, const std::string& confi g_lua.writeFunction("addLocal", [client](const std::string& addr, boost::optional doTCP) { if(client) return; + if (g_configurationDone) { + g_outputBuffer="addLocal cannot be used at runtime!\n"; + return; + } try { ComboAddress loc(addr, 53); g_locals.push_back({loc, doTCP ? *doTCP : true}); /// only works pre-startup, so no sync necessary -- 2.40.0