From: Marcin Siodelski Date: Wed, 20 Aug 2014 15:44:18 +0000 (+0200) Subject: [3512] Minor tweaks in the logging of warnings when socket fails to open. X-Git-Tag: trac3482_base~11^2~2^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26c686963013e7dd770f963719825d5f199a48c4;p=thirdparty%2Fkea.git [3512] Minor tweaks in the logging of warnings when socket fails to open. --- diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 381b0f3546..ece833361d 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -469,7 +469,11 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast, " interface " << iface->getName()); continue; - } else if (!iface->flag_up_ || !iface->flag_running_) { + } + + IOAddress out_address("0.0.0.0"); + if (!iface->flag_up_ || !iface->flag_running_ || + !iface->getAddress4(out_address)) { IFACEMGR_ERROR(SocketConfigError, error_handler, "the interface " << iface->getName() << " is down or has no usable IPv4" diff --git a/src/lib/dhcpsrv/dhcp_parsers.cc b/src/lib/dhcpsrv/dhcp_parsers.cc index a7fdf40265..c34f0199ef 100644 --- a/src/lib/dhcpsrv/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/dhcp_parsers.cc @@ -180,8 +180,7 @@ template <> void ValueParser::build(ConstElementPtr value) { InterfaceListConfigParser:: InterfaceListConfigParser(const std::string& param_name) - : activate_all_(false), - param_name_(param_name) { + : param_name_(param_name) { if (param_name_ != "interfaces") { isc_throw(BadValue, "Internal error. Interface configuration " "parser called for the wrong parameter: " << param_name); diff --git a/src/lib/dhcpsrv/dhcp_parsers.h b/src/lib/dhcpsrv/dhcp_parsers.h index 0e40823134..f723cb1c33 100644 --- a/src/lib/dhcpsrv/dhcp_parsers.h +++ b/src/lib/dhcpsrv/dhcp_parsers.h @@ -422,9 +422,6 @@ private: typedef std::list IfaceListStorage; IfaceListStorage interfaces_; - // Should server listen on all interfaces. - bool activate_all_; - // Parsed parameter name std::string param_name_; }; diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index ef54f490c9..cb04ad6001 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -55,10 +55,10 @@ to clients that are no longer active on the network will become available available sooner. % DHCPSRV_CFGMGR_ADD_IFACE listening on interface %1 -A debug message issued when new interface is being added to the collection of +An info message issued when new interface is being added to the collection of interfaces on which server listens to DHCP messages. -% DHCPSRV_CFGMGR_ADD_UNICAST listening on unicast address %1 on interface %2 +% DHCPSRV_CFGMGR_ADD_UNICAST listening on unicast address %1, on interface %2 A debug message issued when new configuring DHCP server to listen on unicast address on the specific interface. diff --git a/src/lib/dhcpsrv/iface_cfg.cc b/src/lib/dhcpsrv/iface_cfg.cc index 7ba4ad93fa..68c639559f 100644 --- a/src/lib/dhcpsrv/iface_cfg.cc +++ b/src/lib/dhcpsrv/iface_cfg.cc @@ -91,7 +91,7 @@ IfaceCfg::openSockets(const uint16_t port, const bool use_bcast) { // for some specific interface. This callback will simply log a // warning message. IfaceMgrErrorMsgCallback error_callback = - boost::bind(&IfaceCfg::socketOpenErrorHandler, this, _1); + boost::bind(&IfaceCfg::socketOpenErrorHandler, _1); bool sopen; if (getFamily() == V4) { sopen = IfaceMgr::instance().openSockets4(port, use_bcast, @@ -165,8 +165,7 @@ IfaceCfg::use(const std::string& iface_name) { } // All ok, add interface. - LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, - DHCPSRV_CFGMGR_ADD_IFACE) + LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_ADD_IFACE) .arg(name); iface_set_.insert(name); @@ -249,7 +248,7 @@ IfaceCfg::use(const std::string& iface_name) { "because other unicast address has already been" " specified for this interface"); } - LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_ADD_UNICAST) + LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_ADD_UNICAST) .arg(addr.toText()).arg(name); unicast_map_.insert(std::pair(name, addr)); } diff --git a/src/lib/dhcpsrv/iface_cfg.h b/src/lib/dhcpsrv/iface_cfg.h index e715450b80..6edc32e221 100644 --- a/src/lib/dhcpsrv/iface_cfg.h +++ b/src/lib/dhcpsrv/iface_cfg.h @@ -169,7 +169,7 @@ private: /// parameter. /// /// @param errmsg Error message being logged by the function. - void socketOpenErrorHandler(const std::string& errmsg); + static void socketOpenErrorHandler(const std::string& errmsg); /// @brief Protocol family. Family family_;