Browse Source

[1555] Log warning if no interfaces are configured to listen DHCP traffic.

Marcin Siodelski 11 years ago
parent
commit
2221a1de37

+ 4 - 2
src/bin/dhcp4/ctrl_dhcp4_srv.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
 //
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
 // purpose with or without fee is hereby granted, provided that the above
@@ -284,7 +284,9 @@ ControlledDhcpv4Srv::openActiveSockets(const uint16_t port,
     }
     }
     // Let's reopen active sockets. openSockets4 will check internally whether
     // Let's reopen active sockets. openSockets4 will check internally whether
     // sockets are marked active or inactive.
     // sockets are marked active or inactive.
-    IfaceMgr::instance().openSockets4(port, use_bcast);
+    if (!IfaceMgr::instance().openSockets4(port, use_bcast)) {
+        LOG_WARN(dhcp4_logger, DHCP4_NO_SOCKETS_OPEN);
+    }
 }
 }
 
 
 
 

+ 5 - 0
src/bin/dhcp4/dhcp4_messages.mes

@@ -92,6 +92,11 @@ specified client after receiving a REQUEST message from it.  There are many
 possible reasons for such a failure. Additional messages will indicate the
 possible reasons for such a failure. Additional messages will indicate the
 reason.
 reason.
 
 
+% DHCP4_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic
+This warning message is issued when current server configuration specifies
+no interfaces that server should listen on, or specified interfaces are not
+configured to receive the traffic.
+
 % DHCP4_NOT_RUNNING IPv4 DHCP server is not running
 % DHCP4_NOT_RUNNING IPv4 DHCP server is not running
 A warning message is issued when an attempt is made to shut down the
 A warning message is issued when an attempt is made to shut down the
 IPv4 DHCP server but it is not running.
 IPv4 DHCP server but it is not running.

+ 3 - 1
src/bin/dhcp6/ctrl_dhcp6_srv.cc

@@ -284,7 +284,9 @@ ControlledDhcpv6Srv::openActiveSockets(const uint16_t port) {
     }
     }
     // Let's reopen active sockets. openSockets6 will check internally whether
     // Let's reopen active sockets. openSockets6 will check internally whether
     // sockets are marked active or inactive.
     // sockets are marked active or inactive.
-    IfaceMgr::instance().openSockets6(port);
+    if (!IfaceMgr::instance().openSockets6(port)) {
+        LOG_WARN(dhcp6_logger, DHCP6_NO_SOCKETS_OPEN);
+    }
 }
 }
 
 
 };
 };

+ 5 - 0
src/bin/dhcp6/dhcp6_messages.mes

@@ -111,6 +111,11 @@ IPv6 DHCP server but it is not running.
 During startup the IPv6 DHCP server failed to detect any network
 During startup the IPv6 DHCP server failed to detect any network
 interfaces and is therefore shutting down.
 interfaces and is therefore shutting down.
 
 
+% DHCP6_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic
+This warning message is issued when current server configuration specifies
+no interfaces that server should listen on, or specified interfaces are not
+configured to receive the traffic.
+
 % DHCP6_OPEN_SOCKET opening sockets on port %1
 % DHCP6_OPEN_SOCKET opening sockets on port %1
 A debug message issued during startup, this indicates that the IPv6 DHCP
 A debug message issued during startup, this indicates that the IPv6 DHCP
 server is about to open sockets on the specified port.
 server is about to open sockets on the specified port.