From: Marcin Siodelski Date: Sat, 24 Feb 2018 12:41:48 +0000 (+0100) Subject: [5437] Do not fetch reservations for subnets for which HR_DISABLED is set. X-Git-Tag: ha_checkpoints12~10^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fa70d00bd5bce8053e952bd7f89c6a6533f981e;p=thirdparty%2Fkea.git [5437] Do not fetch reservations for subnets for which HR_DISABLED is set. --- diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 24795c429c..8c9c2114fd 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -2512,15 +2512,17 @@ namespace { /// @return true if the address is reserved for another client. bool addressReserved(const IOAddress& address, const AllocEngine::ClientContext4& ctx) { - ConstHostPtr host = HostMgr::instance().get4(ctx.subnet_->getID(), address); - if (host) { - for (auto id = ctx.host_identifiers_.cbegin(); id != ctx.host_identifiers_.cend(); - ++id) { - if (id->first == host->getIdentifierType()) { - return (id->second != host->getIdentifier()); + if (ctx.subnet_ && (ctx.subnet_->getHostReservationMode() != Network::HR_DISABLED)) { + ConstHostPtr host = HostMgr::instance().get4(ctx.subnet_->getID(), address); + if (host) { + for (auto id = ctx.host_identifiers_.cbegin(); id != ctx.host_identifiers_.cend(); + ++id) { + if (id->first == host->getIdentifierType()) { + return (id->second != host->getIdentifier()); + } } + return (true); } - return (true); } return (false); } @@ -2804,7 +2806,8 @@ AllocEngine::findReservation(ClientContext4& ctx) { // Only makes sense to get reservations if the client has access // to the class. - if (subnet->clientSupported(ctx.query_->getClasses())) { + 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_) {