]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2348] Addressed review comments
authorMarcin Siodelski <marcin@isc.org>
Wed, 16 Nov 2022 10:18:49 +0000 (11:18 +0100)
committerMarcin Siodelski <marcin@isc.org>
Mon, 21 Nov 2022 07:52:03 +0000 (08:52 +0100)
- Remove unused AllocEngine ctor parameter
- Simplify locks
- Use default keyword instead of an empty implementation in dtors
- Fix typos

16 files changed:
src/bin/dhcp4/dhcp4_srv.cc
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/alloc_engine.h
src/lib/dhcpsrv/allocation_state.cc
src/lib/dhcpsrv/allocation_state.h
src/lib/dhcpsrv/allocator.h
src/lib/dhcpsrv/iterative_allocation_state.cc
src/lib/dhcpsrv/iterative_allocation_state.h
src/lib/dhcpsrv/pool.cc
src/lib/dhcpsrv/pool.h
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine_hooks_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine_utils.h
src/lib/dhcpsrv/tests/iterative_allocation_state_unittest.cc

index 7c1bfb60ae6ba171df1fecb9732bc557ca47285d..9531c395a27d29a5e46af7076223bb21f2734760 100644 (file)
@@ -637,7 +637,7 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t server_port, uint16_t client_port,
         // Instantiate allocation engine. The number of allocation attempts equal
         // to zero indicates that the allocation engine will use the number of
         // attempts depending on the pool size.
-        alloc_engine_.reset(new AllocEngine(0, false /* false = IPv4 */));
+        alloc_engine_.reset(new AllocEngine(0));
 
         /// @todo call loadLibraries() when handling configuration changes
 
