Browse Source

[3880] Extra sanity check added.

Tomek Mrugalski 10 years ago
parent
commit
43a7ef6870
2 changed files with 7 additions and 0 deletions
  1. 3 0
      src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
  2. 4 0
      src/lib/dhcp/iface_mgr.cc

+ 3 - 0
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc

@@ -264,6 +264,9 @@ TEST_F(CtrlDhcpv4SrvTest, commandsRegistration) {
 /// work correctly after fork or develop a small tool that will send data
 /// from stdin to specified UNIX socket, print out the responses on stdout
 /// and develop shell tests for this.
+///
+/// Note that the test passes when run on its own, but not when run along with
+/// other unit-tests.
 TEST_F(CtrlDhcpv4SrvTest, DISABLED_commandSocketBasic) {
 
     string socket_path = string(TEST_DATA_DIR) + "/kea4.sock";

+ 4 - 0
src/lib/dhcp/iface_mgr.cc

@@ -292,6 +292,10 @@ IfaceMgr::isDirectResponseSupported() const {
 
 void
 IfaceMgr::addExternalSocket(int socketfd, SocketCallback callback) {
+    if (socketfd < 0) {
+        isc_throw(BadValue, "Attempted to install callback for invalid socket "
+                  << socketfd);
+    }
     BOOST_FOREACH(SocketCallbackInfo s, callbacks_) {
         // There's such a socket description there already.
         // Update the callback and we're done