Parcourir la source

[3487] Ignore loopback interfaces when opening sockets.

Marcin Siodelski il y a 10 ans
Parent
commit
93de5f0c99
2 fichiers modifiés avec 11 ajouts et 2 suppressions
  1. 5 1
      src/bin/dhcp4/dhcp4_srv.cc
  2. 6 1
      src/bin/dhcp6/dhcp6_srv.cc

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

@@ -1806,7 +1806,11 @@ Dhcpv4Srv::openActiveSockets(const uint16_t port,
                       << " instance of the interface when DHCPv4 server was"
                       << " trying to reopen sockets after reconfiguration");
         }
-        if (CfgMgr::instance().isActiveIface(iface->getName())) {
+        // Ignore loopback interfaces.
+        if (iface_ptr->flag_loopback_) {
+            iface_ptr->inactive4_ = true;
+
+        } else if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive4_ = false;
             LOG_INFO(dhcp4_logger, DHCP4_ACTIVATE_INTERFACE)
                 .arg(iface->getFullName());

+ 6 - 1
src/bin/dhcp6/dhcp6_srv.cc

@@ -2440,7 +2440,12 @@ Dhcpv6Srv::openActiveSockets(const uint16_t port) {
                       << " instance of the interface when DHCPv6 server was"
                       << " trying to reopen sockets after reconfiguration");
         }
-        if (CfgMgr::instance().isActiveIface(iface->getName())) {
+
+        // Ignore loopback interfaces.
+        if (iface_ptr->flag_loopback_) {
+            iface_ptr->inactive6_ = true;
+
+        } else  if (CfgMgr::instance().isActiveIface(iface->getName())) {
             iface_ptr->inactive6_ = false;
             LOG_INFO(dhcp6_logger, DHCP6_ACTIVATE_INTERFACE)
                 .arg(iface->getFullName());