From 36ed24d1834330066141447af7b98c129612f815 Mon Sep 17 00:00:00 2001 From: Slawek Figiel Date: Fri, 7 Apr 2023 19:20:12 +0200 Subject: [PATCH] [#2815] Fix del command --- src/lib/dhcpsrv/cfg_hosts.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc index c21905bf7e..c5d54034bd 100644 --- a/src/lib/dhcpsrv/cfg_hosts.cc +++ b/src/lib/dhcpsrv/cfg_hosts.cc @@ -1091,8 +1091,10 @@ CfgHosts::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr) { size_t erased_addresses = 0; if (addr.isV4()) { // Delete IPv4 reservation and host. - HostContainerIndex1& idx = hosts_.get<1>(); - erased_hosts = idx.erase(addr); + HostContainerIndex4& idx = hosts_.get<4>(); + for (auto host : getAll4(subnet_id, addr)) { + erased_hosts += idx.erase(host->getHostId()); + } erased_addresses = erased_hosts; } else { HostContainer6Index1& idx6 = hosts6_.get<1>(); -- 2.47.3