]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3587'
authorMarcin Siodelski <marcin@isc.org>
Wed, 29 Oct 2014 16:45:58 +0000 (17:45 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 29 Oct 2014 16:45:58 +0000 (17:45 +0100)
1  2 
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/direct_client_unittest.cc
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc

Simple merge
index ee439905a9d52767150cf9030ef65af9c48df661,e9f12e18f7262302f584bc00317fc296e4b5280a..7e8ff4d6922a5bdd5126ad73be33bf347d4ecc9f
@@@ -361,13 -363,12 +364,13 @@@ TEST_F(DirectClientTest, rebind) 
      ASSERT_NO_FATAL_FAILURE(configureSubnet("10.0.0.0"));
      // Make sure that the subnet has been really added. Also, the subnet
      // will be needed to create a lease for a client.
-     Subnet4Ptr subnet = CfgMgr::instance().getSubnet4(IOAddress("10.0.0.10"),
-                                                       classify_);
+     Subnet4Ptr subnet = CfgMgr::instance().getCurrentCfg()->
+         getCfgSubnets4()->selectSubnet(IOAddress("10.0.0.10"));
      // Create a lease, which will be later renewed. By explicitly creating a
      // lease we will know the lease parameters, such as leased address etc.
 -    const uint8_t hwaddr[] = { 1, 2, 3, 4, 5, 6 };
 -    Lease4Ptr lease(new Lease4(IOAddress("10.0.0.10"), hwaddr, sizeof(hwaddr),
 +    const uint8_t hwaddr_data[] = { 1, 2, 3, 4, 5, 6 };
 +    HWAddrPtr hwaddr(new HWAddr(hwaddr_data, sizeof(hwaddr_data), HTYPE_ETHER));
 +    Lease4Ptr lease(new Lease4(IOAddress("10.0.0.10"), hwaddr,
                                 &generateClientId()->getData()[0],
                                 generateClientId()->getData().size(),
                                 100, 50, 75, time(NULL),
Simple merge
index e808f64c57a5a4ca54a672c4f880c1ea047d1178,56a0c15aabaf6b0faae05f8d5f3335cd64f5d74e..5f416638976387983d1b48bec30ac74f05e44d02
@@@ -1375,14 -1372,13 +1379,14 @@@ TEST_F(AllocEngine4Test, outOfAddresses
      subnet_ = Subnet4Ptr(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3));
      pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
      subnet_->addPool(pool_);
-     cfg_mgr.addSubnet4(subnet_);
+     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
  
      // Just a different hw/client-id for the second client
 -    uint8_t hwaddr2[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
 +    uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
 +    HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
      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,
 +    Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2,
                                 sizeof(clientid2), 501, 502, 503, now,
                                 subnet_->getID()));
      lease->cltt_ = time(NULL) - 10; // Allocated 10 seconds ago
@@@ -1415,14 -1412,14 +1420,14 @@@ TEST_F(AllocEngine4Test, discoverReuseE
      subnet_ = Subnet4Ptr(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3));
      pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
      subnet_->addPool(pool_);
-     cfg_mgr.addSubnet4(subnet_);
+     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
  
      // Just a different hw/client-id for the second client
 -    uint8_t hwaddr2[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
 +    uint8_t hwaddr2_data[] = { 0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe};
 +    HWAddrPtr hwaddr2(new HWAddr(hwaddr2_data, sizeof(hwaddr2_data), HTYPE_ETHER));
      uint8_t clientid2[] = { 8, 7, 6, 5, 4, 3, 2, 1 };
      time_t now = time(NULL) - 500; // Allocated 500 seconds ago
 -    Lease4Ptr lease(new Lease4(addr, clientid2, sizeof(clientid2),
 -                               hwaddr2, sizeof(hwaddr2),
 +    Lease4Ptr lease(new Lease4(addr, hwaddr2, clientid2, sizeof(clientid2),
                                 495, 100, 200, now, subnet_->getID()));
      // Copy the lease, so as it can be compared with the old lease returned
      // by the allocation engine.