Browse Source

[1555] Open only selected sockets when Kea starts up.

Marcin Siodelski 11 years ago
parent
commit
98c85cb61b
2 changed files with 10 additions and 0 deletions
  1. 5 0
      src/bin/dhcp4/ctrl_dhcp4_srv.cc
  2. 5 0
      src/bin/dhcp6/ctrl_dhcp6_srv.cc

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

@@ -192,8 +192,13 @@ void ControlledDhcpv4Srv::establishSession() {
 
 
     try {
     try {
         configureDhcp4Server(*this, config_session_->getFullConfig());
         configureDhcp4Server(*this, config_session_->getFullConfig());
+        // Configuration may disable or enable interfaces so we have to
+        // reopen sockets according to new configuration.
+        openActiveSockets(getPort(), useBroadcast());
+
     } catch (const DhcpConfigError& ex) {
     } catch (const DhcpConfigError& ex) {
         LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL).arg(ex.what());
         LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_LOAD_FAIL).arg(ex.what());
+
     }
     }
 
 
     /// Integrate the asynchronous I/O model of BIND 10 configuration
     /// Integrate the asynchronous I/O model of BIND 10 configuration

+ 5 - 0
src/bin/dhcp6/ctrl_dhcp6_srv.cc

@@ -193,8 +193,13 @@ void ControlledDhcpv6Srv::establishSession() {
     try {
     try {
         // Pull the full configuration out from the session.
         // Pull the full configuration out from the session.
         configureDhcp6Server(*this, config_session_->getFullConfig());
         configureDhcp6Server(*this, config_session_->getFullConfig());
+        // Configuration may disable or enable interfaces so we have to
+        // reopen sockets according to new configuration.
+        openActiveSockets(getPort());
+
     } catch (const DhcpConfigError& ex) {
     } catch (const DhcpConfigError& ex) {
         LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(ex.what());
         LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_LOAD_FAIL).arg(ex.what());
+
     }
     }
 
 
     /// Integrate the asynchronous I/O model of BIND 10 configuration
     /// Integrate the asynchronous I/O model of BIND 10 configuration