--- /dev/null
+[bug] tmark
+ Corrected an issue which caused kea-dhcp4 to
+ NAK requests for an offered lease when a
+ conflicting host reservation exists and
+ offer-lifetime is greater than zero. The
+ server will now remove the unusable lease,
+ renew the temporary lease, and send it back
+ in a DHCPACK.
+ (Gitlab #3555)
// client's current lease (client_lease) should no longer be used and
// so offered a different lease (existing) that was temporarily
// allocated because offer-lifetime is greater than zero. We need to
- // delete to unusable lease and renew the temporary lease.
+ // delete the unusable lease and renew the temporary lease.
if (((client_lease && existing) && (client_lease->addr_ != existing->addr_) &&
(existing->addr_ == ctx.requested_address_) &&
(existing->belongsToClient(ctx.hwaddr_, ctx.subnet_->getMatchClientId() ?
ALLOC_ENGINE_V4_REQUEST_EXTEND_LEASE)
.arg(ctx.query_->getLabel())
.arg(ctx.requested_address_);
-
return (renewLease4(client_lease, ctx));
}
}
LeaseMgrFactory::instance().addLease(lease);
LeaseMgrFactory::instance().addLease(lease2);
- // First when temporary allocations are off.
-
- // Client requests the second lease.
+ // When temporary allocations are off and client requests the
+ // second lease, the engine should not return a lease.
AllocEngine engine(0);
AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("192.0.2.102"),
false, false, "", false);
ASSERT_FALSE(new_lease);
- // Both leases should still be there.
+ // Both leases should still be in the lease back end.
ASSERT_TRUE(LeaseMgrFactory::instance().getLease4(lease->addr_));
ASSERT_TRUE(LeaseMgrFactory::instance().getLease4(lease2->addr_));
ctx2.query_.reset(new Pkt4(DHCPREQUEST, 1234));
new_lease = engine.allocateLease4(ctx2);
- // Allocation should renew it and remove the original lease.
+ // Allocation should return the second lease and remove the original lease.
ASSERT_TRUE(new_lease);
EXPECT_EQ("192.0.2.102", new_lease->addr_.toText());
- // Orignal lease should be gone.
+ // Orignal lease should have been deleted from lease back.
ASSERT_FALSE(LeaseMgrFactory::instance().getLease4(lease->addr_));
}