}
}
- // Remove existing DNS entries for the lease, if any.
- // queueNCR will do the necessary checks and will skip the update, if not needed.
- queueNCR(CHG_REMOVE, lease);
-
// @todo: Call hooks.
// We need to disassociate the lease from the client. Once we move a lease
LeaseMgrFactory::instance().updateLease4(lease);
+ // Remove existing DNS entries for the lease, if any.
+ // queueNCR will do the necessary checks and will skip the update, if not needed.
+ queueNCR(CHG_REMOVE, lease);
+
// Bump up the statistics.
// Per subnet declined addresses counter.
}
}
- // Check if a lease has flags indicating that the FQDN update has
- // been performed. If so, create NameChangeRequest which removes
- // the entries. This method does all necessary checks.
- queueNCR(CHG_REMOVE, lease);
-
// @todo: Call hooks.
// We need to disassociate the lease from the client. Once we move a lease
LeaseMgrFactory::instance().updateLease6(lease);
+ // Check if a lease has flags indicating that the FQDN update has
+ // been performed. If so, create NameChangeRequest which removes
+ // the entries. This method does all necessary checks.
+ queueNCR(CHG_REMOVE, lease);
+
// Bump up the subnet-specific statistic.
StatsMgr::instance().addValue(
StatsMgr::generateName("subnet", lease->subnet_id_, "declined-addresses"),
// Set the generated FQDN in the Client FQDN option.
fqdn->setDomainName(generated_name, Option6ClientFqdn::FULL);
- answer->delOption(D6O_CLIENT_FQDN);
- answer->addOption(fqdn);
- ctx.hostname_ = generated_name;
+ answer->delOption(D6O_CLIENT_FQDN);
+ answer->addOption(fqdn);
+ ctx.hostname_ = generated_name;
} catch (const Exception& ex) {
LOG_ERROR(ddns6_logger, DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL)
.arg(answer->getLabel())
// Remove this lease from LeaseMgr as it is reserved to someone
// else or doesn't belong to a pool.
- LeaseMgrFactory::instance().deleteLease(candidate);
+ bool success = LeaseMgrFactory::instance().deleteLease(candidate);
+
+ if (!success) {
+ continue;
+ }
// Update DNS if needed.
queueNCR(CHG_REMOVE, candidate);
}
// Remove this lease from LeaseMgr as it doesn't belong to a pool.
- LeaseMgrFactory::instance().deleteLease(candidate);
+ bool success = LeaseMgrFactory::instance().deleteLease(candidate);
+
+ if (!success) {
+ continue;
+ }
// Update DNS if needed.
queueNCR(CHG_REMOVE, candidate);
// simply remove it from the list.
// We have reservations, but not for this lease. Release it.
// Remove this lease from LeaseMgr
- LeaseMgrFactory::instance().deleteLease(*lease);
+ bool success = LeaseMgrFactory::instance().deleteLease(*lease);
+
+ if (!success) {
+ continue;
+ }
// Update DNS if required.
queueNCR(CHG_REMOVE, *lease);
// Oh dear, the lease is no longer valid. We need to get rid of it.
// Remove this lease from LeaseMgr
- LeaseMgrFactory::instance().deleteLease(lease);
+ bool success = LeaseMgrFactory::instance().deleteLease(lease);
+
+ if (!success) {
+ return;
+ }
// Updated DNS if required.
queueNCR(CHG_REMOVE, lease);
.arg(ctx.query_->getLabel())
.arg(client_lease->addr_.toText());
- lease_mgr.deleteLease(client_lease);
+ bool success = lease_mgr.deleteLease(client_lease);
- // Need to decrease statistic for assigned addresses.
- StatsMgr::instance().addValue(
- StatsMgr::generateName("subnet", client_lease->subnet_id_, "assigned-addresses"),
- static_cast<int64_t>(-1));
+ if (success) {
+ // Need to decrease statistic for assigned addresses.
+ StatsMgr::instance().addValue(
+ StatsMgr::generateName("subnet", client_lease->subnet_id_,
+ "assigned-addresses"),
+ static_cast<int64_t>(-1));
+ }
}
// Return the allocated lease or NULL pointer if allocation was