From 72b54749e204304f0bd2cf18cb73eedd647391a0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 9 Nov 2021 15:12:09 +0100 Subject: [PATCH] dnsdist: Do not build secpoll support when DISABLE_SECPOLL is defined --- pdns/dnsdist-lua.cc | 2 ++ pdns/dnsdist.cc | 4 ++++ pdns/dnsdistdist/dnsdist-secpoll.cc | 7 ++++--- pdns/dnsdistdist/dnsdist-secpoll.hh | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 13bdb4de22..768a8983b2 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -2254,6 +2254,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) g_PayloadSizeSelfGenAnswers = payloadSize; }); +#ifndef DISABLE_SECPOLL luaCtx.writeFunction("setSecurityPollSuffix", [](const std::string& suffix) { if (g_configurationDone) { g_outputBuffer = "setSecurityPollSuffix() cannot be used at runtime!\n"; @@ -2271,6 +2272,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) g_secPollInterval = newInterval; }); +#endif /* DISABLE_SECPOLL */ luaCtx.writeFunction("setSyslogFacility", [](boost::variant facility) { setLuaSideEffect(); diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 3aee155b71..d5eecce2d7 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1840,6 +1840,7 @@ static void dynBlockMaintenanceThread() DynBlockMaintenance::run(); } +#ifndef DISABLE_SECPOLL static void secPollThread() { setThreadName("dnsdist/secpoll"); @@ -1853,6 +1854,7 @@ static void secPollThread() sleep(g_secPollInterval); } } +#endif /* DISABLE_SECPOLL */ static void healthChecksThread() { @@ -2704,10 +2706,12 @@ int main(int argc, char** argv) thread dynBlockMaintThread(dynBlockMaintenanceThread); dynBlockMaintThread.detach(); +#ifndef DISABLE_SECPOLL if (!g_secPollSuffix.empty()) { thread secpollthread(secPollThread); secpollthread.detach(); } +#endif /* DISABLE_SECPOLL */ if(g_cmdLine.beSupervised) { #ifdef HAVE_SYSTEMD diff --git a/pdns/dnsdistdist/dnsdist-secpoll.cc b/pdns/dnsdistdist/dnsdist-secpoll.cc index 79e3f69f49..008302d111 100644 --- a/pdns/dnsdistdist/dnsdist-secpoll.cc +++ b/pdns/dnsdistdist/dnsdist-secpoll.cc @@ -20,9 +20,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "config.h" +#include "dnsdist-secpoll.hh" +#ifndef DISABLE_SECPOLL -#include #include #ifdef HAVE_LIBSODIUM @@ -36,7 +36,6 @@ #include "sstuff.hh" #include "dnsdist.hh" -#include "dnsdist-secpoll.hh" #ifndef PACKAGEVERSION #define PACKAGEVERSION PACKAGE_VERSION @@ -244,3 +243,5 @@ void doSecPoll(const std::string& suffix) g_secPollDone = true; } } + +#endif /* DISABLE_SECPOLL */ diff --git a/pdns/dnsdistdist/dnsdist-secpoll.hh b/pdns/dnsdistdist/dnsdist-secpoll.hh index c7d886917e..536fb39cce 100644 --- a/pdns/dnsdistdist/dnsdist-secpoll.hh +++ b/pdns/dnsdistdist/dnsdist-secpoll.hh @@ -21,7 +21,13 @@ */ #pragma once +#include "config.h" + +#ifndef DISABLE_SECPOLL +#include + extern std::string g_secPollSuffix; extern time_t g_secPollInterval; void doSecPoll(const std::string& suffix); +#endif /* DISABLE_SECPOLL */ -- 2.47.2