Browse Source

[1555] Set inactivity flag using pointer to an interface.

Marcin Siodelski 11 years ago
parent
commit
abad8addef
2 changed files with 7 additions and 5 deletions
  1. 5 4
      src/bin/dhcp4/ctrl_dhcp4_srv.cc
  2. 2 1
      src/bin/dhcp6/ctrl_dhcp6_srv.cc

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

@@ -255,12 +255,13 @@ ControlledDhcpv4Srv::openActiveSockets(const uint16_t port, const bool use_bcast
     // Get the reference to the collection of interfaces. This reference should be
     // valid as long as the program is run because IfaceMgr is a singleton.
     // Therefore we can safely iterate over instances of all interfaces and modify
-    // their flags. Here we modify flags which indicate wheter socket should be
+    // their flags. Here we modify flags which indicate whether socket should be
     // open for a particular interface or not.
-    IfaceMgr::IfaceCollection ifaces = IfaceMgr::instance().getIfaces();
-    for (IfaceMgr::IfaceCollection::iterator iface = ifaces.begin();
+    const IfaceMgr::IfaceCollection& ifaces = IfaceMgr::instance().getIfaces();
+    for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
-        iface->inactive_ = !CfgMgr::instance().isActiveIface(iface->getName());
+        IfaceMgr::instance().getIface(iface->getName())->inactive_ =
+            !CfgMgr::instance().isActiveIface(iface->getName());
     }
     // Let's reopen active sockets. openSockets4 will check internally whether
     // sockets are marked active or inactive.

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

@@ -261,7 +261,8 @@ ControlledDhcpv6Srv::openActiveSockets(const uint16_t port) {
     IfaceMgr::IfaceCollection ifaces = IfaceMgr::instance().getIfaces();
     for (IfaceMgr::IfaceCollection::iterator iface = ifaces.begin();
          iface != ifaces.end(); ++iface) {
-        iface->inactive_ = !CfgMgr::instance().isActiveIface(iface->getName());
+        IfaceMgr::instance().getIface(iface->getName())->inactive_ =
+            !CfgMgr::instance().isActiveIface(iface->getName());
     }
     // Let's reopen active sockets. openSockets6 will check internally whether
     // sockets are marked active or inactive.