2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[5437] HR_DISABLED option handling moved to subnet level.

This commit is contained in:
Marcin Siodelski
2018-02-27 18:20:17 +01:00
parent 1e5119400c
commit a3114dfcc8
2 changed files with 9 additions and 7 deletions

View File

@@ -316,8 +316,7 @@ Dhcpv6Srv::initContext(const Pkt6Ptr& pkt,
// Collect host identifiers if host reservations enabled. The identifiers
// are stored in order of preference. The server will use them in that
// order to search for host reservations.
if (ctx.subnet_ &&
(ctx.subnet_->getHostReservationMode() != Network::HR_DISABLED)) {
if (ctx.subnet_) {
const ConstCfgHostOperationsPtr cfg =
CfgMgr::instance().getCurrentCfg()->getCfgHostOperations6();
BOOST_FOREACH(const Host::IdentifierType& id_type,

View File

@@ -536,8 +536,9 @@ void AllocEngine::findReservation(ClientContext6& ctx) {
while (subnet) {
// Only makes sense to get reservations if the client has access
// to the class.
if (subnet->clientSupported(ctx.query_->getClasses())) {
// to the class and host reservations are enabled.
if (subnet->clientSupported(ctx.query_->getClasses()) &&
(subnet->getHostReservationMode() != Network::HR_DISABLED)) {
// Iterate over configured identifiers in the order of preference
// and try to use each of them to search for the reservations.
BOOST_FOREACH(const IdentifierPair& id_pair, ctx.host_identifiers_) {
@@ -750,9 +751,6 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
<< Lease6::typeToText(ctx.currentIA().type_));
}
// Check which host reservation mode is supported in this subnet.
Network::HRMode hr_mode = ctx.subnet_->getHostReservationMode();
Lease6Collection leases;
IOAddress hint = IOAddress::IPV6_ZERO_ADDRESS();
@@ -789,6 +787,9 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
if (pool) {
// Check which host reservation mode is supported in this subnet.
Network::HRMode hr_mode = subnet->getHostReservationMode();
/// @todo: We support only one hint for now
Lease6Ptr lease =
LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_, hint);
@@ -893,6 +894,8 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
}
uint64_t max_attempts = (attempts_ > 0 ? attempts_ : possible_attempts);
Network::HRMode hr_mode = subnet->getHostReservationMode();
for (uint64_t i = 0; i < max_attempts; ++i) {
++total_attempts;