index 65aae2d8d5a7024113249498cc594762081f916b..1bb181bf8c25bee4a5c6404e694c3f5409e5e162 100644 (file)
@@ -90,7 +90,7 @@ AllocEngineHooks Hooks;
 namespace isc {
 namespace dhcp {
 
-AllocEngine::AllocEngine(uint64_t attempts, bool ipv6)
+AllocEngine::AllocEngine(uint64_t attempts)
     : attempts_(attempts), incomplete_v4_reclamations_(0),
       incomplete_v6_reclamations_(0) {
 
index ef4ba1b29912b2d640877e25625ae1a8765f2c6e..99006def7947030ec2ca15b1dcbfba8578884a78 100644 (file)
@@ -56,8 +56,7 @@ public:
     ///
     /// @param attempts number of attempts for each lease allocation before
     ///        we give up (0 means unlimited)
-    /// @param ipv6 specifies if the engine should work for IPv4 or IPv6
-    AllocEngine(uint64_t attempts, bool ipv6 = true);
+    AllocEngine(uint64_t attempts);
 
     /// @brief Destructor.
     virtual ~AllocEngine() { }
index 14f88f48a041b443a12b0503981db015a5ad5429..1b8b5a18b975a099d9b1b34b8ae67703e996dcf4 100644 (file)
@@ -25,12 +25,8 @@ SubnetAllocationState::SubnetAllocationState()
 
 boost::posix_time::ptime
 SubnetAllocationState::getLastAllocatedTime(Lease::Type type) const {
-    if (MultiThreadingMgr::instance().getMode()) {
-        std::lock_guard<std::mutex> lock(*mutex_);
-        return (getLastAllocatedTimeInternal(type));
-    } else {
-        return (getLastAllocatedTimeInternal(type));
-    }
+    MultiThreadingLock lock(*mutex_);
+    return (getLastAllocatedTimeInternal(type));
 }
 
 boost::posix_time::ptime
index 98fcefb025e4c2f4f26521587b939f15bf40b60f..c2890686b5f829dc64e45de49324aff06bd98e26 100644 (file)
@@ -32,7 +32,7 @@ class AllocationState {
 public:
 
     /// @brief Virtual destructor.
-    virtual ~AllocationState() {}
+    virtual ~AllocationState() = default;
 };
 
 /// @brief Type of the pointer to the @c AllocationState.
index 77a4d58595d438e5921a29118e854f735843814b..7a902bb5deef4fb1f2f525dada21cce628fd3f42 100644 (file)
@@ -68,8 +68,7 @@ public:
     }
 
     /// @brief Virtual destructor
-    virtual ~Allocator() {
-    }
+    virtual ~Allocator() = default;
 
     /// @brief Picks an address or a delegated prefix.
     ///
@@ -98,12 +97,8 @@ public:
     pickAddress(const ClientClasses& client_classes,
                 const DuidPtr& duid,
                 const asiolink::IOAddress& hint) {
-        if (util::MultiThreadingMgr::instance().getMode()) {
-            std::lock_guard<std::mutex> lock(mutex_);
-            return pickAddressInternal(client_classes, duid, hint);
-        } else {
-            return pickAddressInternal(client_classes, duid, hint);
-        }
+        util::MultiThreadingLock lock(mutex_);
+        return (pickAddressInternal(client_classes, duid, hint));
     }
 
 private:
index b165b95b5fda7eac6e28f793bbaf1c5ac21b517d..098973f162fa9a5f0bac7b077c528d744e1ee856 100644 (file)
@@ -26,53 +26,34 @@ SubnetIterativeAllocationState::create(const SubnetPtr& subnet) {
 SubnetIterativeAllocationState::SubnetIterativeAllocationState(const IOAddress& prefix,
                                                                const uint8_t prefix_length)
     : SubnetAllocationState(),
-      last_allocated_ia_(lastAddrInPrefix(prefix, prefix_length)),
+      last_allocated_address_(lastAddrInPrefix(prefix, prefix_length)),
       last_allocated_ta_(lastAddrInPrefix(prefix, prefix_length)),
       last_allocated_pd_(lastAddrInPrefix(prefix, prefix_length)) {
 }
 
 IOAddress
 SubnetIterativeAllocationState::getLastAllocated(Lease::Type type) const {
-    if (MultiThreadingMgr::instance().getMode()) {
-        std::lock_guard<std::mutex> lock(*mutex_);
-        return (getLastAllocatedInternal(type));
-    } else {
-        return (getLastAllocatedInternal(type));
-    }
-}
-
-void
-SubnetIterativeAllocationState::setLastAllocated(Lease::Type type, const IOAddress& address) {
-    if (MultiThreadingMgr::instance().getMode()) {
-        std::lock_guard<std::mutex> lock(*mutex_);
-        setLastAllocatedInternal(type, address);
-    } else {
-        setLastAllocatedInternal(type, address);
-    }
-}
-
-IOAddress
-SubnetIterativeAllocationState::getLastAllocatedInternal(Lease::Type type) const {
+    MultiThreadingLock lock(*mutex_);
     switch (type) {
     case Lease::TYPE_V4:
     case Lease::TYPE_NA:
-        return last_allocated_ia_;
+        return (last_allocated_address_);
     case Lease::TYPE_TA:
-        return last_allocated_ta_;
+        return (last_allocated_ta_);
     case Lease::TYPE_PD:
-        return last_allocated_pd_;
+        return (last_allocated_pd_);
     default:
         isc_throw(BadValue, "pool type " << type << " not supported");
     }
 }
 
 void
-SubnetIterativeAllocationState::setLastAllocatedInternal(Lease::Type type,
-                                                         const IOAddress& address) {
+SubnetIterativeAllocationState::setLastAllocated(Lease::Type type, const IOAddress& address) {
+    MultiThreadingLock lock(*mutex_);
     switch (type) {
     case Lease::TYPE_V4:
     case Lease::TYPE_NA:
-        last_allocated_ia_ = address;
+        last_allocated_address_ = address;
         break;
     case Lease::TYPE_TA:
         last_allocated_ta_ = address;
index 50ca973b27207477d38c8a8fdff9f9201df2997d..278c09fed34adfec3a554b96f973827fdb377b93 100644 (file)
@@ -53,7 +53,7 @@ public:
     /// @return last allocated address or prefix of a given type.
     asiolink::IOAddress getLastAllocated(Lease::Type type) const;
 
-    /// @brief Sets last alocated address or prefix.
+    /// @brief Sets last allocated address or prefix.
     ///
     /// @param type type of the last allocated lease set.
     /// @param address an address or prefix last allocated.
@@ -61,22 +61,6 @@ public:
 
 private:
 
-    /// @brief Returns last allocated address or prefix.
-    ///
-    /// It must be called in the thread-safe context.
-    ///
-    /// @param type type of the last allocated lease to be returned.
-    /// @return last allocated address or prefix of a given type.
-    asiolink::IOAddress getLastAllocatedInternal(Lease::Type type) const;
-
-    /// @brief Sets last alocated address or prefix.
-    ///
-    /// It must be called in the thread-safe context.
-    ///
-    /// @param type type of the last allocated lease set.
-    /// @param address an address or prefix last allocated.
-    void setLastAllocatedInternal(Lease::Type type, const asiolink::IOAddress& address);
-
     /// @brief Last allocated address.
     ///
     /// This is the last allocated address that was previously allocated from
@@ -85,16 +69,16 @@ private:
     /// removing a pool, restarting or changing allocation algorithms. For
     /// that purpose it should be only considered a help that should not be
     /// fully trusted.
-    asiolink::IOAddress last_allocated_ia_;
+    asiolink::IOAddress last_allocated_address_;
 
     /// @brief Last allocated temporary address.
     ///
-    /// See @ref last_allocated_ia_ for details.
+    /// See @ref last_allocated_address_ for details.
     asiolink::IOAddress last_allocated_ta_;
 
     /// @brief Last allocated IPv6 prefix.
     ///
-    /// See @ref last_allocated_ia_ for details.
+    /// See @ref last_allocated_address_ for details.
     asiolink::IOAddress last_allocated_pd_;
 };
 
index 518b79f0b3ef709a078d59a6a2e09b54f34269dc..04788b8b520f27545976ccd0930660282494dd70 100644 (file)
@@ -22,7 +22,6 @@ Pool::Pool(Lease::Type type, const isc::asiolink::IOAddress& first,
            const isc::asiolink::IOAddress& last)
     :id_(getNextID()), first_(first), last_(last), type_(type),
      capacity_(0), cfg_option_(new CfgOption()), client_class_(""),
-     last_allocated_(first), last_allocated_valid_(false),
      permutation_() {
 }
 
index 892cd07cb3f37576c12dfbc177b4d20de9da49f8..8917e81167b102cedfa743a5979b4587b2e97cd2 100644 (file)
@@ -229,14 +229,6 @@ protected:
     /// @brief Holds pool-specific allocation state.
     AllocationStatePtr allocation_state_;
 
-    /// @brief Last allocated address
-    /// See @ref isc::dhcp::Subnet::last_allocated_ia_
-    /// Initialized and reset to first
-    isc::asiolink::IOAddress last_allocated_;
-
-    /// @brief Status of last allocated address
-    bool last_allocated_valid_;
-
     /// @brief Pointer to the permutation object.
     ///
     /// It may be initialized for some pools to provide address
index 9abc2b780048729ddaab0ad1b6eba2a2aff3af97..53c78b747e8f74c7e06c4900727dae71c59df1af 100644 (file)
@@ -48,7 +48,7 @@ TEST_F(AllocEngine4Test, constructor) {
 
     // Create V4 (ipv6=false) Allocation Engine that will try at most
     // 100 attempts to pick up a lease
-    ASSERT_NO_THROW(x.reset(new AllocEngine(100, false)));
+    ASSERT_NO_THROW(x.reset(new AllocEngine(100)));
 }
 
 // This test checks if two simple IPv4 allocations succeed and that the
@@ -63,7 +63,7 @@ TEST_F(AllocEngine4Test, constructor) {
 // not interfere with the allocation.
 TEST_F(AllocEngine4Test, simpleAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Assigned addresses should be zero.
@@ -149,7 +149,7 @@ TEST_F(AllocEngine4Test, simpleAlloc4) {
 // This test checks that simple allocation uses the default valid lifetime.
 TEST_F(AllocEngine4Test, defaultAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -181,7 +181,7 @@ TEST_F(AllocEngine4Test, defaultAlloc4) {
 // This test checks that simple allocation uses the specified valid lifetime.
 TEST_F(AllocEngine4Test, hintAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -217,7 +217,7 @@ TEST_F(AllocEngine4Test, hintAlloc4) {
 // This test checks that simple allocation uses the min valid lifetime.
 TEST_F(AllocEngine4Test, minAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -254,7 +254,7 @@ TEST_F(AllocEngine4Test, minAlloc4) {
 // This test checks that simple allocation uses the max valid lifetime.
 TEST_F(AllocEngine4Test, maxAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -291,7 +291,7 @@ TEST_F(AllocEngine4Test, maxAlloc4) {
 // This test checks that simple allocation handles BOOTP queries.
 TEST_F(AllocEngine4Test, bootpAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -333,7 +333,7 @@ TEST_F(AllocEngine4Test, bootpAlloc4) {
 // This test checks if the fake allocation (for DHCPDISCOVER) can succeed
 TEST_F(AllocEngine4Test, fakeAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Assigned addresses should be zero.
@@ -375,7 +375,7 @@ TEST_F(AllocEngine4Test, fakeAlloc4) {
 // in pool and free) can succeed
 TEST_F(AllocEngine4Test, allocWithValidHint4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
@@ -408,7 +408,7 @@ TEST_F(AllocEngine4Test, allocWithValidHint4) {
 // in pool, but is currently used can succeed
 TEST_F(AllocEngine4Test, allocWithUsedHint4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Let's create a lease and put it in the LeaseMgr
@@ -453,7 +453,7 @@ TEST_F(AllocEngine4Test, allocWithUsedHint4) {
 // can succeed. The invalid hint should be ignored completely.
 TEST_F(AllocEngine4Test, allocBogusHint4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Client would like to get a 10.1.1.1 lease, which does not belong to any
@@ -484,7 +484,7 @@ TEST_F(AllocEngine4Test, allocBogusHint4) {
 // This test checks that NULL values are handled properly
 TEST_F(AllocEngine4Test, allocateLease4Nulls) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Allocations without subnet are not allowed
@@ -557,7 +557,7 @@ TEST_F(AllocEngine4Test, allocateLease4Nulls) {
 // an existing lease and assigned-leases increments accordingly
 TEST_F(AllocEngine4Test, simpleRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     EXPECT_TRUE(testStatistics("assigned-addresses", 0, subnet_->getID()));
@@ -606,7 +606,7 @@ TEST_F(AllocEngine4Test, simpleRenew4) {
 // This test checks simple renewal uses the default valid lifetime.
 TEST_F(AllocEngine4Test, defaultRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -643,7 +643,7 @@ TEST_F(AllocEngine4Test, defaultRenew4) {
 // This test checks simple renewal uses the specified valid lifetime.
 TEST_F(AllocEngine4Test, hintRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -684,7 +684,7 @@ TEST_F(AllocEngine4Test, hintRenew4) {
 // This test checks simple renewal uses the min valid lifetime.
 TEST_F(AllocEngine4Test, minRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -726,7 +726,7 @@ TEST_F(AllocEngine4Test, minRenew4) {
 // This test checks simple renewal uses the max valid lifetime.
 TEST_F(AllocEngine4Test, maxRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -768,7 +768,7 @@ TEST_F(AllocEngine4Test, maxRenew4) {
 // This test checks simple renewal handles BOOTP queries.
 TEST_F(AllocEngine4Test, bootpRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -825,7 +825,7 @@ TEST_F(AllocEngine4Test, bootpRenew4) {
 // This test checks if really small pools are working
 TEST_F(AllocEngine4Test, smallPool4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     IOAddress addr("192.0.2.17");
@@ -869,7 +869,7 @@ TEST_F(AllocEngine4Test, smallPool4) {
 // to find out a new lease fails.
 TEST_F(AllocEngine4Test, outOfAddresses4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     IOAddress addr("192.0.2.17");
@@ -929,7 +929,7 @@ public:
 
     /// @brief Initializes configuration (2 subnets, 1 shared network)
     SharedNetworkAlloc4Test()
-        :engine_(0, false) {
+        :engine_(0) {
         // Create two subnets, each with a single address pool. The first subnet
         // has only one address in its address pool to make it easier to simulate
         // address exhaustion.
@@ -1583,7 +1583,7 @@ TEST_F(SharedNetworkAlloc4Test, requestSharedNetworkReservationsNoColl) {
 // allocation)
 TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     IOAddress addr("192.0.2.15");
@@ -1651,7 +1651,7 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
 // This test checks if an expired lease can be reused in REQUEST (actual allocation)
 TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     IOAddress addr("192.0.2.105");
@@ -1720,7 +1720,7 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
 // to DHCPDISCOVER (fake allocation)
 TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4) {
 
-    AllocEnginePtr engine(new AllocEngine(                                          0, false));
+    AllocEnginePtr engine(new AllocEngine(                                          0));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -1757,7 +1757,7 @@ TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4) {
 TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4Stats) {
 
     // Now prepare for DISCOVER processing
-    AllocEnginePtr engine(new AllocEngine(                                          0, false));
+    AllocEnginePtr engine(new AllocEngine(                                          0));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -1797,7 +1797,7 @@ TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4Stats) {
 // to REQUEST (actual allocation)
 TEST_F(AllocEngine4Test, requestReuseDeclinedLease4) {
 
-    AllocEnginePtr engine(new AllocEngine(                                          0, false));
+    AllocEnginePtr engine(new AllocEngine(                                          0));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -1832,7 +1832,7 @@ TEST_F(AllocEngine4Test, requestReuseDeclinedLease4) {
 // is reused when responding to DHCPREQUEST (actual allocation)
 TEST_F(AllocEngine4Test, requestReuseDeclinedLease4Stats) {
 
-    AllocEnginePtr engine(new AllocEngine(                                          0, false));
+    AllocEnginePtr engine(new AllocEngine(                                          0));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -1882,7 +1882,7 @@ TEST_F(AllocEngine4Test, identifyClientLease) {
                                100, time(NULL), subnet_->getID()));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
                                     IOAddress::IPV4_ZERO_ADDRESS(),
                                     false, false, "", true);
@@ -1961,7 +1961,7 @@ TEST_F(AllocEngine4Test, requestOtherClientLease) {
     LeaseMgrFactory::instance().addLease(lease);
     LeaseMgrFactory::instance().addLease(lease2);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // First client requests the lease which belongs to the second client.
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("192.0.2.102"),
@@ -2011,7 +2011,7 @@ TEST_F(AllocEngine4Test, reservedAddressNoHint) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Try to allocate a lease without specifying a hint. This is actually
     // incorrect behavior of the client to not send an address it wants to
@@ -2050,7 +2050,7 @@ TEST_F(AllocEngine4Test,reservedAddressNoHintFakeAllocation) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Query allocation engine for the lease to be assigned to this
     // client without specifying the address to be assigned.
@@ -2091,7 +2091,7 @@ TEST_F(AllocEngine4Test, reservedAddressHint) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
                                      IOAddress("192.0.2.234"), false, false,
@@ -2152,7 +2152,7 @@ TEST_F(AllocEngine4Test, reservedAddressHintFakeAllocation) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Query the allocation engine for the lease to be assigned to the client
     // and specify a hint being a different address than the reserved one.
@@ -2200,7 +2200,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLease) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Request allocation of the reserved address.
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
@@ -2249,7 +2249,7 @@ TEST_F(AllocEngine4Test, reservedAddressHijacked) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Try to allocate the reserved lease to client B.
     AllocEngine::ClientContext4 ctx1(subnet_, clientid_, hwaddr_,
@@ -2330,7 +2330,7 @@ TEST_F(AllocEngine4Test, reservedAddressHijackedFakeAllocation) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Query allocation engine for the lease to be allocated to the client B.
     // The allocation engine is not able to allocate the lease to the client
@@ -2389,7 +2389,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseInvalidHint) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Try to allocate a lease and specify a different address than reserved
     // and different from the one that client is currently using.
@@ -2469,7 +2469,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseFakeAllocation) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Try to allocate a lease and use a completely different address
     // as a hint.
@@ -2534,7 +2534,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseNoHint) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Try to allocate a lease with providing no hint.
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
@@ -2586,7 +2586,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseNoHintFakeAllocation) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Query the allocation engine for the lease to be allocated for the
     // client.
@@ -2648,7 +2648,7 @@ TEST_F(AllocEngine4Test, reservedAddressConflictResolution) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Client B sends a DHCPREQUEST to allocate a reserved lease. The
     // allocation engine can't allocate a reserved lease for this client
@@ -2754,7 +2754,7 @@ TEST_F(AllocEngine4Test, reservedAddressVsDynamicPool) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Different client tries to allocate a lease. Note, that we're using
     // an iterative allocator which would pick the first address from the
@@ -2786,7 +2786,7 @@ TEST_F(AllocEngine4Test, reservedAddressHintUsedByOtherClient) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Different client is requesting this address.
     AllocEngine::ClientContext4 ctx1(subnet_, ClientIdPtr(), hwaddr_,
@@ -2829,7 +2829,7 @@ TEST_F(AllocEngine4Test, reservedAddressHintUsedByOtherClient) {
 // address when the pool is exhausted, and the only available
 // address is reserved for a different client.
 TEST_F(AllocEngine4Test, reservedAddressShortPool) {
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Create short pool with only one address.
     initSubnet(IOAddress("192.0.2.100"), IOAddress("192.0.2.100"));
@@ -2883,7 +2883,7 @@ TEST_F(AllocEngine4Test, reservedAddressShortPool) {
 // dynamic pool if the client's reservation is made for a hostname but
 // not for an address.
 TEST_F(AllocEngine4Test, reservedHostname) {
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Create a reservation for a hostname. Address is set to 0 which
     // indicates that there is no reservation.
@@ -2918,7 +2918,7 @@ TEST_F(AllocEngine4Test, reservedHostname) {
 // the value of NULL in the host_ field of the client context.
 TEST_F(AllocEngine4Test, findReservation) {
     // Create the instance of the allocation engine.
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Context is required to call the AllocEngine::findReservation.
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
@@ -2997,7 +2997,7 @@ TEST_F(AllocEngine4Test, findReservation) {
 // statistic for allocated addresses is increased appropriately.
 TEST_F(AllocEngine4Test, simpleAlloc4Stats) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -3034,7 +3034,7 @@ TEST_F(AllocEngine4Test, simpleAlloc4Stats) {
 // and that it doesn't increase allocated-addresses statistic.
 TEST_F(AllocEngine4Test, fakeAlloc4Stat) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
@@ -3088,7 +3088,7 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseStat) {
                                false, false, ""));
     LeaseMgrFactory::instance().addLease(lease);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Let's pretend 100 addresses were allocated already
     string name = StatsMgr::generateName("subnet", subnet_->getID(),
@@ -3140,7 +3140,7 @@ TEST_F(AllocEngine4Test, globalReservationReservedAddressDiscover) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
 
@@ -3188,7 +3188,7 @@ TEST_F(AllocEngine4Test, globalReservationReservedAddressRequest) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
 
@@ -3240,7 +3240,7 @@ TEST_F(AllocEngine4Test, globalReservationDynamicDiscover) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
 
@@ -3289,7 +3289,7 @@ TEST_F(AllocEngine4Test, globalReservationDynamicRequest) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
 
@@ -3341,7 +3341,7 @@ TEST_F(AllocEngine4Test, mixedReservationReservedAddressDiscover) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
     subnet_->setReservationsInSubnet(true);
@@ -3391,7 +3391,7 @@ TEST_F(AllocEngine4Test, mixedReservationReservedAddressRequest) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
     subnet_->setReservationsInSubnet(true);
@@ -3448,7 +3448,7 @@ TEST_F(AllocEngine4Test, bothReservationReservedAddressDiscover) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
     subnet_->setReservationsInSubnet(true);
@@ -3502,7 +3502,7 @@ TEST_F(AllocEngine4Test, bothReservationReservedAddressRequest) {
     CfgMgr::instance().getStagingCfg()->getCfgHosts()->add(host);
     CfgMgr::instance().commit();
 
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     subnet_->setReservationsGlobal(true);
     subnet_->setReservationsInSubnet(true);
@@ -3648,7 +3648,7 @@ TEST_F(AllocEngine4Test, updateExtendedInfo4) {
     }};
 
     // Create the allocation engine, context and lease.
-    NakedAllocEngine engine(0, false);
+    NakedAllocEngine engine(0);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_,
                                     IOAddress::IPV4_ZERO_ADDRESS(),
@@ -3792,7 +3792,7 @@ TEST_F(AllocEngine4Test, storeExtendedInfoEnabled4) {
     }};
 
     // Create the allocation engine, context and lease.
-    NakedAllocEngine engine(0, false);
+    NakedAllocEngine engine(0);
 
     // All of the scenarios require storage to be enabled.
     subnet_->setStoreExtendedInfo(true);
@@ -3897,7 +3897,7 @@ TEST_F(AllocEngine4Test, storeExtendedInfoDisabled4) {
     }};
 
     // Create the allocation engine, context and lease.
-    NakedAllocEngine engine(0, false);
+    NakedAllocEngine engine(0);
 
     // All of the scenarios require storage to be disabled.
     subnet_->setStoreExtendedInfo(false);
@@ -3946,7 +3946,7 @@ TEST_F(AllocEngine4Test, storeExtendedInfoDisabled4) {
 // using cache threshold.
 TEST_F(AllocEngine4Test, discoverCacheThreshold4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -3991,7 +3991,7 @@ TEST_F(AllocEngine4Test, discoverCacheThreshold4) {
 // using cache threshold.
 TEST_F(AllocEngine4Test, requestCacheThreshold4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4047,7 +4047,7 @@ TEST_F(AllocEngine4Test, requestCacheThreshold4) {
 // using cache max age.
 TEST_F(AllocEngine4Test, discoverCacheMaxAge4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4092,7 +4092,7 @@ TEST_F(AllocEngine4Test, discoverCacheMaxAge4) {
 // using both cache threshold and max age.
 TEST_F(AllocEngine4Test, requestCacheBoth4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4148,7 +4148,7 @@ TEST_F(AllocEngine4Test, requestCacheBoth4) {
 // using too small cache threshold.
 TEST_F(AllocEngine4Test, discoverCacheBadThreshold4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4183,7 +4183,7 @@ TEST_F(AllocEngine4Test, discoverCacheBadThreshold4) {
 // using too small cache max age.
 TEST_F(AllocEngine4Test, requestCacheBadMaxAge4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4226,7 +4226,7 @@ TEST_F(AllocEngine4Test, requestCacheBadMaxAge4) {
 // when the valid lifetime was reduced.
 TEST_F(AllocEngine4Test, discoverCacheReducedValid4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 200.
@@ -4261,7 +4261,7 @@ TEST_F(AllocEngine4Test, discoverCacheReducedValid4) {
 // when DDNS parameter changed.
 TEST_F(AllocEngine4Test, requestCacheFwdDDNS4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4301,7 +4301,7 @@ TEST_F(AllocEngine4Test, requestCacheFwdDDNS4) {
 // when DDNS parameter changed.
 TEST_F(AllocEngine4Test, discoverCacheRevDDNS4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4339,7 +4339,7 @@ TEST_F(AllocEngine4Test, discoverCacheRevDDNS4) {
 // when hostname changed.
 TEST_F(AllocEngine4Test, requestCacheHostname4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     // Set valid lifetime to 500.
@@ -4380,7 +4380,7 @@ TEST_F(AllocEngine4Test, requestCacheHostname4) {
 // Verifies that AllocEngine::getValidLft(ctx4) returns the appropriate
 // lifetime value based on the context content.
 TEST_F(AllocEngine4Test, getValidLft4) {
-    AllocEngine engine(0, false);
+    AllocEngine engine(0);
 
     // Let's make three classes, two with valid-lifetime and one without,
     // and add them to the dictionary.
@@ -4514,7 +4514,7 @@ TEST_F(AllocEngine4Test, getValidLft4) {
 // Verifies that AllocEngine::getValidLft(ctx4) returns the appropriate
 // lifetime value based on the context content.
 TEST_F(AllocEngine4Test, getTemplateClassValidLft4) {
-    AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 0, false);
+    AllocEngine engine(0);
 
     // Let's make three classes, two with valid-lifetime and one without,
     // and add them to the dictionary.
@@ -4666,7 +4666,7 @@ TEST_F(AllocEngine4Test, getTemplateClassValidLft4) {
 // This test checks that deleteRelease handles BOOTP leases.
 TEST_F(AllocEngine4Test, bootpDelete) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -4732,7 +4732,7 @@ public:
 // This test checks that simple allocation handles BOOTP queries.
 TEST_F(MySqlAllocEngine4Test, bootpAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -4776,7 +4776,7 @@ TEST_F(MySqlAllocEngine4Test, bootpAlloc4) {
 // This test checks simple renewal handles BOOTP queries.
 TEST_F(MySqlAllocEngine4Test, bootpRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -4833,7 +4833,7 @@ TEST_F(MySqlAllocEngine4Test, bootpRenew4) {
 // This test checks that deleteRelease handles BOOTP leases.
 TEST_F(MySqlAllocEngine4Test, bootpDelete) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -4900,7 +4900,7 @@ public:
 // This test checks that simple allocation handles BOOTP queries.
 TEST_F(PgSqlAllocEngine4Test, bootpAlloc4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -4944,7 +4944,7 @@ TEST_F(PgSqlAllocEngine4Test, bootpAlloc4) {
 // This test checks simple renewal handles BOOTP queries.
 TEST_F(PgSqlAllocEngine4Test, bootpRenew4) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
@@ -5001,7 +5001,7 @@ TEST_F(PgSqlAllocEngine4Test, bootpRenew4) {
 // This test checks that deleteRelease handles BOOTP leases.
 TEST_F(PgSqlAllocEngine4Test, bootpDelete) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(0, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(0)));
     ASSERT_TRUE(engine);
 
     AllocEngine::ClientContext4 ctx(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
index b107200b0bd8571809738f564c96706ba9ba1da1..b552c37849180307316dfb4b497eac66f0843c91 100644 (file)
@@ -60,7 +60,7 @@ TEST(ClientContext6Test, addAllocatedResource) {
 TEST_F(AllocEngine6Test, constructor) {
     boost::scoped_ptr<AllocEngine> x;
 
-    ASSERT_NO_THROW(x.reset(new AllocEngine(100, true)));
+    ASSERT_NO_THROW(x.reset(new AllocEngine(100)));
 }
 
 // This test checks if two simple IPv6 allocations succeed and that the
@@ -1525,7 +1525,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolSolicitNoHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), true);
     ASSERT_TRUE(lease);
@@ -1547,7 +1547,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolRequestNoHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1585,7 +1585,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolSolicitValidHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1624,7 +1624,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolRequestValidHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1665,7 +1665,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolSolicitMatchingHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1704,7 +1704,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolRequestMatchingHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1745,7 +1745,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolSolicitNoHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1781,7 +1781,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolRequestNoHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1817,7 +1817,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolSolicitValidHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1856,7 +1856,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolRequestValidHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1895,7 +1895,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolSolicitMatchingHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1934,7 +1934,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolRequestMatchingHint) {
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
     createHost6(true, IPv6Resrv::TYPE_NA, IOAddress("2001:db8::abcd"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -1966,7 +1966,7 @@ TEST_F(AllocEngine6Test, reservedAddressOutOfPoolRequestMatchingHint) {
 //    Check that he is assigned a new lease for B
 // - verify that the number of assigned address behaves as expected
 TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedThis) {
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -2045,7 +2045,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedThis) {
 //    Check that his existing lease for lease A is removed
 //    Check that he is assigned a new lease
 TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedOther) {
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Assigned count should be zero.
     EXPECT_TRUE(testStatistics("assigned-nas", 0, subnet_->getID()));
@@ -2130,7 +2130,7 @@ TEST_F(AllocEngine6Test, reservedAddressInPoolReassignedOther) {
 // we run out of addresses and remaining 14 clients will get nothing.
 // Finally, we check that client A still can get his reserved address.
 TEST_F(AllocEngine6Test, reservedAddress) {
-    AllocEngine engine(100, true);
+    AllocEngine engine(100);
 
     // Create reservation for the client. This is in-pool reservation,
     // as the pool is 2001:db8:1::10 - 2001:db8:1::20.
@@ -2198,7 +2198,7 @@ TEST_F(AllocEngine6Test, reservedAddress) {
 
 // Checks if the allocateLeases throws exceptions for invalid input data.
 TEST_F(AllocEngine6Test, allocateLeasesInvalidData) {
-    AllocEngine engine(100, true);
+    AllocEngine engine(100);
 
     // That looks like a valid context.
     AllocEngine::ClientContext6 ctx(subnet_, duid_, false, false, "", false,
@@ -2543,7 +2543,7 @@ TEST_F(AllocEngine6Test, reservedAddressByMacInPoolSolicitNoHint) {
     createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
                       IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), true);
     ASSERT_TRUE(lease);
@@ -2566,7 +2566,7 @@ TEST_F(AllocEngine6Test, reservedAddressByMacInPoolRequestNoHint) {
     createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
                       IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("::"), false);
     ASSERT_TRUE(lease);
@@ -2589,7 +2589,7 @@ TEST_F(AllocEngine6Test, reservedAddressByMacInPoolSolicitValidHint) {
     createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
                       IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Let's pretend the client sends hint 2001:db8:1::10.
     Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), true);
@@ -2615,7 +2615,7 @@ TEST_F(AllocEngine6Test, reservedAddressByMacInPoolRequestValidHint) {
     createHost6HWAddr(true, IPv6Resrv::TYPE_NA, hwaddr_,
                       IOAddress("2001:db8:1::1c"), 128);
 
-    AllocEngine engine(100, false);
+    AllocEngine engine(100);
 
     // Let's pretend the client sends hint 2001:db8:1::10.
     Lease6Ptr lease = simpleAlloc6Test(pool_, IOAddress("2001:db8:1::10"), false);
@@ -2768,7 +2768,7 @@ TEST_F(AllocEngine6Test, solicitReuseDeclinedLease6) {
 // to REQUEST (actual allocation)
 TEST_F(AllocEngine6Test, requestReuseDeclinedLease6) {
 
-    AllocEnginePtr engine(new AllocEngine(100, true));
+    AllocEnginePtr engine(new AllocEngine(100));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -2801,7 +2801,7 @@ TEST_F(AllocEngine6Test, requestReuseDeclinedLease6) {
 TEST_F(AllocEngine6Test, solicitReuseDeclinedLease6Stats) {
 
     // Now prepare for SOLICIT processing
-    AllocEnginePtr engine(new AllocEngine(100, true));
+    AllocEnginePtr engine(new AllocEngine(100));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -2846,7 +2846,7 @@ TEST_F(AllocEngine6Test, solicitReuseDeclinedLease6Stats) {
 TEST_F(AllocEngine6Test, requestReuseDeclinedLease6Stats) {
 
     // Prepare for REQUEST processing.
-    AllocEnginePtr engine(new AllocEngine(100, true));
+    AllocEnginePtr engine(new AllocEngine(100));
     ASSERT_TRUE(engine);
 
     // Now prepare a configuration with single address pool.
@@ -4033,7 +4033,7 @@ class AllocEngine6ExtendedInfoTest : public AllocEngine6Test {
 public:
     /// @brief Constructor
     AllocEngine6ExtendedInfoTest()
-        : engine_(100, true),
+        : engine_(100),
           duid1_(), duid2_(), duid3_(), relay1_(), relay2_(), relay3_(),
           duid1_addr_("::"), duid2_addr_("::") {
         duid1_.reset(new DUID(std::vector<uint8_t>(8, 0x84)));
@@ -4076,7 +4076,7 @@ public:
         duid2_addr_ = IOAddress("2001:db8:1::11");
 
         // Create the allocation engine, context and lease.
-        NakedAllocEngine engine(100, true);
+        NakedAllocEngine engine(100);
     }
 
     /// Configuration elements. These are initialized in the constructor
@@ -5539,7 +5539,7 @@ TEST_F(AllocEngine6Test, getValidLifetime) {
 // valid lifetime value based on the context content.
 TEST_F(AllocEngine6Test, getTemplateClassValidLifetime) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     // Let's make three classes, two with valid-lifetime and one without,
@@ -5807,7 +5807,7 @@ TEST_F(AllocEngine6Test, getPreferredLifetime) {
 // preferred lifetime value based on the context content.
 TEST_F(AllocEngine6Test, getTemplateClassPreferredLifetime) {
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     // Let's make three classes, two with preferred-lifetime and one without,
index dc67c30434222c6710652f15f38d36f335868b39..138d7e138f251f46376240f268106234a190cc62 100644 (file)
@@ -188,7 +188,7 @@ public:
         LeaseMgrFactory::create(lease_mgr_params);
 
         // Create allocation engine instance.
-        engine_.reset(new AllocEngine(100, true));
+        engine_.reset(new AllocEngine(100));
     }
 
     /// @brief Destructor
index 168b14a80eb4a1fce584dd63c09e6d99364dbfa3..11e5c0a3d1d4183a5ffb119110f5c53690249823 100644 (file)
@@ -498,7 +498,7 @@ TEST_F(HookAllocEngine4Test, lease4_select) {
 
     // Create allocation engine (hook names are registered in its ctor)
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     // Initialize Hooks Manager
@@ -572,7 +572,7 @@ TEST_F(HookAllocEngine4Test, change_lease4_select) {
 
     // Create allocation engine (hook names are registered in its ctor)
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     // Initialize Hooks Manager
@@ -621,7 +621,7 @@ TEST_F(HookAllocEngine4Test, skip_lease4_select) {
 
     // Create allocation engine (hook names are registered in its ctor)
     boost::scoped_ptr<AllocEngine> engine;
-    ASSERT_NO_THROW(engine.reset(new AllocEngine(100, false)));
+    ASSERT_NO_THROW(engine.reset(new AllocEngine(100)));
     ASSERT_TRUE(engine);
 
     // Initialize Hooks Manager
index 6519630451220952f6ffb63c8ca286ad888c5946..69c5167b1a1789e55b9625005c9d76d486d4a4c3 100644 (file)
@@ -76,9 +76,8 @@ class NakedAllocEngine : public AllocEngine {
 public:
     /// @brief the sole constructor
     /// @param attempts number of lease selection attempts before giving up
-    /// @param ipv6 specifies if the engine is IPv6 or IPv4
-    NakedAllocEngine(unsigned int attempts, bool ipv6 = true)
-        : AllocEngine(attempts, ipv6) {
+    NakedAllocEngine(unsigned int attempts)
+        : AllocEngine(attempts) {
     }
 
     // Expose internal classes for testing purposes
index 1cacdddd0d17c9e5cc19ecd0b097d1fd966f5b66..6de62eddb0409fcdda4517b4773099bdeee1b084 100644 (file)
@@ -57,7 +57,7 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated4MultiThreading) {
 
 // Checks if last allocated address/prefix is stored/retrieved properly.
 TEST(IterativeAllocationStateTest, subnetLastAllocated6) {
-    IOAddress ia("2001:db8:1::1");
+    IOAddress na("2001:db8:1::1");
     IOAddress ta("2001:db8:1::abcd");
     IOAddress pd("2001:db8:1::1234:5678");
 
@@ -72,8 +72,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6) {
     EXPECT_EQ(last.toText(), state->getLastAllocated(Lease::TYPE_PD).toText());
 
     // Now set last allocated for IA
-    EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_NA, ia));
-    EXPECT_EQ(ia.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
+    EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_NA, na));
+    EXPECT_EQ(na.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
 
     // TA and PD should be unchanged
     EXPECT_EQ(last.toText(), state->getLastAllocated(Lease::TYPE_TA).toText());
@@ -83,7 +83,7 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6) {
     EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_TA, ta));
     EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_PD, pd));
 
-    EXPECT_EQ(ia.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
+    EXPECT_EQ(na.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
     EXPECT_EQ(ta.toText(), state->getLastAllocated(Lease::TYPE_TA).toText());
     EXPECT_EQ(pd.toText(), state->getLastAllocated(Lease::TYPE_PD).toText());
 }
@@ -92,7 +92,7 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6) {
 // multi threading is turned on.
 TEST(IterativeAllocationStateTest, subnetLastAllocated6MultiThreading) {
     MultiThreadingTest mt(true);
-    IOAddress ia("2001:db8:1::1");
+    IOAddress na("2001:db8:1::1");
     IOAddress ta("2001:db8:1::abcd");
     IOAddress pd("2001:db8:1::1234:5678");
 
@@ -107,8 +107,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6MultiThreading) {
     EXPECT_EQ(last.toText(), state->getLastAllocated(Lease::TYPE_PD).toText());
 
     // Now set last allocated for IA
-    EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_NA, ia));
-    EXPECT_EQ(ia.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
+    EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_NA, na));
+    EXPECT_EQ(na.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
 
     // TA and PD should be unchanged
     EXPECT_EQ(last.toText(), state->getLastAllocated(Lease::TYPE_TA).toText());
@@ -118,7 +118,7 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6MultiThreading) {
     EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_TA, ta));
     EXPECT_NO_THROW(state->setLastAllocated(Lease::TYPE_PD, pd));
 
-    EXPECT_EQ(ia.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
+    EXPECT_EQ(na.toText(), state->getLastAllocated(Lease::TYPE_NA).toText());
     EXPECT_EQ(ta.toText(), state->getLastAllocated(Lease::TYPE_TA).toText());
     EXPECT_EQ(pd.toText(), state->getLastAllocated(Lease::TYPE_PD).toText());
 }
@@ -147,7 +147,7 @@ TEST(IterativeAllocationStateTest, poolLastAllocated4) {
     EXPECT_FALSE(state->isLastAllocatedValid());
 }
 
-// Checks that last allocated IOv6 lease is stored in the pool-specific
+// Checks that last allocated IPv6 lease is stored in the pool-specific
 // allocation state.
 TEST(IterativeAllocationStateTest, poolLastAllocated6) {
     // Create a pool.