Browse Source

[1555] Differentiate between activation of IPv4 and IPv6 sockets.

Marcin Siodelski 11 years ago
parent
commit
75df517663

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

@@ -268,7 +268,7 @@ ControlledDhcpv4Srv::openActiveSockets(const uint16_t port,
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
-            iface_ptr->inactive_ = false;
+            iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp4_logger, DHCP4_ACTIVATE_INTERFACE)
                 .arg(iface->getFullName());
 
@@ -278,7 +278,7 @@ ControlledDhcpv4Srv::openActiveSockets(const uint16_t port,
             // interface is activated which is logged on the info level.
             LOG_DEBUG(dhcp4_logger, DBG_DHCP4_BASIC,
                       DHCP4_DEACTIVATE_INTERFACE).arg(iface->getName());
-            iface_ptr->inactive_ = true;
+            iface_ptr->inactive4_ = true;
 
         }
     }

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

@@ -268,7 +268,7 @@ ControlledDhcpv6Srv::openActiveSockets(const uint16_t port) {
          iface != ifaces.end(); ++iface) {
         Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
         if (CfgMgr::instance().isActiveIface(iface->getName())) {
-            iface_ptr->inactive_ = false;
+            iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp6_logger, DHCP6_ACTIVATE_INTERFACE)
                 .arg(iface->getFullName());
 
@@ -278,7 +278,7 @@ ControlledDhcpv6Srv::openActiveSockets(const uint16_t port) {
             // interface is activated which is logged on the info level.
             LOG_DEBUG(dhcp6_logger, DBG_DHCP6_BASIC,
                       DHCP6_DEACTIVATE_INTERFACE).arg(iface->getName());
-            iface_ptr->inactive_ = true;
+            iface_ptr->inactive6_ = true;
 
         }
     }

+ 3 - 3
src/lib/dhcp/iface_mgr.cc

@@ -52,7 +52,7 @@ Iface::Iface(const std::string& name, int ifindex)
     :name_(name), ifindex_(ifindex), mac_len_(0), hardware_type_(0),
      flag_loopback_(false), flag_up_(false), flag_running_(false),
      flag_multicast_(false), flag_broadcast_(false), flags_(0),
-     inactive_(false)
+     inactive4_(false), inactive6_(false)
 {
     memset(mac_, 0, sizeof(mac_));
 }
@@ -297,7 +297,7 @@ bool IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast) {
         if (iface->flag_loopback_ ||
             !iface->flag_up_ ||
             !iface->flag_running_,
-            iface->inactive_) {
+            iface->inactive4_) {
             continue;
         }
 
@@ -364,7 +364,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
         if (iface->flag_loopback_ ||
             !iface->flag_up_ ||
             !iface->flag_running_,
-            iface->inactive_) {
+            iface->inactive6_) {
             continue;
         }
 

+ 7 - 3
src/lib/dhcp/iface_mgr.h

@@ -310,9 +310,13 @@ public:
     /// it may mean different things on different OSes).
     uint32_t flags_;
 
-    /// Interface is inactive. This can be explicitly set to prevent Interface
-    /// Manager from opening the socket on this interface.
-    bool inactive_;
+    /// Indicates that IPv4 sockets should (true) or should not (false)
+    /// be opened on this interface.
+    bool inactive4_;
+
+    /// Indicates that IPv6 sockets should (true) or should not (false)
+    /// be opened on this interface.
+    bool inactive6_;
 };
 
 /// @brief Handles network interfaces, transmission and reception.