]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4555] Addressed comment master Kea-3.3.0
authorFrancis Dupont <fdupont@isc.org>
Mon, 27 Jul 2026 14:22:49 +0000 (16:22 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 27 Jul 2026 15:00:43 +0000 (17:00 +0200)
src/bin/dhcp4/dhcp4_messages.cc
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_srv.cc

index 7d5b6fddfa4e7ac799088dfcd88271e6b170ddfa..b2b94a4418a5f6553f3929c7a737a98f51a9e864 100644 (file)
@@ -362,7 +362,7 @@ const char* values[] = {
     "DHCP4_SECURITY_CHECKS_DISABLED", "Invoked with command line option -X, Security checks are disabled!!",
     "DHCP4_SERVER_FAILED", "server failed: %1",
     "DHCP4_SERVER_INITIATED_DECLINE", "%1: Lease for addr %2 has been found to be already in use. The lease will be unavailable for %3 seconds.",
-    "DHCP4_SERVER_INITIATED_DECLINE_ADD_FAILED", "%1: error adding a lease for address %2",
+    "DHCP4_SERVER_INITIATED_DECLINE_ADD_FAILED", "%1: error adding a lease for address %2: %3",
     "DHCP4_SERVER_INITIATED_DECLINE_RESOURCE_BUSY", "%1: error declining a lease for address %2",
     "DHCP4_SERVER_INITIATED_DECLINE_UPDATE_FAILED", "%1: error updating lease for address %2",
     "DHCP4_SHUTDOWN", "server shutdown",
index 22d690b8d2e69e6a7f6ef985e0efd6e304e7fbd7..b8efaeb6d6b48368e8630dfd39bf8e4f970dccf1 100644 (file)
@@ -1137,11 +1137,11 @@ supposed to use. The server will fully recover from this situation, but if
 the underlying problem of a misconfigured or rogue device is not solved, this
 address may be declined again in the future.
 
-% DHCP4_SERVER_INITIATED_DECLINE_ADD_FAILED %1: error adding a lease for address %2
+% DHCP4_SERVER_INITIATED_DECLINE_ADD_FAILED %1: error adding a lease for address %2: %3
 This error message indicates that the server failed to add a DECLINED lease to
 the lease store. The first argument includes the client and the transaction
 identification information. The second argument holds the IPv4 address for which
-the decline was attempted.
+the decline was attempted, the last one the error message.
 
 % DHCP4_SERVER_INITIATED_DECLINE_RESOURCE_BUSY %1: error declining a lease for address %2
 This error message indicates that while one server thread was attempting to mark
index 9a8dc35a7459ca926511a2f10b6ac39a80dcfd8e..d6196164b7ec81a887198a7162f4431d08249201 100644 (file)
@@ -4536,16 +4536,15 @@ Dhcpv4Srv::serverDecline(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr& query
         }
 
         if (!lease_exists) {
-            bool done;
             try {
-                done = LeaseMgrFactory::instance().addLease(lease);
+                if (!LeaseMgrFactory::instance().addLease(lease)) {
+                    isc_throw(Unexpected, "lease already exists");
+                }
             } catch (const Exception& ex) {
-                done = false;
-            }
-            if (!done) {
                 LOG_ERROR(lease4_logger, DHCP4_SERVER_INITIATED_DECLINE_ADD_FAILED)
                     .arg(query->getLabel())
-                    .arg(lease->addr_.toText());
+                    .arg(lease->addr_.toText())
+                    .arg(ex.what());
                 return;
             }
         }