]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1434] if lease exists, update old expire and old valid lifetime
authorRazvan Becheriu <razvan@isc.org>
Tue, 13 Oct 2020 07:45:35 +0000 (10:45 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 22 Oct 2020 14:45:15 +0000 (17:45 +0300)
src/hooks/dhcp/high_availability/ha_service.cc
src/hooks/dhcp/lease_cmds/lease_cmds.cc

index bda327dea16a4555390f7838a71eddff77fa5a54..041bc344700c18602bcb2ddacae32db4b7dfa22f 100644 (file)
@@ -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 {
index 80c0859560a470df9ced419a36b0d08a0adec396..841cc1eb7e0e69ec076a3a9f7e9eb30e1fad8672 100644 (file)
@@ -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);