Parcourir la source

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

Marcin Siodelski il y a 11 ans
Parent
commit
4084c5f2a9
2 fichiers modifiés avec 10 ajouts et 0 suppressions
  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();
     for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
         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())) {
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive4_ = false;
             iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp4_logger, DHCP4_ACTIVATE_INTERFACE)
             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();
     for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
         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())) {
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive4_ = false;
             iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp6_logger, DHCP6_ACTIVATE_INTERFACE)
             LOG_INFO(dhcp6_logger, DHCP6_ACTIVATE_INTERFACE)