diff options
author | Francis Dupont <fdupont@isc.org> | 2022-11-18 11:50:06 +0100 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2022-11-21 15:32:13 +0100 |
commit | e24bfcc1f93506777a1d800e90f5f5fdad55d644 (patch) | |
tree | 583d31a2eafcb019e7a19232812de90826507d97 /src/lib/dhcpsrv/cfg_subnets4.cc | |
parent | [#2348] Deleted subnet c-ctor and assignment op (diff) | |
download | kea-e24bfcc1f93506777a1d800e90f5f5fdad55d644.tar.xz kea-e24bfcc1f93506777a1d800e90f5f5fdad55d644.zip |
[#2643] Checkpoint: ported code, tests to port
Diffstat (limited to 'src/lib/dhcpsrv/cfg_subnets4.cc')
-rw-r--r-- | src/lib/dhcpsrv/cfg_subnets4.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets4.cc b/src/lib/dhcpsrv/cfg_subnets4.cc index 9cc80d2581..cd339cf39b 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.cc +++ b/src/lib/dhcpsrv/cfg_subnets4.cc @@ -495,6 +495,23 @@ CfgSubnets4::selectSubnet(const IOAddress& address, return (Subnet4Ptr()); } +SubnetIDSet +CfgSubnets4::getLinks(const IOAddress& link_addr, uint8_t& link_len) const { + SubnetIDSet links; + bool link_len_set = false; + for (auto const& subnet : subnets_) { + if (!subnet->inRange(link_addr)) { + continue; + } + uint8_t plen = subnet->get().second; + if (!link_len_set || (plen < link_len)) { + link_len = plen; + } + links.insert(subnet->getID()); + } + return (links); +} + void CfgSubnets4::removeStatistics() { using namespace isc::stats; |