From: Otto Moerbeek Date: Fri, 23 Sep 2022 05:31:35 +0000 (+0200) Subject: Warn if snmp-agent is set but SNMP is not available. X-Git-Tag: rec-4.9.0-alpha0~39^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F12009%2Fhead;p=thirdparty%2Fpdns.git Warn if snmp-agent is set but SNMP is not available. Fixes #11998 --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 90b650b489..a7c5347fc8 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -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("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");