From: Razvan Becheriu Date: Tue, 13 Oct 2020 07:45:35 +0000 (+0300) Subject: [#1434] if lease exists, update old expire and old valid lifetime X-Git-Tag: Kea-1.9.1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aee56fd0dc91f4879c0e59c0ebb423e4ffd9fc22;p=thirdparty%2Fkea.git [#1434] if lease exists, update old expire and old valid lifetime --- diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index bda327dea1..041bc34470 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -1699,6 +1699,8 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, } else if (existing_lease->cltt_ < lease->cltt_) { // If the existing lease is older than the fetched lease, update // the lease in our local database. + lease->old_cltt_ = existing_lease->old_cltt_; + lease->old_valid_lft_ = existing_lease->old_valid_lft_; LeaseMgrFactory::instance().updateLease4(lease); } else { @@ -1728,6 +1730,8 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, } else if (existing_lease->cltt_ < lease->cltt_) { // If the existing lease is older than the fetched lease, update // the lease in our local database. + lease->old_cltt_ = existing_lease->old_cltt_; + lease->old_valid_lft_ = existing_lease->old_valid_lft_; LeaseMgrFactory::instance().updateLease6(lease); } else { diff --git a/src/hooks/dhcp/lease_cmds/lease_cmds.cc b/src/hooks/dhcp/lease_cmds/lease_cmds.cc index 80c0859560..841cc1eb7e 100644 --- a/src/hooks/dhcp/lease_cmds/lease_cmds.cc +++ b/src/hooks/dhcp/lease_cmds/lease_cmds.cc @@ -654,6 +654,8 @@ LeaseCmdsImpl::addOrUpdate4(Lease4Ptr lease, bool force_create) { LeaseCmdsImpl::updateStatsOnAdd(lease); return (true); } + lease->old_cltt_ = existing->old_cltt_; + lease->old_valid_lft_ = existing->old_valid_lft_; LeaseMgrFactory::instance().updateLease4(lease); LeaseCmdsImpl::updateStatsOnUpdate(existing, lease); return (false); @@ -672,6 +674,8 @@ LeaseCmdsImpl::addOrUpdate6(Lease6Ptr lease, bool force_create) { LeaseCmdsImpl::updateStatsOnAdd(lease); return (true); } + lease->old_cltt_ = existing->old_cltt_; + lease->old_valid_lft_ = existing->old_valid_lft_; LeaseMgrFactory::instance().updateLease6(lease); LeaseCmdsImpl::updateStatsOnUpdate(existing, lease); return (false);