From: Francis Dupont Date: Thu, 9 Jul 2026 17:19:04 +0000 (+0200) Subject: [#4547] Updated the check X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e532daa109772cb876884ffb550537e03ea2952f;p=thirdparty%2Fkea.git [#4547] Updated the check --- diff --git a/src/bin/dhcp4/dhcp4_messages.cc b/src/bin/dhcp4/dhcp4_messages.cc index cfffda7254..d78af41d34 100644 --- a/src/bin/dhcp4/dhcp4_messages.cc +++ b/src/bin/dhcp4/dhcp4_messages.cc @@ -151,11 +151,11 @@ extern const isc::log::MessageID DHCP4_RECLAIM_EXPIRED_LEASES_FAIL = "DHCP4_RECL extern const isc::log::MessageID DHCP4_RECLAIM_EXPIRED_LEASES_SKIPPED = "DHCP4_RECLAIM_EXPIRED_LEASES_SKIPPED"; extern const isc::log::MessageID DHCP4_RECOVERED_STASHED_RELAY_AGENT_INFO = "DHCP4_RECOVERED_STASHED_RELAY_AGENT_INFO"; extern const isc::log::MessageID DHCP4_RELEASE = "DHCP4_RELEASE"; -extern const isc::log::MessageID DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE = "DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE"; extern const isc::log::MessageID DHCP4_RELEASE_DELETED = "DHCP4_RELEASE_DELETED"; extern const isc::log::MessageID DHCP4_RELEASE_EXCEPTION = "DHCP4_RELEASE_EXCEPTION"; extern const isc::log::MessageID DHCP4_RELEASE_EXPIRED = "DHCP4_RELEASE_EXPIRED"; extern const isc::log::MessageID DHCP4_RELEASE_FAIL = "DHCP4_RELEASE_FAIL"; +extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NOT_ASSIGNED = "DHCP4_RELEASE_FAIL_NOT_ASSIGNED"; extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE = "DHCP4_RELEASE_FAIL_NO_LEASE"; extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT = "DHCP4_RELEASE_FAIL_WRONG_CLIENT"; extern const isc::log::MessageID DHCP4_REQUEST = "DHCP4_REQUEST"; @@ -340,11 +340,11 @@ const char* values[] = { "DHCP4_RECLAIM_EXPIRED_LEASES_SKIPPED", "dhcp6 service is currently disabled. Try again in %1 seconds.", "DHCP4_RECOVERED_STASHED_RELAY_AGENT_INFO", "recovered for query %1 relay agent option from lease %2: %3", "DHCP4_RELEASE", "%1: address %2 was released properly.", - "DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE", "%1: client is trying to release the lease %2 which is already in the RELEASED state", "DHCP4_RELEASE_DELETED", "%1: address %2 was deleted on release.", "DHCP4_RELEASE_EXCEPTION", "%1: while trying to release address %2 an exception occurred: %3", "DHCP4_RELEASE_EXPIRED", "%1: address %2 expired on release.", "DHCP4_RELEASE_FAIL", "%1: failed to remove lease for address %2", + "DHCP4_RELEASE_FAIL_NOT_ASSIGNED", "%1: client is trying to release the lease %2 which is in the %3 state", "DHCP4_RELEASE_FAIL_NO_LEASE", "%1: client is trying to release non-existing lease %2", "DHCP4_RELEASE_FAIL_WRONG_CLIENT", "%1: client is trying to release the lease %2 which belongs to a different client", "DHCP4_REQUEST", "%1: server is processing DHCPREQUEST with hint=%2", diff --git a/src/bin/dhcp4/dhcp4_messages.h b/src/bin/dhcp4/dhcp4_messages.h index 9e1d9c2293..eb1a619538 100644 --- a/src/bin/dhcp4/dhcp4_messages.h +++ b/src/bin/dhcp4/dhcp4_messages.h @@ -152,11 +152,11 @@ extern const isc::log::MessageID DHCP4_RECLAIM_EXPIRED_LEASES_FAIL; extern const isc::log::MessageID DHCP4_RECLAIM_EXPIRED_LEASES_SKIPPED; extern const isc::log::MessageID DHCP4_RECOVERED_STASHED_RELAY_AGENT_INFO; extern const isc::log::MessageID DHCP4_RELEASE; -extern const isc::log::MessageID DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE; extern const isc::log::MessageID DHCP4_RELEASE_DELETED; extern const isc::log::MessageID DHCP4_RELEASE_EXCEPTION; extern const isc::log::MessageID DHCP4_RELEASE_EXPIRED; extern const isc::log::MessageID DHCP4_RELEASE_FAIL; +extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NOT_ASSIGNED; extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE; extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT; extern const isc::log::MessageID DHCP4_REQUEST; diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 7dd7f3c6e0..50afa34ef1 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -980,14 +980,6 @@ is a normal operation during client shutdown. The first argument includes the client and transaction identification information. The second argument includes the released IPv4 address. -% DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE %1: client is trying to release the lease %2 which is already in the RELEASED state -Logged at debug log level 50. -This debug message is issued when a client is trying to release the -lease which is already in the RELEASED state i.e. kept for the client -by the lease affinity feature. The first argument includes the client -and the transaction identification information. The second argument -specifies the leased address. - % DHCP4_RELEASE_DELETED %1: address %2 was deleted on release. This informational message indicates that an address was deleted on release. It is a normal operation during client shutdown. The first argument includes the @@ -1022,6 +1014,14 @@ first argument includes the client and the transaction identification information. The second argument holds the IPv4 address which release was attempted. +% DHCP4_RELEASE_FAIL_NOT_ASSIGNED %1: client is trying to release the lease %2 which is in the %3 state +Logged at debug log level 50. +This debug message is issued when a client is trying to release the +lease which is not in the default / assigned state e.g. kept for the client +by the lease affinity feature in the released state. The first argument +includes the client and the transaction identification information. +The second argument specifies the leased address, the last one the lease state. + % DHCP4_RELEASE_FAIL_NO_LEASE %1: client is trying to release non-existing lease %2 Logged at debug log level 50. This debug message is printed when client attempts to release a lease, diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index e0849df7bb..e2de71c907 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -4174,11 +4174,11 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release, AllocEngine::ClientContext4Ptr& cont return; } - if (lease->state_ == Lease4::STATE_RELEASED) { - LOG_DEBUG(lease4_logger, DBG_DHCP4_DETAIL, - DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE) + if (lease->state_ != Lease4::STATE_DEFAULT) { + LOG_DEBUG(lease4_logger, DBG_DHCP4_DETAIL, DHCP4_RELEASE_FAIL_NOT_ASSIGNED) .arg(release->getLabel()) - .arg(release->getCiaddr().toText()); + .arg(release->getCiaddr().toText()) + .arg(Lease::basicStatesToText(lease->state_)); return; } diff --git a/src/bin/dhcp4/tests/release_unittest.cc b/src/bin/dhcp4/tests/release_unittest.cc index 251a977679..6489cde979 100644 --- a/src/bin/dhcp4/tests/release_unittest.cc +++ b/src/bin/dhcp4/tests/release_unittest.cc @@ -555,8 +555,8 @@ TEST_F(ReleaseTest, releaseAlreadyReleased) { // assigned stat is decremented once. EXPECT_EQ(before, after + 1); - // The alredy in RELEASED state is logged. - EXPECT_EQ(1U, countFile("DHCP4_RELEASE_ALREADY_IN_RELEASED_STATE")); + // The not assigned failure is logged. + EXPECT_EQ(1U, countFile("DHCP4_RELEASE_FAIL_NOT_ASSIGNED")); } } // end of anonymous namespace