From: Marcin Siodelski Date: Thu, 11 Jul 2013 17:15:42 +0000 (+0200) Subject: [1555] Differentiate between activation of IPv4 and IPv6 sockets. X-Git-Tag: bind10-1.2.0beta1-release~335^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75df517663d7743adfa1295e87f8a77ca97a059d;p=thirdparty%2Fkea.git [1555] Differentiate between activation of IPv4 and IPv6 sockets. --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 7d7354eefe..f0b45478a2 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/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; } } diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 60b873563d..6d35c46253 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/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; } } diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 02093267d4..e47e8f06dd 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/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; } diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index 442107db65..217524da0d 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/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.