]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1405] addressed comments
authorRazvan Becheriu <razvan@isc.org>
Tue, 17 Nov 2020 11:05:38 +0000 (13:05 +0200)
committerRazvan Becheriu <razvan@isc.org>
Wed, 18 Nov 2020 13:55:24 +0000 (15:55 +0200)
src/lib/dhcpsrv/alloc_engine.cc

index 43cdfdb29aadc39ce5800f83063157874d0c9a24..d0c7f3da14effb801b257904e3618e9059f3a971 100644 (file)
@@ -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