summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfg_subnets4.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/dhcpsrv/cfg_subnets4.cc')
-rw-r--r--src/lib/dhcpsrv/cfg_subnets4.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc
index 78ca8339c3..af890d1100 100644
--- a/src/lib/dhcpsrv/cfg_subnets4.cc
+++ b/src/lib/dhcpsrv/cfg_subnets4.cc
@@ -39,6 +39,20 @@ CfgSubnets4::add(const Subnet4Ptr& subnet) {
subnets_.push_back(subnet);
}
+void
+CfgSubnets4::del(const ConstSubnet4Ptr& subnet) {
+ auto& index = subnets_.get<SubnetIdIndexTag>();
+ auto subnet_it = index.find(subnet->getID());
+ if (subnet_it == index.end()) {
+ isc_throw(BadValue, "no subnet with ID of '" << subnet->getID()
+ << "' found");
+ }
+ index.erase(subnet_it);
+
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_DEL_SUBNET4)
+ .arg(subnet->toText());
+}
+
ConstSubnet4Ptr
CfgSubnets4::getBySubnetId(const SubnetID& subnet_id) const {
const auto& index = subnets_.get<SubnetSubnetIdIndexTag>();