]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Warn if snmp-agent is set but SNMP is not available. 12009/head
authorOtto Moerbeek <otto@drijf.net>
Fri, 23 Sep 2022 05:31:35 +0000 (07:31 +0200)
committerOtto Moerbeek <otto@drijf.net>
Fri, 23 Sep 2022 05:31:35 +0000 (07:31 +0200)
Fixes #11998

pdns/recursordist/rec-main.cc

index 90b650b48934d191ecbce80deae8c175d40dc098..a7c5347fc8d1489dcb2a0727b0a5f088e1d5252b 100644 (file)
@@ -1944,12 +1944,18 @@ static int serviceMain(int argc, char* argv[], Logr::log_t log)
   disableStats(StatComponent::SNMP, ::arg()["stats-snmp-disabled-list"]);
 
   if (::arg().mustDo("snmp-agent")) {
+#ifdef HAVE_NET_SNMP
     string setting = ::arg()["snmp-daemon-socket"];
     if (setting.empty()) {
       setting = ::arg()["snmp-master-socket"];
     }
     g_snmpAgent = std::make_shared<RecursorSNMPAgent>("recursor", setting);
     g_snmpAgent->run();
+#else
+    const std::string msg = "snmp-agent set but SNMP support not compiled in";
+    SLOG(g_log << Logger::Error << msg << endl,
+         log->info(Logr::Error, msg));
+#endif // HAVE_NET_SNMP
   }
 
   int port = ::arg().asNum("udp-source-port-min");