diff options
-rw-r--r-- | src/lib/dhcpsrv/alloc_engine.cc | 26 | ||||
-rw-r--r-- | src/lib/dhcpsrv/alloc_engine.h | 23 |
2 files changed, 8 insertions, 41 deletions
diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 3821c8e6ed..f1c7618604 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -1235,7 +1235,8 @@ AllocEngine::allocateReservedLeases6(ClientContext6& ctx, // If this is a real allocation, we may need to extend the lease // lifetime. - if (!ctx.fake_allocation_ && conditionalExtendLifetime(*lease)) { + if (!ctx.fake_allocation_) { + lease->cltt_ = time(NULL); LeaseMgrFactory::instance().updateLease6(lease); } return; @@ -1391,7 +1392,8 @@ AllocEngine::allocateGlobalReservedLeases6(ClientContext6& ctx, // If this is a real allocation, we may need to extend the lease // lifetime. - if (!ctx.fake_allocation_ && conditionalExtendLifetime(*lease)) { + if (!ctx.fake_allocation_) { + lease->cltt_ = time(NULL); LeaseMgrFactory::instance().updateLease6(lease); } @@ -2135,15 +2137,13 @@ AllocEngine::extendLease6(ClientContext6& ctx, Lease6Ptr lease) { } else { lease->valid_lft_ = ctx.subnet_->getValid(); } + lease->cltt_ = time(NULL); lease->hostname_ = ctx.hostname_; lease->fqdn_fwd_ = ctx.fwd_dns_update_; lease->fqdn_rev_ = ctx.rev_dns_update_; lease->hwaddr_ = ctx.hwaddr_; lease->state_ = Lease::STATE_DEFAULT; - // Extend lease lifetime if it is time to extend it. - conditionalExtendLifetime(*lease); - LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE_DETAIL_DATA, ALLOC_ENGINE_V6_EXTEND_NEW_LEASE_DATA) .arg(ctx.query_->getLabel()) @@ -2271,13 +2271,9 @@ AllocEngine::updateLeaseData(ClientContext6& ctx, const Lease6Collection& leases } } - bool fqdn_changed = ((lease->type_ != Lease::TYPE_PD) && - !(lease->hasIdenticalFqdn(**lease_it))); - - if (conditionalExtendLifetime(*lease) || fqdn_changed) { - ctx.currentIA().changed_leases_.push_back(*lease_it); - LeaseMgrFactory::instance().updateLease6(lease); - } + lease->cltt_ = time(NULL); + ctx.currentIA().changed_leases_.push_back(*lease_it); + LeaseMgrFactory::instance().updateLease6(lease); if (update_stats) { StatsMgr::instance().addValue( @@ -4365,11 +4361,5 @@ AllocEngine::updateLease6ExtendedInfo(const Lease6Ptr& lease, lease->setContext(user_context); } -bool -AllocEngine::conditionalExtendLifetime(Lease& lease) const { - lease.cltt_ = time(NULL); - return (true); -} - } // namespace dhcp } // namespace isc diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index f95898edfa..f914998d08 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -1845,29 +1845,6 @@ protected: private: - /// @brief Extends the lease lifetime. - /// - /// This function is called to conditionally extend the lifetime of - /// the DHCPv4 or DHCPv6 lease. It is envisaged that this function will - /// make a decision if the lease lifetime should be extended, using - /// a preconfigured threshold, which would indicate how many percent - /// of the valid lifetime should have passed for the lease lifetime - /// to be extended. The lease lifetime would not be extended if - /// the threshold hasn't been reached. - /// - /// @todo Currently this function always extends the lease lifetime. - /// In the future, it will take the threshold value into account, - /// once the threshold is configurable. - /// - /// @param [in,out] lease A lease for which the lifetime should be - /// extended. - /// - /// @return true if the lease lifetime has been extended, false - /// otherwise. - bool conditionalExtendLifetime(Lease& lease) const; - -private: - /// @brief Number of consecutive DHCPv4 leases' reclamations after /// which there are still expired leases in the database. uint16_t incomplete_v4_reclamations_; |