Browse Source

[1555] Throw exception if the interface instance is NULL.

Marcin Siodelski 11 years ago
parent
commit
4084c5f2a9
2 changed files with 10 additions and 0 deletions
  1. 5 0
      src/bin/dhcp4/dhcp4_srv.cc
  2. 5 0
      src/bin/dhcp6/dhcp6_srv.cc

+ 5 - 0
src/bin/dhcp4/dhcp4_srv.cc

@@ -835,6 +835,11 @@ Dhcpv4Srv::openActiveSockets(const uint16_t port,
     for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
+        if (iface_ptr == NULL) {
+            isc_throw(isc::Unexpected, "Interface Manager returned NULL"
+                      << " instance of the interface when DHCPv4 server was"
+                      << " trying to reopen sockets after reconfiguration");
+        }
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp4_logger, DHCP4_ACTIVATE_INTERFACE)

+ 5 - 0
src/bin/dhcp6/dhcp6_srv.cc

@@ -1116,6 +1116,11 @@ Dhcpv6Srv::openActiveSockets(const uint16_t port) {
     for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
+        if (iface_ptr == NULL) {
+            isc_throw(isc::Unexpected, "Interface Manager returned NULL"
+                      << " instance of the interface when DHCPv6 server was"
+                      << " trying to reopen sockets after reconfiguration");
+        }
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp6_logger, DHCP6_ACTIVATE_INTERFACE)