From: Marcin Siodelski Date: Mon, 25 Sep 2017 10:44:45 +0000 (+0200) Subject: [5307] Addressed review comments. X-Git-Tag: trac5363_base~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30ee1d625f0f823dab26e052e7fed57252742762;p=thirdparty%2Fkea.git [5307] Addressed review comments. - Increase total_attempts one by one. - Add debug message to indicate skipping reservations in subnet which classes do not match. --- diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 95049a131d..d4f0141f9a 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -333,6 +333,13 @@ AllocEngine::findReservationInternal(ContextType& ctx, break; } } + + } else { + LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE, + ALLOC_ENGINE_RESERVATIONS_SKIPPED) + .arg(ctx.query_->getLabel()) + .arg(subnet->toText()); + } // We need to get to the next subnet if this is a shared network. If it @@ -771,9 +778,10 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) { uint64_t max_attempts = (attempts_ > 0 ? attempts_ : subnet->getPoolCapacity(ctx.currentIA().type_)); - total_attempts += max_attempts; - for (uint64_t i = 0; i < max_attempts; ++i) { + + ++total_attempts; + IOAddress candidate = allocator->pickAddress(subnet, ctx.duid_, hint); diff --git a/src/lib/dhcpsrv/alloc_engine_messages.mes b/src/lib/dhcpsrv/alloc_engine_messages.mes index 43c137a18a..824bf98742 100644 --- a/src/lib/dhcpsrv/alloc_engine_messages.mes +++ b/src/lib/dhcpsrv/alloc_engine_messages.mes @@ -18,6 +18,12 @@ reclaimed has a corresponding DNS entry it needs to be removed. This message indicates that removal of the DNS entry has failed. Nevertheless the lease will be reclaimed. +% ALLOC_ENGINE_RESERVATIONS_SKIPPED %1 not using reservations in subnet %2 because client's classes do not match +This debug message is issued when the allocation engine will not use host +reservations in a given subnet because this subnet is not allowed for +the given client due to client classification. The first argument includes +client identification information. The second argument identifies a subnet. + % ALLOC_ENGINE_V4_ALLOC_ERROR %1: error during attempt to allocate an IPv4 address: %2 An error occurred during an attempt to allocate an IPv4 address, the reason for the failure being contained in the message. The server will