From: Razvan Becheriu Date: Thu, 4 Mar 2021 06:40:31 +0000 (+0200) Subject: [#1621] fixed disable network state for connections X-Git-Tag: Kea-1.9.6~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddb1ce4cae2be56827edcd216a0a519c3db66fde;p=thirdparty%2Fkea.git [#1621] fixed disable network state for connections --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 1f99921633..77519831db 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -1236,17 +1236,19 @@ ControlledDhcpv4Srv::deleteExpiredReclaimedLeases(const uint32_t secs) { bool ControlledDhcpv4Srv::dbLostCallback(ReconnectCtlPtr db_reconnect_ctl) { - // Disable service until the connection is recovered. - network_state_->disableService(NetworkState::Origin::DB_CONNECTION); - - LOG_INFO(dhcp4_logger, DHCP4_DB_RECONNECT_LOST_CONNECTION); - if (!db_reconnect_ctl) { // This should never happen LOG_ERROR(dhcp4_logger, DHCP4_DB_RECONNECT_NO_DB_CTL); return (false); } + // Disable service until the connection is recovered. + if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries()) { + network_state_->disableService(NetworkState::Origin::DB_CONNECTION); + } + + LOG_INFO(dhcp4_logger, DHCP4_DB_RECONNECT_LOST_CONNECTION); + // If reconnect isn't enabled log it, initiate a shutdown and return false. if (!db_reconnect_ctl->retriesLeft() || !db_reconnect_ctl->retryInterval()) { diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 1afbbc63e3..15bf8f3c35 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -1255,17 +1255,19 @@ ControlledDhcpv6Srv::deleteExpiredReclaimedLeases(const uint32_t secs) { bool ControlledDhcpv6Srv::dbLostCallback(ReconnectCtlPtr db_reconnect_ctl) { - // Disable service until the connection is recovered. - network_state_->disableService(NetworkState::Origin::DB_CONNECTION); - - LOG_INFO(dhcp6_logger, DHCP6_DB_RECONNECT_LOST_CONNECTION); - if (!db_reconnect_ctl) { // This should never happen LOG_ERROR(dhcp6_logger, DHCP6_DB_RECONNECT_NO_DB_CTL); return (false); } + // Disable service until the connection is recovered. + if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries()) { + network_state_->disableService(NetworkState::Origin::DB_CONNECTION); + } + + LOG_INFO(dhcp6_logger, DHCP6_DB_RECONNECT_LOST_CONNECTION); + // If reconnect isn't enabled log it, initiate a shutdown and return false. if (!db_reconnect_ctl->retriesLeft() || !db_reconnect_ctl->retryInterval()) {