// We may also decide not to generate any requests at all. This is when
// we discover that nothing has changed in the client's FQDN data.
if (old_lease) {
- if (!lease->matches(*old_lease)) {
- isc_throw(isc::Unexpected,
- "there is no match between the current instance of the"
- " lease: " << lease->toText() << ", and the previous"
- " instance: " << lease->toText());
- } else {
- // There will be a NameChangeRequest generated to remove existing
- // DNS entries if the following conditions are met:
- // - The hostname is set for the existing lease, we can't generate
- // removal request for non-existent hostname.
- // - A server has performed reverse, forward or both updates.
- // - FQDN data between the new and old lease do not match.
- if (!lease->hasIdenticalFqdn(*old_lease)) {
- queueNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE,
- old_lease);
+ // There will be a NameChangeRequest generated to remove existing
+ // DNS entries if the following conditions are met:
+ // - The hostname is set for the existing lease, we can't generate
+ // removal request for non-existent hostname.
+ // - A server has performed reverse, forward or both updates.
+ // - FQDN data between the new and old lease do not match.
+ if (!lease->hasIdenticalFqdn(*old_lease)) {
+ queueNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, old_lease);
// If FQDN data from both leases match, there is no need to update.
- } else if (lease->hasIdenticalFqdn(*old_lease)) {
- return;
-
- }
+ } else if (lease->hasIdenticalFqdn(*old_lease)) {
+ return;
}
+
}
// We may need to generate the NameChangeRequest for the new lease. It
}
-// This test verifies that exception is thrown when leases passed to the
-// createNameChangeRequests function do not match, i.e. they comprise
-// different IP addresses, client ids etc.
-TEST_F(NameDhcpv4SrvTest, createNameChangeRequestsLeaseMismatch) {
- Lease4Ptr lease1 = createLease(IOAddress("192.0.2.3"),
- "lease1.example.com.",
- true, true);
- Lease4Ptr lease2 = createLease(IOAddress("192.0.2.4"),
- "lease2.example.com.",
- true, true);
- EXPECT_THROW(srv_->createNameChangeRequests(lease2, lease1),
- isc::Unexpected);
-}
-
// Test that the OFFER message generated as a result of the DISCOVER message
// processing will not result in generation of the NameChangeRequests.
TEST_F(NameDhcpv4SrvTest, processDiscover) {