summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfg_hosts.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2018-11-23 09:43:14 +0100
committerMarcin Siodelski <marcin@isc.org>2018-11-26 21:26:33 +0100
commit57653336b85eae9b22fcb26b34118f686cfeb0dd (patch)
treed024610a8c7099106e81db08d95e8c0ad28da0aa /src/lib/dhcpsrv/cfg_hosts.cc
parent[master] Added ChangeLog entry for #263. (diff)
downloadkea-57653336b85eae9b22fcb26b34118f686cfeb0dd.tar.xz
kea-57653336b85eae9b22fcb26b34118f686cfeb0dd.zip
[#158,!136] Added ability to remove all hosts for subnet id.
Diffstat (limited to 'src/lib/dhcpsrv/cfg_hosts.cc')
-rw-r--r--src/lib/dhcpsrv/cfg_hosts.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc
index 9725920d9d..b07fe152ed 100644
--- a/src/lib/dhcpsrv/cfg_hosts.cc
+++ b/src/lib/dhcpsrv/cfg_hosts.cc
@@ -600,6 +600,18 @@ CfgHosts::del(const SubnetID& /*subnet_id*/, const asiolink::IOAddress& /*addr*/
return (false);
}
+size_t
+CfgHosts::delAll4(const SubnetID& subnet_id) {
+ HostContainerIndex2& idx = hosts_.get<2>();
+ size_t erased = idx.erase(subnet_id);
+
+ LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_DEL_ALL_SUBNET4)
+ .arg(erased)
+ .arg(subnet_id);
+
+ return (erased);
+}
+
bool
CfgHosts::del4(const SubnetID& /*subnet_id*/,
const Host::IdentifierType& /*identifier_type*/,
@@ -610,6 +622,24 @@ CfgHosts::del4(const SubnetID& /*subnet_id*/,
return (false);
}
+size_t
+CfgHosts::delAll6(const SubnetID& subnet_id) {
+ // Delete IPv6 reservations.
+ HostContainer6Index2& idx6 = hosts6_.get<2>();
+ size_t erased_addresses = idx6.erase(subnet_id);
+
+ // Delete hosts.
+ HostContainerIndex3& idx = hosts_.get<3>();
+ size_t erased_hosts = idx.erase(subnet_id);
+
+ LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_DEL_ALL_SUBNET6)
+ .arg(erased_hosts)
+ .arg(erased_addresses)
+ .arg(subnet_id);
+
+ return (erased_hosts);
+}
+
bool
CfgHosts::del6(const SubnetID& /*subnet_id*/,
const Host::IdentifierType& /*identifier_type*/,