]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1335] added try catch block and error message for lease reclamation
authorRazvan Becheriu <razvan@isc.org>
Wed, 12 Aug 2020 11:19:29 +0000 (14:19 +0300)
committerRazvan Becheriu <razvan@isc.org>
Fri, 14 Aug 2020 18:13:19 +0000 (21:13 +0300)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/dhcp6_messages.mes

index 33efa9c5039df6eaeeea7a89a844bf2b708550d1..45b4da3516b44792efdbdc4fa4a6f1be0412f1db 100644 (file)
@@ -1118,10 +1118,14 @@ void
 ControlledDhcpv4Srv::reclaimExpiredLeases(const size_t max_leases,
                                           const uint16_t timeout,
                                           const bool remove_lease,
-                                          const uint16_t max_unwarned_cycles) {
-    server_->alloc_engine_->reclaimExpiredLeases4(max_leases, timeout,
-                                                  remove_lease,
-                                                  max_unwarned_cycles);
+    try {
+        server_->alloc_engine_->reclaimExpiredLeases4(max_leases, timeout,
+                                                      remove_lease,
+                                                      max_unwarned_cycles);
+    } catch (const std::exception& ex) {
+        LOG_ERROR(dhcp4_logger, DHCP4_RECLAIM_EXPIRED_LEASES_FAIL)
+            .arg(ex.what());
+    }
     // We're using the ONE_SHOT timer so there is a need to re-schedule it.
     TimerMgr::instance()->setup(CfgExpiration::RECLAIM_EXPIRED_TIMER_NAME);
 }
index 615d835a907800113b7f45f57dacb18e9a3cf43b..cfb510fa5c17a40c02f6a686c4e61e91db6c5a27 100644 (file)
@@ -433,6 +433,10 @@ and transaction identification information. The second argument contains
 the client's IPv4 address to which the response will be sent. The third
 argument contains the local interface name.
 
+% DHCP4_RECLAIM_EXPIRED_LEASES_FAIL failed to reclaim expired leases: %1
+This error message indicates that the reclaim expired leases operation failed,
+also providing the cause of failure.
+
 % DHCP4_INIT_FAIL failed to initialize Kea server: %1
 The server has failed to initialize. This may be because the configuration
 was not successful, or it encountered any other critical error on startup.
index dd4bc17880b84022fb65a44e44930a754a2bcd60..1b73cb83b34dc6860a56fe2e0d5552f0a636492a 100644 (file)
@@ -1138,9 +1138,14 @@ ControlledDhcpv6Srv::reclaimExpiredLeases(const size_t max_leases,
                                           const uint16_t timeout,
                                           const bool remove_lease,
                                           const uint16_t max_unwarned_cycles) {
-    server_->alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
-                                                  remove_lease,
-                                                  max_unwarned_cycles);
+    try {
+        server_->alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
+                                                      remove_lease,
+                                                      max_unwarned_cycles);
+    } catch (const std::exception& ex) {
+        LOG_ERROR(dhcp6_logger, DHCP6_RECLAIM_EXPIRED_LEASES_FAIL)
+            .arg(ex.what());
+    }
     // We're using the ONE_SHOT timer so there is a need to re-schedule it.
     TimerMgr::instance()->setup(CfgExpiration::RECLAIM_EXPIRED_TIMER_NAME);
 }
index acd61759e6c713053e72602bcebee56fd72ac2bb..14250768c41cb7d3c7fbeeba1b42863901410dff 100644 (file)
@@ -436,6 +436,10 @@ will be only able to offer global options - no addresses or prefixes
 will be assigned. The argument holds the client and transaction
 identification information.
 
+% DHCP6_RECLAIM_EXPIRED_LEASES_FAIL failed to reclaim expired leases: %1
+This error message indicates that the reclaim expired leases operation failed,
+also providing the cause of failure.
+
 % DHCP6_INIT_FAIL failed to initialize Kea server: %1
 The server has failed to establish communication with the rest of Kea,
 failed to read JSON configuration file or encountered any other critical