2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[#2815] Implement del in CfgHosts

This commit is contained in:
Slawek Figiel
2023-04-05 13:50:31 +02:00
parent 0b0845fbf9
commit c285eec0ba

View File

@@ -1086,10 +1086,18 @@ CfgHosts::add6(const HostPtr& host) {
}
bool
CfgHosts::del(const SubnetID& /*subnet_id*/, const asiolink::IOAddress& /*addr*/) {
/// @todo: Implement host removal
isc_throw(NotImplemented, "sorry, not implemented");
return (false);
CfgHosts::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr) {
bool erased = false;
if (addr.isV4()) {
HostContainerIndex1& idx = hosts_.get<1>();
erased = idx.erase(addr) != 0;
} else {
HostContainer6Index1& idx = hosts6_.get<1>();
auto range = idx.equal_range(boost::make_tuple(subnet_id, addr));
auto eraseIt = idx.erase(range.first, range.second);
erased = eraseIt != idx.end();
}
return (erased);
}
size_t