From 631db9d52a8c24b889967412cb9e7f3347c9ee43 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 18 Feb 2020 16:37:27 +0100 Subject: [PATCH] Fix compile errors without snmp support --- pdns/dnsdist-lua.cc | 2 -- pdns/dnsdist-snmp.cc | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 6ec08894fc..fde5fd0ce9 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1683,11 +1683,9 @@ static void setupLuaConfig(bool client, bool configCheck) }); g_lua.writeFunction("sendCustomTrap", [](const std::string& str) { -#ifdef HAVE_NET_SNMP if (g_snmpAgent && g_snmpTrapsEnabled) { g_snmpAgent->sendCustomTrap(str); } -#endif /* HAVE_NET_SNMP */ }); g_lua.writeFunction("setServerPolicy", [](ServerPolicy policy) { diff --git a/pdns/dnsdist-snmp.cc b/pdns/dnsdist-snmp.cc index eefa558b7b..e62f9f0c1c 100644 --- a/pdns/dnsdist-snmp.cc +++ b/pdns/dnsdist-snmp.cc @@ -2,6 +2,10 @@ #include "dnsdist-snmp.hh" #include "dolog.hh" +bool g_snmpEnabled{false}; +bool g_snmpTrapsEnabled{false}; +DNSDistSNMPAgent* g_snmpAgent{nullptr}; + #ifdef HAVE_NET_SNMP #define DNSDIST_OID 1, 3, 6, 1, 4, 1, 43315, 3 @@ -52,10 +56,6 @@ static const oid specialMemoryUsageOID[] = { DNSDIST_STATS_OID, 39 }; static std::unordered_map s_statsMap; -bool g_snmpEnabled{false}; -bool g_snmpTrapsEnabled{false}; -DNSDistSNMPAgent* g_snmpAgent{nullptr}; - /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ /* a instance handler also only hands us one request at a time, so -- 2.47.2