2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 18:08:16 +00:00

[#3648] addressed review comments

This commit is contained in:
Razvan Becheriu 2025-03-14 16:25:35 +02:00
parent ae7cddb5d8
commit 12d89b6130
5 changed files with 24 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2326. [bug] razvan
Fixed a bug which was causing the allocation engine to reject the
lease if a data race caused by a different server updating the
shared database entries was detected. The entire packet is now
dropped in this particular case. This applies to both kea-dhp4
and kea-dhcp6 servers.
(Gitlab #3648)
2325. [bug] razvan
Fixed a bug which was causing address allocation counters to be
negative when client released leases and the server has lease

View File

@ -3266,7 +3266,8 @@ MySqlLeaseMgr::updateLeaseCommon(MySqlLeaseContextPtr& ctx,
// If no rows affected, lease doesn't exist.
if (affected_rows == 0) {
isc_throw(NoSuchLease, "unable to update lease for address " <<
lease->addr_.toText() << " as it does not exist");
lease->addr_.toText() << " either because the lease does not exist, "
"it has been deleted or it has changed in the database.");
}
// Should not happen - primary key constraint should only have selected

View File

@ -2500,7 +2500,8 @@ PgSqlLeaseMgr::updateLeaseCommon(PgSqlLeaseContextPtr& ctx,
// If no rows affected, lease doesn't exist.
if (affected_rows == 0) {
isc_throw(NoSuchLease, "unable to update lease for address " <<
lease->addr_.toText() << " as it does not exist");
lease->addr_.toText() << " either because the lease does not exist, "
"it has been deleted or it has changed in the database.");
}
// Should not happen - primary key constraint should only have selected

View File

@ -630,8 +630,8 @@ AllocEngine::allocateLeases6(ClientContext6& ctx) {
return (leases);
}
} catch (const NoSuchLease&) {
throw;
} catch (const NoSuchLease& e) {
isc_throw(NoSuchLease, "detected data race in AllocEngine::allocateLeases6: " << e.what());
} catch (const isc::Exception& e) {
@ -2186,8 +2186,8 @@ AllocEngine::renewLeases6(ClientContext6& ctx) {
return (leases);
} catch (const NoSuchLease&) {
throw;
} catch (const NoSuchLease& e) {
isc_throw(NoSuchLease, "detected data race in AllocEngine::renewLeases6: " << e.what());
} catch (const isc::Exception& e) {
@ -3753,8 +3753,8 @@ AllocEngine::allocateLease4(ClientContext4& ctx) {
ctx.new_lease_ = requestLease4(ctx);
}
} catch (const NoSuchLease&) {
throw;
} catch (const NoSuchLease& e) {
isc_throw(NoSuchLease, "detected data race in AllocEngine::allocateLease4: " << e.what());
} catch (const isc::Exception& e) {
// Some other error, return an empty lease.

View File

@ -1862,8 +1862,9 @@ Memfile_LeaseMgr::updateLease4Internal(const Lease4Ptr& lease) {
((*lease_it)->valid_lft_ != lease->current_valid_lft_))) {
// For test purpose only: check that the lease has not changed in
// the database.
isc_throw(NoSuchLease, "failed to update the lease with address "
<< lease->addr_ << " - lease has changed in database");
isc_throw(NoSuchLease, "unable to update lease for address " <<
lease->addr_.toText() << " either because the lease does not exist, "
"it has been deleted or it has changed in the database.");
}
// Try to write a lease to disk first. If this fails, the lease will
@ -1925,8 +1926,9 @@ Memfile_LeaseMgr::updateLease6Internal(const Lease6Ptr& lease) {
((*lease_it)->valid_lft_ != lease->current_valid_lft_))) {
// For test purpose only: check that the lease has not changed in
// the database.
isc_throw(NoSuchLease, "failed to update the lease with address "
<< lease->addr_ << " - lease has changed in database");
isc_throw(NoSuchLease, "unable to update lease for address " <<
lease->addr_.toText() << " either because the lease does not exist, "
"it has been deleted or it has changed in the database.");
}
// Try to write a lease to disk first. If this fails, the lease will