From: Piotrek Zadroga Date: Mon, 19 Jun 2023 16:25:46 +0000 (+0200) Subject: [#2795] extend impl of MemHostDataSource::getAll4 X-Git-Tag: Kea-2.4.0~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18033c50f99c4b8b93ac4e9c28f32bec65e5e341;p=thirdparty%2Fkea.git [#2795] extend impl of MemHostDataSource::getAll4 --- diff --git a/src/lib/dhcpsrv/testutils/memory_host_data_source.cc b/src/lib/dhcpsrv/testutils/memory_host_data_source.cc index 7e7b21bb97..2ba8a3737d 100644 --- a/src/lib/dhcpsrv/testutils/memory_host_data_source.cc +++ b/src/lib/dhcpsrv/testutils/memory_host_data_source.cc @@ -177,8 +177,15 @@ MemHostDataSource::getPage6(size_t& /*source_index*/, } ConstHostCollection -MemHostDataSource::getAll4(const asiolink::IOAddress& /*address*/) const { - return (ConstHostCollection()); +MemHostDataSource::getAll4(const asiolink::IOAddress& address) const { + ConstHostCollection hosts; + for (const auto & h : store_) { + if (h->getIPv4Reservation() == address) { + hosts.push_back(h); + } + } + + return (hosts); } ConstHostPtr @@ -243,10 +250,13 @@ ConstHostCollection MemHostDataSource::getAll4(const SubnetID& subnet_id, const asiolink::IOAddress& address) const { ConstHostCollection hosts; - auto host = get4(subnet_id, address); - if (host) { - hosts.push_back(host); + for (const auto & h : store_) { + if (h->getIPv4SubnetID() == subnet_id && + h->getIPv4Reservation() == address) { + hosts.push_back(h); + } } + return (hosts); }