configure(REBIND_CONFIGS[1], *client.getServer());
// Try to rebind, using the address that the client had acquired using
// previous server configuration.
+
ASSERT_NO_THROW(client.doRebind());
+
// We are expecting that the server didn't extend the lease because
// the address that client is using doesn't match the new subnet.
// But, the client still has an old lease.
ASSERT_EQ(1, client.getLeaseNum());
Lease6 lease_client2 = client.getLease(0);
+
// The current lease should be exactly the same as old lease,
// because server shouldn't have extended.
- EXPECT_TRUE(lease_client == lease_client2);
+ EXPECT_TRUE(lease_client.addr_ == lease_client2.addr_);
+ EXPECT_EQ(0, lease_client2.preferred_lft_);
+ EXPECT_EQ(0, lease_client2.valid_lft_);
+
// Make sure, that the lease that client has, is matching the lease
// in the lease database.
Lease6Ptr lease_server2 = checkLease(lease_client2);
return;
}
+ // Check if the lease still belongs to the subnet. If it doesn't,
+ // we'll need to remove it.
+ if ((lease->type_ != Lease::TYPE_PD) && !ctx.subnet_->inRange(lease->addr_)) {
+ // Oh dear, the lease is no longer valid. We need to get rid of it.
+
+ // Remove this lease from LeaseMgr
+ LeaseMgrFactory::instance().deleteLease(lease->addr_);
+
+ // Add it to the removed leases list.
+ ctx.old_leases_.push_back(lease);
+
+ return;
+ }
+
// Keep the old data in case the callout tells us to skip update.
Lease6 old_data = *lease;