From: Razvan Becheriu Date: Tue, 17 Nov 2020 11:05:38 +0000 (+0200) Subject: [#1405] addressed comments X-Git-Tag: Kea-1.9.2~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=506051bc6c4bf6e0dbb9ca2713eee9dfd3d68e1a;p=thirdparty%2Fkea.git [#1405] addressed comments --- diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 43cdfdb29a..d0c7f3da14 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -2965,14 +2965,11 @@ namespace { /// @return true if the address is reserved for another client. bool addressReserved(const IOAddress& address, const AllocEngine::ClientContext4& ctx) { - if (!ctx.subnet_) { - return false; - } - bool in_subnet = ctx.subnet_->getReservationsInSubnet(); // The out-of-pool flag indicates that no client should be assigned reservations // from within the dynamic pool, and for that reason we only look at reservations that // are outside the pools, hence the inPool check. - if (in_subnet && (!ctx.subnet_->getReservationsOutOfPool() || + if (ctx.subnet_ && ctx.subnet_->getReservationsInSubnet() && + (!ctx.subnet_->getReservationsOutOfPool() || !ctx.subnet_->inPool(Lease::TYPE_V4, address))) { // The global parameter ip-reservations-unique controls whether it is allowed // to specify multiple reservations for the same IP address or delegated prefix