Browse Source

[3512] Minor tweaks in the logging of warnings when socket fails to open.

Marcin Siodelski 10 years ago
parent
commit
26c6869630

+ 5 - 1
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"

+ 1 - 2
src/lib/dhcpsrv/dhcp_parsers.cc

@@ -180,8 +180,7 @@ template <> void ValueParser<std::string>::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);

+ 0 - 3
src/lib/dhcpsrv/dhcp_parsers.h

@@ -422,9 +422,6 @@ private:
     typedef std::list<std::string> IfaceListStorage;
     IfaceListStorage interfaces_;
 
-    // Should server listen on all interfaces.
-    bool activate_all_;
-
     // Parsed parameter name
     std::string param_name_;
 };

+ 2 - 2
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.
 

+ 3 - 4
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<std::string, IOAddress>(name, addr));
     }

+ 1 - 1
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_;