BIND 10 trac3083, updated. 9fab3d3a0124810b18c32b181b90da2737cae477 [3083] Unit test setting FQDN lease parameters.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Aug 21 12:24:00 UTC 2013


The branch, trac3083 has been updated
       via  9fab3d3a0124810b18c32b181b90da2737cae477 (commit)
       via  18dc9853c008b26940ea70167daec3a26b382a79 (commit)
      from  231fed6c34f32ce87f15be0f79bcc258f900a783 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9fab3d3a0124810b18c32b181b90da2737cae477
Author: Marcin Siodelski <marcin at isc.org>
Date:   Wed Aug 21 14:23:42 2013 +0200

    [3083] Unit test setting FQDN lease parameters.

commit 18dc9853c008b26940ea70167daec3a26b382a79
Author: Marcin Siodelski <marcin at isc.org>
Date:   Wed Aug 21 13:54:28 2013 +0200

    [3083] Extended Allocation Engine API to pass the FQDN data.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp4/dhcp4_srv.cc                     |    8 ++-
 src/lib/dhcpsrv/alloc_engine.cc                |   52 +++++++++++++----
 src/lib/dhcpsrv/alloc_engine.h                 |   72 +++++++++++++++++-------
 src/lib/dhcpsrv/tests/alloc_engine_unittest.cc |   64 +++++++++++++--------
 src/lib/dhcpsrv/tests/test_utils.cc            |    6 ++
 5 files changed, 147 insertions(+), 55 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
index c760478..f0463f2 100644
--- a/src/bin/dhcp4/dhcp4_srv.cc
+++ b/src/bin/dhcp4/dhcp4_srv.cc
@@ -614,9 +614,13 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
     // will try to honour the hint, but it is just a hint - some other address
     // may be used instead. If fake_allocation is set to false, the lease will
     // be inserted into the LeaseMgr as well.
+    // @todo pass the actual FQDN data.
+    Lease4Ptr old_lease;
     Lease4Ptr lease = alloc_engine_->allocateAddress4(subnet, client_id, hwaddr,
-                                                      hint, fake_allocation,
-                                                      callout_handle);
+                                                      hint, false, false, "",
+                                                      fake_allocation,
+                                                      callout_handle,
+                                                      old_lease);
 
     if (lease) {
         // We have a lease! Let's set it in the packet and send it back to
diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc
index ac5e616..d840e95 100644
--- a/src/lib/dhcpsrv/alloc_engine.cc
+++ b/src/lib/dhcpsrv/alloc_engine.cc
@@ -328,6 +328,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
                               const ClientIdPtr& clientid,
                               const HWAddrPtr& hwaddr,
                               const IOAddress& hint,
+                              const bool fwd_dns_update,
+                              const bool rev_dns_update,
+                              const std::string& hostname,
                               bool fake_allocation,
                               const isc::hooks::CalloutHandlePtr& callout_handle,
                               Lease4Ptr& old_lease) {
@@ -359,7 +362,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
             old_lease.reset(new Lease4(*existing));
             // We have a lease already. This is a returning client, probably after
             // its reboot.
-            existing = renewLease4(subnet, clientid, hwaddr, existing, fake_allocation);
+            existing = renewLease4(subnet, clientid, hwaddr,
+                                   fwd_dns_update, rev_dns_update, hostname,
+                                   existing, fake_allocation);
             if (existing) {
                 return (existing);
             }
@@ -375,7 +380,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
                 old_lease.reset(new Lease4(*existing));
                 // we have a lease already. This is a returning client, probably after
                 // its reboot.
-                existing = renewLease4(subnet, clientid, hwaddr, existing, fake_allocation);
+                existing = renewLease4(subnet, clientid, hwaddr,
+                                       fwd_dns_update, rev_dns_update,
+                                       hostname, existing, fake_allocation);
                 // @todo: produce a warning. We haven't found him using MAC address, but
                 // we found him using client-id
                 if (existing) {
@@ -393,7 +400,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
 
                 // The hint is valid and not currently used, let's create a lease for it
                 Lease4Ptr lease = createLease4(subnet, clientid, hwaddr, hint,
-                                               callout_handle, fake_allocation);
+                                               fwd_dns_update, rev_dns_update,
+                                               hostname, callout_handle,
+                                               fake_allocation);
 
                 // It can happen that the lease allocation failed (we could have lost
                 // the race condition. That means that the hint is lo longer usable and
@@ -406,7 +415,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
                     // Save the old lease, before reusing it.
                     old_lease.reset(new Lease4(*existing));
                     return (reuseExpiredLease(existing, subnet, clientid, hwaddr,
-                                              callout_handle, fake_allocation));
+                                              fwd_dns_update, rev_dns_update,
+                                              hostname, callout_handle,
+                                              fake_allocation));
                 }
 
             }
@@ -439,7 +450,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
             if (!existing) {
                 // there's no existing lease for selected candidate, so it is
                 // free. Let's allocate it.
-                Lease4Ptr lease = createLease4(subnet, clientid, hwaddr, candidate,
+                Lease4Ptr lease = createLease4(subnet, clientid, hwaddr,
+                                               candidate, fwd_dns_update,
+                                               rev_dns_update, hostname,
                                                callout_handle, fake_allocation);
                 if (lease) {
                     return (lease);
@@ -453,7 +466,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
                     // Save old lease before reusing it.
                     old_lease.reset(new Lease4(*existing));
                     return (reuseExpiredLease(existing, subnet, clientid, hwaddr,
-                                              callout_handle, fake_allocation));
+                                              fwd_dns_update, rev_dns_update,
+                                              hostname, callout_handle,
+                                              fake_allocation));
                 }
             }
 
@@ -476,6 +491,9 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
 Lease4Ptr AllocEngine::renewLease4(const SubnetPtr& subnet,
                                    const ClientIdPtr& clientid,
                                    const HWAddrPtr& hwaddr,
+                                   const bool fwd_dns_update,
+                                   const bool rev_dns_update,
+                                   const std::string& hostname,
                                    const Lease4Ptr& lease,
                                    bool fake_allocation /* = false */) {
 
@@ -486,6 +504,9 @@ Lease4Ptr AllocEngine::renewLease4(const SubnetPtr& subnet,
     lease->t1_ = subnet->getT1();
     lease->t2_ = subnet->getT2();
     lease->valid_lft_ = subnet->getValid();
+    lease->fqdn_fwd_ = fwd_dns_update;
+    lease->fqdn_rev_ = rev_dns_update;
+    lease->hostname_ = hostname;
 
     if (!fake_allocation) {
         // for REQUEST we do update the lease
@@ -576,6 +597,9 @@ Lease4Ptr AllocEngine::reuseExpiredLease(Lease4Ptr& expired,
                                          const SubnetPtr& subnet,
                                          const ClientIdPtr& clientid,
                                          const HWAddrPtr& hwaddr,
+                                         const bool fwd_dns_update,
+                                         const bool rev_dns_update,
+                                         const std::string& hostname,
                                          const isc::hooks::CalloutHandlePtr& callout_handle,
                                          bool fake_allocation /*= false */ ) {
 
@@ -592,9 +616,9 @@ Lease4Ptr AllocEngine::reuseExpiredLease(Lease4Ptr& expired,
     expired->cltt_ = time(NULL);
     expired->subnet_id_ = subnet->getID();
     expired->fixed_ = false;
-    expired->hostname_ = std::string("");
-    expired->fqdn_fwd_ = false;
-    expired->fqdn_rev_ = false;
+    expired->hostname_ = hostname;
+    expired->fqdn_fwd_ = fwd_dns_update;
+    expired->fqdn_rev_ = rev_dns_update;
 
     /// @todo: log here that the lease was reused (there's ticket #2524 for
     /// logging in libdhcpsrv)
@@ -732,6 +756,9 @@ Lease4Ptr AllocEngine::createLease4(const SubnetPtr& subnet,
                                     const DuidPtr& clientid,
                                     const HWAddrPtr& hwaddr,
                                     const IOAddress& addr,
+                                    const bool fwd_dns_update,
+                                    const bool rev_dns_update,
+                                    const std::string& hostname,
                                     const isc::hooks::CalloutHandlePtr& callout_handle,
                                     bool fake_allocation /*= false */ ) {
     if (!hwaddr) {
@@ -750,6 +777,11 @@ Lease4Ptr AllocEngine::createLease4(const SubnetPtr& subnet,
                                subnet->getT1(), subnet->getT2(), now,
                                subnet->getID()));
 
+    // Set FQDN specific lease parameters.
+    lease->fqdn_fwd_ = fwd_dns_update;
+    lease->fqdn_rev_ = rev_dns_update;
+    lease->hostname_ = hostname;
+
     // Let's execute all callouts registered for lease4_select
     if (callout_handle &&
         HooksManager::getHooksManager().calloutsPresent(hook_index_lease4_select_)) {
@@ -788,8 +820,6 @@ Lease4Ptr AllocEngine::createLease4(const SubnetPtr& subnet,
         callout_handle->getArgument("lease4", lease);
     }
 
-
-
     if (!fake_allocation) {
         // That is a real (REQUEST) allocation
         bool status = LeaseMgrFactory::instance().addLease(lease);
diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h
index fd966dc..7cddadf 100644
--- a/src/lib/dhcpsrv/alloc_engine.h
+++ b/src/lib/dhcpsrv/alloc_engine.h
@@ -212,11 +212,16 @@ protected:
     ///
     /// @param subnet subnet the allocation should come from
     /// @param clientid Client identifier
-    /// @param hwaddr client's hardware address info
-    /// @param hint a hint that the client provided
-    /// @param fake_allocation is this real i.e. REQUEST (false) or just picking
+    /// @param hwaddr Client's hardware address info
+    /// @param hint A hint that the client provided
+    /// @param fwd_dns_update Indicates whether forward DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param rev_dns_update Indicates whether reverse DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param hostname A string carrying hostname to be used for DNS updates.
+    /// @param fake_allocation Is this real i.e. REQUEST (false) or just picking
     ///        an address for DISCOVER that is not really allocated (true)
-    /// @param callout_handle a callout handle (used in hooks). A lease callouts
+    /// @param callout_handle A callout handle (used in hooks). A lease callouts
     ///        will be executed if this parameter is passed.
     /// @param [out] old_lease Holds the pointer to a previous instance of a
     /// lease. The NULL pointer indicates that lease didn't exist prior
@@ -228,6 +233,9 @@ protected:
                      const ClientIdPtr& clientid,
                      const HWAddrPtr& hwaddr,
                      const isc::asiolink::IOAddress& hint,
+                     const bool fwd_dns_update,
+                     const bool rev_dns_update,
+                     const std::string& hostname,
                      bool fake_allocation,
                      const isc::hooks::CalloutHandlePtr& callout_handle,
                      Lease4Ptr& old_lease);
@@ -241,16 +249,24 @@ protected:
     /// to get a new lease. It thinks that it gets a new lease, but in fact
     /// we are only renewing the still valid lease for that client.
     ///
-    /// @param subnet subnet the client is attached to
-    /// @param clientid client identifier
-    /// @param hwaddr client's hardware address
-    /// @param lease lease to be renewed
-    /// @param fake_allocation is this real i.e. REQUEST (false) or just picking
+    /// @param subnet A subnet the client is attached to
+    /// @param clientid Client identifier
+    /// @param hwaddr Client's hardware address
+    /// @param fwd_dns_update Indicates whether forward DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param rev_dns_update Indicates whether reverse DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param hostname A string carrying hostname to be used for DNS updates.
+    /// @param lease A lease to be renewed
+    /// @param fake_allocation Is this real i.e. REQUEST (false) or just picking
     ///        an address for DISCOVER that is not really allocated (true)
     Lease4Ptr
     renewLease4(const SubnetPtr& subnet,
                 const ClientIdPtr& clientid,
                 const HWAddrPtr& hwaddr,
+                const bool fwd_dns_update,
+                const bool rev_dns_update,
+                const std::string& hostname,
                 const Lease4Ptr& lease,
                 bool fake_allocation /* = false */);
 
@@ -296,20 +312,28 @@ private:
     /// into the database. That may fail in some cases, e.g. when there is another
     /// allocation process and we lost a race to a specific lease.
     ///
-    /// @param subnet subnet the lease is allocated from
-    /// @param clientid client identifier
-    /// @param hwaddr client's hardware address
-    /// @param addr an address that was selected and is confirmed to be available
+    /// @param subnet Subnet the lease is allocated from
+    /// @param clientid Client identifier
+    /// @param hwaddr Client's hardware address
+    /// @param addr An address that was selected and is confirmed to be available
+    /// @param fwd_dns_update Indicates whether forward DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param rev_dns_update Indicates whether reverse DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param hostname A string carrying hostname to be used for DNS updates.
     /// @param callout_handle a callout handle (used in hooks). A lease callouts
     ///        will be executed if this parameter is passed (and there are callouts
     ///        registered)
-    /// @param fake_allocation is this real i.e. REQUEST (false) or just picking
+    /// @param fake_allocation Is this real i.e. REQUEST (false) or just picking
     ///        an address for DISCOVER that is not really allocated (true)
     /// @return allocated lease (or NULL in the unlikely case of the lease just
     ///        becomed unavailable)
     Lease4Ptr createLease4(const SubnetPtr& subnet, const DuidPtr& clientid,
                            const HWAddrPtr& hwaddr,
                            const isc::asiolink::IOAddress& addr,
+                           const bool fwd_dns_update,
+                           const bool rev_dns_update,
+                           const std::string& hostname,
                            const isc::hooks::CalloutHandlePtr& callout_handle,
                            bool fake_allocation = false);
 
@@ -349,13 +373,18 @@ private:
     /// is updated if this is real (i.e. REQUEST, fake_allocation = false), not
     /// dummy allocation request (i.e. DISCOVER, fake_allocation = true).
     ///
-    /// @param expired old, expired lease
-    /// @param subnet subnet the lease is allocated from
-    /// @param clientid client identifier
-    /// @param hwaddr client's hardware address
-    /// @param callout_handle a callout handle (used in hooks). A lease callouts
+    /// @param expired Old, expired lease
+    /// @param subnet Subnet the lease is allocated from
+    /// @param clientid Client identifier
+    /// @param hwaddr Client's hardware address
+    /// @param fwd_dns_update Indicates whether forward DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param rev_dns_update Indicates whether reverse DNS update will be
+    /// performed for the client (true) or not (false).
+    /// @param hostname A string carrying hostname to be used for DNS updates.
+    /// @param callout_handle A callout handle (used in hooks). A lease callouts
     ///        will be executed if this parameter is passed.
-    /// @param fake_allocation is this real i.e. REQUEST (false) or just picking
+    /// @param fake_allocation Is this real i.e. REQUEST (false) or just picking
     ///        an address for DISCOVER that is not really allocated (true)
     /// @return refreshed lease
     /// @throw BadValue if trying to recycle lease that is still valid
@@ -363,6 +392,9 @@ private:
                                 const SubnetPtr& subnet,
                                 const ClientIdPtr& clientid,
                                 const HWAddrPtr& hwaddr,
+                                const bool fwd_dns_update,
+                                const bool rev_dns_update,
+                                const std::string& hostname,
                                 const isc::hooks::CalloutHandlePtr& callout_handle,
                                 bool fake_allocation = false);
 
diff --git a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
index 622e564..7ea1ccb 100644
--- a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
+++ b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
@@ -164,8 +164,6 @@ public:
         EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
         EXPECT_EQ(subnet_->getT1(), lease->t1_);
         EXPECT_EQ(subnet_->getT2(), lease->t2_);
-        EXPECT_TRUE(false == lease->fqdn_fwd_);
-        EXPECT_TRUE(false == lease->fqdn_rev_);
         if (lease->client_id_ && !clientid_) {
             ADD_FAILURE() << "Lease4 has a client-id, while it should have none.";
         } else
@@ -613,8 +611,10 @@ TEST_F(AllocEngine4Test, simpleAlloc4) {
     ASSERT_TRUE(engine);
 
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
-                                               IOAddress("0.0.0.0"), false,
-                                               CalloutHandlePtr(),
+                                               IOAddress("0.0.0.0"),
+                                               false, true,
+                                               "somehost.example.com.",
+                                               false, CalloutHandlePtr(),
                                                old_lease_);
     // The new lease has been allocated, so the old lease should not exist.
     EXPECT_FALSE(old_lease_);
@@ -640,8 +640,9 @@ TEST_F(AllocEngine4Test, fakeAlloc4) {
     ASSERT_TRUE(engine);
 
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
-                                               IOAddress("0.0.0.0"), true,
-                                               CalloutHandlePtr(),
+                                               IOAddress("0.0.0.0"),
+                                               false, true, "host.example.com.",
+                                               true, CalloutHandlePtr(),
                                                old_lease_);
 
     // The new lease has been allocated, so the old lease should not exist.
@@ -668,6 +669,7 @@ TEST_F(AllocEngine4Test, allocWithValidHint4) {
 
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
                                                IOAddress("192.0.2.105"),
+                                               true, true, "host.example.com.",
                                                false, CalloutHandlePtr(),
                                                old_lease_);
     // Check that we got a lease
@@ -711,6 +713,7 @@ TEST_F(AllocEngine4Test, allocWithUsedHint4) {
     // twice.
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
                                                IOAddress("192.0.2.106"),
+                                               false, false, "",
                                                false, CalloutHandlePtr(),
                                                old_lease_);
 
@@ -750,6 +753,7 @@ TEST_F(AllocEngine4Test, allocBogusHint4) {
     // with the normal allocation
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
                                                IOAddress("10.1.1.1"),
+                                               false, false, "",
                                                false, CalloutHandlePtr(),
                                                old_lease_);
     // Check that we got a lease
@@ -781,14 +785,17 @@ TEST_F(AllocEngine4Test, allocateAddress4Nulls) {
 
     // Allocations without subnet are not allowed
     Lease4Ptr lease = engine->allocateAddress4(SubnetPtr(), clientid_, hwaddr_,
-                                               IOAddress("0.0.0.0"), false,
-                                               CalloutHandlePtr(), old_lease_);
+                                               IOAddress("0.0.0.0"),
+                                               false, false, "",
+                                               false, CalloutHandlePtr(),
+                                               old_lease_);
     EXPECT_FALSE(lease);
 
     // Allocations without HW address are not allowed
     lease = engine->allocateAddress4(subnet_, clientid_, HWAddrPtr(),
-                                     IOAddress("0.0.0.0"), false,
-                                     CalloutHandlePtr(),
+                                     IOAddress("0.0.0.0"),
+                                     false, false, "",
+                                     false, CalloutHandlePtr(),
                                      old_lease_);
     EXPECT_FALSE(lease);
     EXPECT_FALSE(old_lease_);
@@ -796,8 +803,9 @@ TEST_F(AllocEngine4Test, allocateAddress4Nulls) {
     // Allocations without client-id are allowed
     clientid_ = ClientIdPtr();
     lease = engine->allocateAddress4(subnet_, ClientIdPtr(), hwaddr_,
-                                     IOAddress("0.0.0.0"), false,
-                                     CalloutHandlePtr(),
+                                     IOAddress("0.0.0.0"),
+                                     true, true, "myhost.example.com.",
+                                     false, CalloutHandlePtr(),
                                      old_lease_);
     // Check that we got a lease
     ASSERT_TRUE(lease);
@@ -903,7 +911,9 @@ TEST_F(AllocEngine4Test, smallPool4) {
     subnet_->addPool(pool_);
     cfg_mgr.addSubnet4(subnet_);
 
-    Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
+    Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
+                                               IOAddress("0.0.0.0"),
+                                               true, true, "host.example.com.",
                                                false, CalloutHandlePtr(),
                                                old_lease_);
 
@@ -947,8 +957,9 @@ TEST_F(AllocEngine4Test, outOfAddresses4) {
     uint8_t hwaddr2[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
     uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
     time_t now = time(NULL);
-    Lease4Ptr lease(new Lease4(addr, hwaddr2, sizeof(hwaddr2), clientid2, sizeof(clientid2),
-                               501, 502, 503, now, subnet_->getID()));
+    Lease4Ptr lease(new Lease4(addr, hwaddr2, sizeof(hwaddr2), clientid2,
+                               sizeof(clientid2), 501, 502, 503, now,
+                               subnet_->getID()));
     lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
     ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
 
@@ -956,8 +967,9 @@ TEST_F(AllocEngine4Test, outOfAddresses4) {
     // else, so the allocation should fail
 
     Lease4Ptr lease2 = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
-                                                IOAddress("0.0.0.0"), false,
-                                                CalloutHandlePtr(),
+                                                IOAddress("0.0.0.0"),
+                                                false, false, "",
+                                                false, CalloutHandlePtr(),
                                                 old_lease_);
     EXPECT_FALSE(lease2);
     EXPECT_FALSE(old_lease_);
@@ -998,6 +1010,7 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
     // CASE 1: Asking for any address
     lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
                                      IOAddress("0.0.0.0"),
+                                     false, false, "",
                                      true, CalloutHandlePtr(),
                                      old_lease_);
     // Check that we got that single lease
@@ -1014,7 +1027,9 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
     checkLease4(lease);
 
     // CASE 2: Asking specifically for this address
-    lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_, IOAddress(addr.toText()),
+    lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
+                                     IOAddress(addr.toText()),
+                                     false, false, "",
                                      true, CalloutHandlePtr(),
                                      old_lease_);
     // Check that we got that single lease
@@ -1053,8 +1068,9 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
 
     // A client comes along, asking specifically for this address
     lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
-                                     IOAddress(addr.toText()), false,
-                                     CalloutHandlePtr(),
+                                     IOAddress(addr.toText()),
+                                     false, true, "host.example.com.",
+                                     false, CalloutHandlePtr(),
                                      old_lease_);
 
     // Check that he got that single lease
@@ -1100,7 +1116,8 @@ TEST_F(AllocEngine4Test, renewLease4) {
     // Lease was assigned 45 seconds ago and is valid for 100 seconds. Let's
     // renew it.
     ASSERT_FALSE(lease->expired());
-    lease = engine->renewLease4(subnet_, clientid_, hwaddr_, lease, false);
+    lease = engine->renewLease4(subnet_, clientid_, hwaddr_, true,
+                                true, "host.example.com.", lease, false);
     // Check that he got that single lease
     ASSERT_TRUE(lease);
     EXPECT_EQ(addr.toText(), lease->addr_.toText());
@@ -1462,6 +1479,7 @@ TEST_F(HookAllocEngine4Test, lease4_select) {
 
     Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
                                                IOAddress("0.0.0.0"),
+                                               false, false, "",
                                                false, callout_handle,
                                                old_lease_);
     // Check that we got a lease
@@ -1525,7 +1543,9 @@ TEST_F(HookAllocEngine4Test, change_lease4_select) {
     CalloutHandlePtr callout_handle = HooksManager::createCalloutHandle();
 
     // Call allocateAddress4. Callouts should be triggered here.
-    Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_, IOAddress("0.0.0.0"),
+    Lease4Ptr lease = engine->allocateAddress4(subnet_, clientid_, hwaddr_,
+                                               IOAddress("0.0.0.0"),
+                                               false, false, "",
                                                false, callout_handle,
                                                old_lease_);
     // Check that we got a lease
diff --git a/src/lib/dhcpsrv/tests/test_utils.cc b/src/lib/dhcpsrv/tests/test_utils.cc
index ea62225..d8794fb 100644
--- a/src/lib/dhcpsrv/tests/test_utils.cc
+++ b/src/lib/dhcpsrv/tests/test_utils.cc
@@ -47,6 +47,9 @@ detailCompareLease(const Lease4Ptr& first, const Lease4Ptr& second) {
     EXPECT_EQ(first->valid_lft_, second->valid_lft_);
     EXPECT_EQ(first->cltt_, second->cltt_);
     EXPECT_EQ(first->subnet_id_, second->subnet_id_);
+    EXPECT_EQ(first->fqdn_fwd_, second->fqdn_fwd_);
+    EXPECT_EQ(first->fqdn_rev_, second->fqdn_rev_);
+    EXPECT_EQ(first->hostname_, second->hostname_);
 }
 
 void
@@ -67,6 +70,9 @@ detailCompareLease(const Lease6Ptr& first, const Lease6Ptr& second) {
     EXPECT_EQ(first->valid_lft_, second->valid_lft_);
     EXPECT_EQ(first->cltt_, second->cltt_);
     EXPECT_EQ(first->subnet_id_, second->subnet_id_);
+    EXPECT_EQ(first->fqdn_fwd_, second->fqdn_fwd_);
+    EXPECT_EQ(first->fqdn_rev_, second->fqdn_rev_);
+    EXPECT_EQ(first->hostname_, second->hostname_);
 }
 
 };



More information about the bind10-changes mailing list