Kea: cfg_subnets6.cc Source File

| Kea 3.0.0

cfg_subnets6.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8#include <dhcp/dhcp6.h>
9#include <dhcp/option_custom.h>
10#include <asiolink/addr_utilities.h>
11#include <dhcpsrv/cfg_subnets6.h>
12#include <dhcpsrv/dhcpsrv_log.h>
13#include <dhcpsrv/lease_mgr_factory.h>
14#include <dhcpsrv/subnet_id.h>
15#include <stats/stats_mgr.h>
16#include <boost/range/adaptor/reversed.hpp>
17#include <string.h>
18#include <sstream>
19
20using namespace isc::asiolink;
21using namespace isc::data;
22
23using namespace std;
24
25namespace isc {
26namespace dhcp {
27
28void
29CfgSubnets6::add(const Subnet6Ptr& subnet) {
30 if (getBySubnetId(subnet->getID())) {
31 isc_throw(isc::dhcp::DuplicateSubnetID, "ID of the new IPv6 subnet '"
32 << subnet->getID() << "' is already in use");
33
34 } else if (getByPrefix(subnet->toText())) {
37 isc_throw(isc::dhcp::DuplicateSubnetID, "subnet with the prefix of '"
38 << subnet->toText() << "' already exists");
39 }
40
41 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_ADD_SUBNET6)
42 .arg(subnet->toText());
43 static_cast<void>(subnets_.insert(subnet));
44}
45
46 Subnet6Ptr
47CfgSubnets6::replace(const Subnet6Ptr& subnet) {
48 // Get the subnet with the same ID.
49 const SubnetID& subnet_id = subnet->getID();
50 auto& index = subnets_.template get<SubnetSubnetIdIndexTag>();
51 auto subnet_it = index.find(subnet_id);
52 if (subnet_it == index.end()) {
53 isc_throw(BadValue, "There is no IPv6 subnet with ID " << subnet_id);
54 }
55 Subnet6Ptr old = *subnet_it;
56 bool ret = index.replace(subnet_it, subnet);
57
58 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_UPDATE_SUBNET6)
59 .arg(subnet_id).arg(ret);
60 if (ret) {
61 return (old);
62 } else {
63 return (Subnet6Ptr());
64 }
65}
66
67void
68CfgSubnets6::del(const ConstSubnet6Ptr& subnet) {
69 del(subnet->getID());
70}
71
72void
73 CfgSubnets6::del(const SubnetID& subnet_id) {
74 auto& index = subnets_.get<SubnetSubnetIdIndexTag>();
75 auto subnet_it = index.find(subnet_id);
76 if (subnet_it == index.end()) {
77 isc_throw(BadValue, "no subnet with ID of '" << subnet_id
78 << "' found");
79 }
80
81 Subnet6Ptr subnet = *subnet_it;
82
83 index.erase(subnet_it);
84
85 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_DEL_SUBNET6)
86 .arg(subnet->toText());
87}
88
89void
90CfgSubnets6::merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks,
91 CfgSubnets6& other) {
92 auto& index_id = subnets_.get<SubnetSubnetIdIndexTag>();
93 auto& index_prefix = subnets_.get<SubnetPrefixIndexTag>();
94
95 // Iterate over the subnets to be merged. They will replace the existing
96 // subnets with the same id. All new subnets will be inserted into the
97 // configuration into which we're merging.
98 auto const& other_subnets = other.getAll();
99 for (auto const& other_subnet : *other_subnets) {
100
101 // Check if there is a subnet with the same ID.
102 auto subnet_it = index_id.find(other_subnet->getID());
103 if (subnet_it != index_id.end()) {
104
105 // Subnet found.
106 auto existing_subnet = *subnet_it;
107
108 // If the existing subnet and other subnet
109 // are the same instance skip it.
110 if (existing_subnet == other_subnet) {
111 continue;
112 }
113
114 // We're going to replace the existing subnet with the other
115 // version. If it belongs to a shared network, we need
116 // remove it from that network.
117 SharedNetwork6Ptr network;
118 existing_subnet->getSharedNetwork(network);
119 if (network) {
120 network->del(existing_subnet->getID());
121 }
122
123 // Now we remove the existing subnet.
124 index_id.erase(subnet_it);
125 }
126
127 // Check if there is a subnet with the same prefix.
128 auto subnet_prefix_it = index_prefix.find(other_subnet->toText());
129 if (subnet_prefix_it != index_prefix.end()) {
130
131 // Subnet found.
132 auto existing_subnet = *subnet_prefix_it;
133
134 // Updating the id can lead to problems... e.g. reservation
135 // for the previous subnet ID.
136 // @todo: check reservations
137
138 // We're going to replace the existing subnet with the other
139 // version. If it belongs to a shared network, we need
140 // remove it from that network.
141 SharedNetwork6Ptr network;
142 existing_subnet->getSharedNetwork(network);
143 if (network) {
144 network->del(existing_subnet->getID());
145 }
146
147 // Now we remove the existing subnet.
148 index_prefix.erase(subnet_prefix_it);
149 }
150
151 // Create the subnet's options based on the given definitions.
152 other_subnet->getCfgOption()->createOptions(cfg_def);
153
154 // Encapsulate options, so that the DHCP server can effectively return
155 // them to the clients without having to encapsulate them for each request.
156 other_subnet->getCfgOption()->encapsulate();
157
158 // Create the options for pool based on the given definitions.
159 for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_NA)) {
160 pool->getCfgOption()->createOptions(cfg_def);
161 pool->getCfgOption()->encapsulate();
162 }
163
164 // Create the options for pd pool based on the given definitions.
165 for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_PD)) {
166 pool->getCfgOption()->createOptions(cfg_def);
167 pool->getCfgOption()->encapsulate();
168 }
169
170 // Add the "other" subnet to the our collection of subnets.
171 static_cast<void>(subnets_.insert(other_subnet));
172
173 // If it belongs to a shared network, find the network and
174 // add the subnet to it
175 std::string network_name = other_subnet->getSharedNetworkName();
176 if (!network_name.empty()) {
177 SharedNetwork6Ptr network = networks->getByName(network_name);
178 if (network) {
179 network->add(other_subnet);
180 } else {
181 // This implies the shared-network collection we were given
182 // is out of sync with the subnets we were given.
183 isc_throw(InvalidOperation, "Cannot assign subnet ID of "
184 << other_subnet->getID()
185 << " to shared network: " << network_name
186 << ", network does not exist");
187 }
188 }
189 // Instantiate the configured allocators and their states.
190 other_subnet->createAllocators();
191 }
192}
193
194 ConstSubnet6Ptr
195CfgSubnets6::getByPrefix(const std::string& subnet_text) const {
196 auto const& index = subnets_.get<SubnetPrefixIndexTag>();
197 auto subnet_it = index.find(subnet_text);
198 return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet6Ptr());
199}
200
201 SubnetSelector
202CfgSubnets6::initSelector(const Pkt6Ptr& query) {
203 // Initialize subnet selector with the values used to select the subnet.
204 SubnetSelector selector;
205 selector.iface_name_ = query->getIface();
206 selector.remote_address_ = query->getRemoteAddr();
207 selector.first_relay_linkaddr_ = IOAddress("::");
208 selector.client_classes_ = query->classes_;
209
210 // Initialize fields specific to relayed messages.
211 if (!query->relay_info_.empty()) {
212 for (auto const& relay : boost::adaptors::reverse(query->relay_info_)) {
213 if (!relay.linkaddr_.isV6Zero() &&
214 !relay.linkaddr_.isV6LinkLocal()) {
215 selector.first_relay_linkaddr_ = relay.linkaddr_;
216 break;
217 }
218 }
219 selector.interface_id_ =
220 query->getAnyRelayOption(D6O_INTERFACE_ID,
221 Pkt6::RELAY_GET_FIRST);
222 }
223
224 return (selector);
225}
226
227 ConstSubnet6Ptr
228CfgSubnets6::selectSubnet(const SubnetSelector& selector) const {
229 ConstSubnet6Ptr subnet;
230
231 // If relay agent link address is set to zero it means that we're dealing
232 // with a directly connected client.
233 if (selector.first_relay_linkaddr_ == IOAddress("::")) {
234 // If interface name is known try to match it with interface names
235 // specified for configured subnets.
236 if (!selector.iface_name_.empty()) {
237 subnet = selectSubnet(selector.iface_name_,
238 selector.client_classes_);
239 }
240
241 // If interface name didn't match, try the client's address.
242 if (!subnet && selector.remote_address_ != IOAddress("::")) {
243 subnet = selectSubnet(selector.remote_address_,
244 selector.client_classes_);
245 }
246
247 // If relay agent link address is set, we're dealing with a relayed message.
248 } else {
249 // Find the subnet using the Interface Id option, if present.
250 subnet = selectSubnet(selector.interface_id_, selector.client_classes_);
251
252 // If Interface ID option could not be matched for any subnet, try
253 // the relay agent link address.
254 if (!subnet) {
255 subnet = selectSubnet(selector.first_relay_linkaddr_,
256 selector.client_classes_,
257 true);
258 }
259 }
260
261 // Return subnet found, or NULL if not found.
262 return (subnet);
263}
264
265 ConstSubnet6Ptr
266 CfgSubnets6::selectSubnet(const asiolink::IOAddress& address,
267 const ClientClasses& client_classes,
268 const bool is_relay_address) const {
269 // If the specified address is a relay address we first need to match
270 // it with the relay addresses specified for all subnets.
271 if (is_relay_address) {
272 for (auto const& subnet : subnets_) {
273
274 // If the specified address matches a relay address, return this
275 // subnet.
276 if (subnet->hasRelays()) {
277 if (!subnet->hasRelayAddress(address)) {
278 continue;
279 }
280
281 } else {
282 SharedNetwork6Ptr network;
283 subnet->getSharedNetwork(network);
284 if (!network || !network->hasRelayAddress(address)) {
285 continue;
286 }
287 }
288
289 if (subnet->clientSupported(client_classes)) {
290 // The relay address is matching the one specified for a subnet
291 // or its shared network.
292 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
293 DHCPSRV_CFGMGR_SUBNET6_RELAY)
294 .arg(subnet->toText()).arg(address.toText());
295 return (subnet);
296 }
297 }
298 }
299
300 // No success so far. Check if the specified address is in range
301 // with any subnet.
302 for (auto const& subnet : subnets_) {
303 if (subnet->inRange(address) && subnet->clientSupported(client_classes)) {
304 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_SUBNET6)
305 .arg(subnet->toText()).arg(address.toText());
306 return (subnet);
307 }
308 }
309
310 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
311 DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH)
312 .arg(address.toText());
313
314 // Nothing found.
315 return (ConstSubnet6Ptr());
316}
317
318 ConstSubnet6Ptr
319 CfgSubnets6::selectSubnet(const std::string& iface_name,
320 const ClientClasses& client_classes) const {
321 // If empty interface specified, we can't select subnet by interface.
322 if (!iface_name.empty()) {
323 for (auto const& subnet : subnets_) {
324
325 // If interface name matches with the one specified for the subnet
326 // and the client is not rejected based on the classification,
327 // return the subnet.
328 if ((subnet->getIface() == iface_name) &&
329 subnet->clientSupported(client_classes)) {
330 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
331 DHCPSRV_CFGMGR_SUBNET6_IFACE)
332 .arg(subnet->toText()).arg(iface_name);
333 return (subnet);
334 }
335 }
336 }
337
338 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
339 DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH)
340 .arg(iface_name);
341
342 // No subnet found for this interface name.
343 return (ConstSubnet6Ptr());
344}
345
346 ConstSubnet6Ptr
347 CfgSubnets6::selectSubnet(const OptionPtr& interface_id,
348 const ClientClasses& client_classes) const {
349 // We can only select subnet using an interface id, if the interface
350 // id is known.
351 if (interface_id) {
352 for (auto const& subnet : subnets_) {
353
354 // If interface id matches for the subnet and the subnet is not
355 // rejected based on the classification.
356 if (subnet->getInterfaceId() &&
357 subnet->getInterfaceId()->equals(interface_id) &&
358 subnet->clientSupported(client_classes)) {
359
360 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
361 DHCPSRV_CFGMGR_SUBNET6_IFACE_ID)
362 .arg(subnet->toText());
363 return (subnet);
364 }
365 }
366
367 LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
368 DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH)
369 .arg(interface_id->toText());
370 }
371
372 // No subnet found.
373 return (ConstSubnet6Ptr());
374}
375
376 Subnet6Ptr
377CfgSubnets6::getSubnet(const SubnetID subnet_id) const {
378 auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
379 auto subnet_it = index.find(subnet_id);
380 return ((subnet_it != index.cend()) ? (*subnet_it) : Subnet6Ptr());
381}
382
383 SubnetIDSet
384CfgSubnets6::getLinks(const IOAddress& link_addr) const {
385 SubnetIDSet links;
386 for (auto const& subnet : subnets_) {
387 if (!subnet->inRange(link_addr)) {
388 continue;
389 }
390 links.insert(subnet->getID());
391 }
392 return (links);
393}
394
395void
396CfgSubnets6::removeStatistics() {
397 using namespace isc::stats;
398
399 StatsMgr& stats_mgr = StatsMgr::instance();
400 // For each v6 subnet currently configured, remove the statistics.
401 for (auto const& subnet6 : subnets_) {
402 SubnetID subnet_id = subnet6->getID();
403 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
404 "total-nas"));
405
406 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
407 "assigned-nas"));
408
409 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
410 "cumulative-assigned-nas"));
411
412 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
413 "total-pds"));
414
415 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
416 "assigned-pds"));
417
418 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
419 "cumulative-assigned-pds"));
420
421 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
422 "declined-addresses"));
423
424 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
425 "reclaimed-declined-addresses"));
426
427 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
428 "reclaimed-leases"));
429
430 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
431 "cumulative-registered-nas"));
432
433 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
434 "registered-nas"));
435
436 for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) {
437 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
438 StatsMgr::generateName("pool", pool->getID(),
439 "total-nas")));
440
441 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
442 StatsMgr::generateName("pool", pool->getID(),
443 "assigned-nas")));
444
445 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
446 StatsMgr::generateName("pool", pool->getID(),
447 "cumulative-assigned-nas")));
448
449 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
450 StatsMgr::generateName("pool", pool->getID(),
451 "declined-addresses")));
452
453 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
454 StatsMgr::generateName("pool", pool->getID(),
455 "reclaimed-declined-addresses")));
456
457 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
458 StatsMgr::generateName("pool", pool->getID(),
459 "reclaimed-leases")));
460 }
461
462 for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) {
463 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
464 StatsMgr::generateName("pd-pool", pool->getID(),
465 "total-pds")));
466
467 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
468 StatsMgr::generateName("pd-pool", pool->getID(),
469 "assigned-pds")));
470
471 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
472 StatsMgr::generateName("pd-pool", pool->getID(),
473 "cumulative-assigned-pds")));
474
475 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
476 StatsMgr::generateName("pd-pool", pool->getID(),
477 "reclaimed-leases")));
478 }
479 }
480}
481
482void
483CfgSubnets6::updateStatistics() {
484 using namespace isc::stats;
485
486 StatsMgr& stats_mgr = StatsMgr::instance();
487 // For each v6 subnet currently configured, calculate totals
488 for (auto const& subnet6 : subnets_) {
489 SubnetID subnet_id = subnet6->getID();
490
491 stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
492 "total-nas"),
493 subnet6->getPoolCapacity(Lease::TYPE_NA));
494
495 stats_mgr.setValue(StatsMgr::generateName("subnet", subnet_id,
496 "total-pds"),
497 subnet6->getPoolCapacity(Lease::TYPE_PD));
498
499 const std::string& name_nas(StatsMgr::generateName("subnet", subnet_id,
500 "cumulative-assigned-nas"));
501 if (!stats_mgr.getObservation(name_nas)) {
502 stats_mgr.setValue(name_nas, static_cast<int64_t>(0));
503 }
504
505 const std::string& name_pds(StatsMgr::generateName("subnet", subnet_id,
506 "cumulative-assigned-pds"));
507 if (!stats_mgr.getObservation(name_pds)) {
508 stats_mgr.setValue(name_pds, static_cast<int64_t>(0));
509 }
510
511 string const& name_ia_na_reuses(StatsMgr::generateName("subnet", subnet_id,
512 "v6-ia-na-lease-reuses"));
513 if (!stats_mgr.getObservation(name_ia_na_reuses)) {
514 stats_mgr.setValue(name_ia_na_reuses, int64_t(0));
515 }
516
517 string const& name_ia_pd_reuses(StatsMgr::generateName("subnet", subnet_id,
518 "v6-ia-pd-lease-reuses"));
519 if (!stats_mgr.getObservation(name_ia_pd_reuses)) {
520 stats_mgr.setValue(name_ia_pd_reuses, int64_t(0));
521 }
522
523 string const& name_registered(StatsMgr::generateName("subnet", subnet_id,
524 "cumulative-registered-nas"));
525
526 if (!stats_mgr.getObservation(name_registered)) {
527 stats_mgr.setValue(name_registered, static_cast<int64_t>(0));
528 }
529
530 for (auto const& pool : subnet6->getPools(Lease::TYPE_NA)) {
531 const std::string& name_total_nas(StatsMgr::generateName("subnet", subnet_id,
532 StatsMgr::generateName("pool", pool->getID(),
533 "total-nas")));
534 if (!stats_mgr.getObservation(name_total_nas)) {
535 stats_mgr.setValue(name_total_nas, pool->getCapacity());
536 } else {
537 stats_mgr.addValue(name_total_nas, pool->getCapacity());
538 }
539
540 const std::string& name_ca_nas(StatsMgr::generateName("subnet", subnet_id,
541 StatsMgr::generateName("pool", pool->getID(),
542 "cumulative-assigned-nas")));
543 if (!stats_mgr.getObservation(name_ca_nas)) {
544 stats_mgr.setValue(name_ca_nas, static_cast<int64_t>(0));
545 }
546 }
547
548 for (auto const& pool : subnet6->getPools(Lease::TYPE_PD)) {
549 const std::string& name_total_pds(StatsMgr::generateName("subnet", subnet_id,
550 StatsMgr::generateName("pd-pool", pool->getID(),
551 "total-pds")));
552 if (!stats_mgr.getObservation(name_total_pds)) {
553 stats_mgr.setValue(name_total_pds, pool->getCapacity());
554 } else {
555 stats_mgr.addValue(name_total_pds, pool->getCapacity());
556 }
557
558 const std::string& name_ca_pds(StatsMgr::generateName("subnet", subnet_id,
559 StatsMgr::generateName("pd-pool", pool->getID(),
560 "cumulative-assigned-pds")));
561 if (!stats_mgr.getObservation(name_ca_pds)) {
562 stats_mgr.setValue(name_ca_pds, static_cast<int64_t>(0));
563 }
564 }
565 }
566
567 // Only recount the stats if we have subnets.
568 if (subnets_.begin() != subnets_.end()) {
569 LeaseMgrFactory::instance().recountLeaseStats6();
570 }
571}
572
573void
574CfgSubnets6::initAllocatorsAfterConfigure() {
575 for (auto const& subnet : subnets_) {
576 subnet->initAllocatorsAfterConfigure();
577 }
578}
579
580void
581CfgSubnets6::clear() {
582 subnets_.clear();
583}
584
585 ElementPtr
586CfgSubnets6::toElement() const {
587 ElementPtr result = Element::createList();
588 // Iterate subnets
589 for (auto const& subnet : subnets_) {
590 result->add(subnet->toElement());
591 }
592 return (result);
593}
594
595} // end of namespace isc::dhcp
596} // end of namespace isc
addr_utilities.h
cfg_subnets6.h
isc::BadValue
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
Definition exceptions/exceptions.h:132
isc::InvalidOperation
A generic exception that is thrown if a function is called in a prohibited way.
Definition exceptions/exceptions.h:143
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic)
Definition io_address.h:45
isc::asiolink::IOAddress::toText
std::string toText() const
Convert the address to a string.
Definition io_address.cc:61
isc::data::Element::createList
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
isc::dhcp::CfgSubnets6
Holds subnets configured for the DHCPv6 server.
Definition cfg_subnets6.h:34
isc::dhcp::CfgSubnets6::getLinks
SubnetIDSet getLinks(const asiolink::IOAddress &link_addr) const
Convert a link address into a link set.
Definition cfg_subnets6.cc:384
isc::dhcp::CfgSubnets6::selectSubnet
ConstSubnet6Ptr selectSubnet(const SubnetSelector &selector) const
Selects a subnet using parameters specified in the selector.
Definition cfg_subnets6.cc:228
isc::dhcp::CfgSubnets6::updateStatistics
void updateStatistics()
Updates statistics.
Definition cfg_subnets6.cc:483
isc::dhcp::CfgSubnets6::replace
Subnet6Ptr replace(const Subnet6Ptr &subnet)
Replaces subnet in the configuration.
Definition cfg_subnets6.cc:47
isc::dhcp::CfgSubnets6::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition cfg_subnets6.cc:586
isc::dhcp::CfgSubnets6::merge
void merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, CfgSubnets6 &other)
Merges specified subnet configuration into this configuration.
Definition cfg_subnets6.cc:90
isc::dhcp::CfgSubnets6::getSubnet
Subnet6Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
Definition cfg_subnets6.cc:377
isc::dhcp::CfgSubnets6::removeStatistics
void removeStatistics()
Removes statistics.
Definition cfg_subnets6.cc:396
isc::dhcp::CfgSubnets6::getAll
const Subnet6Collection * getAll() const
Returns pointer to the collection of all IPv6 subnets.
Definition cfg_subnets6.h:120
isc::dhcp::CfgSubnets6::add
void add(const Subnet6Ptr &subnet)
Adds new subnet to the configuration.
Definition cfg_subnets6.cc:29
isc::dhcp::CfgSubnets6::clear
void clear()
Clears all subnets from the configuration.
Definition cfg_subnets6.cc:581
isc::dhcp::CfgSubnets6::initSelector
static SubnetSelector initSelector(const Pkt6Ptr &query)
Build selector from a client's message.
Definition cfg_subnets6.cc:202
isc::dhcp::CfgSubnets6::del
void del(const ConstSubnet6Ptr &subnet)
Removes subnet from the configuration.
Definition cfg_subnets6.cc:68
isc::dhcp::CfgSubnets6::getByPrefix
ConstSubnet6Ptr getByPrefix(const std::string &subnet_prefix) const
Returns const pointer to a subnet which matches the specified prefix in the canonical form.
Definition cfg_subnets6.cc:195
isc::dhcp::CfgSubnets6::initAllocatorsAfterConfigure
void initAllocatorsAfterConfigure()
Calls initAllocatorsAfterConfigure for each subnet.
Definition cfg_subnets6.cc:574
isc::dhcp::CfgSubnets6::getBySubnetId
ConstSubnet6Ptr getBySubnetId(const SubnetID &subnet_id) const
Returns const pointer to a subnet identified by the specified subnet identifier.
Definition cfg_subnets6.h:139
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:109
isc::dhcp::DuplicateSubnetID
Exception thrown upon attempt to add subnet with an ID that belongs to the subnet that already exists...
Definition subnet_id.h:36
isc::dhcp::LeaseMgrFactory::instance
static TrackingLeaseMgr & instance()
Return current lease manager.
Definition lease_mgr_factory.cc:124
isc::dhcp::LeaseMgr::recountLeaseStats6
void recountLeaseStats6()
Recalculates per-subnet and global stats for IPv6 leases.
Definition lease_mgr.cc:282
isc::dhcp::Pkt6::RELAY_GET_FIRST
@ RELAY_GET_FIRST
Definition pkt6.h:77
isc::stats::StatsMgr
Statistics Manager class.
Definition lib/stats/stats_mgr.h:65
isc::stats::StatsMgr::getObservation
ObservationPtr getObservation(const std::string &name) const
Returns an observation.
Definition lib/stats/stats_mgr.cc:100
isc::stats::StatsMgr::instance
static StatsMgr & instance()
Statistics Manager accessor method.
Definition lib/stats/stats_mgr.cc:30
isc::stats::StatsMgr::generateName
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
Definition lib/stats/stats_mgr.h:298
dhcp6.h
D6O_INTERFACE_ID
@ D6O_INTERFACE_ID
Definition dhcp6.h:38
dhcpsrv_log.h
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition exceptions/exceptions.h:210
isc::stats::StatsMgr::del
bool del(const std::string &name)
Removes specified statistic.
Definition lib/stats/stats_mgr.cc:255
isc::stats::StatsMgr::setValue
void setValue(const std::string &name, const int64_t value)
Records absolute integer observation.
Definition lib/stats/stats_mgr.cc:40
isc::stats::StatsMgr::addValue
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
Definition lib/stats/stats_mgr.cc:70
get
int get(CalloutHandle &handle)
The gss-tsig-get command.
Definition gss_tsig_callouts.cc:47
lease_mgr_factory.h
stats_mgr.h
LOG_DEBUG
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition macros.h:14
isc::asiolink
Definition addr_utilities.cc:170
isc::data
Definition base_stamped_element.cc:12
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::dhcpsrv_logger
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
Definition dhcpsrv_log.h:56
isc::dhcp::DHCPSRV_CFGMGR_SUBNET6_IFACE
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET6_IFACE
Definition dhcpsrv_messages.h:41
isc::dhcp::DHCPSRV_CFGMGR_ADD_SUBNET6
const isc::log::MessageID DHCPSRV_CFGMGR_ADD_SUBNET6
Definition dhcpsrv_messages.h:13
isc::dhcp::SubnetIDSet
std::set< dhcp::SubnetID > SubnetIDSet
Ordered list aka set of subnetIDs.
Definition subnet_id.h:43
isc::dhcp::DHCPSRV_CFGMGR_SUBNET6_RELAY
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET6_RELAY
Definition dhcpsrv_messages.h:43
isc::dhcp::ConstSubnet6Ptr
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:623
isc::dhcp::CfgOptionDefPtr
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
Definition cfg_option_def.h:186
isc::dhcp::DHCPSRV_CFGMGR_UPDATE_SUBNET6
const isc::log::MessageID DHCPSRV_CFGMGR_UPDATE_SUBNET6
Definition dhcpsrv_messages.h:46
isc::dhcp::Subnet6Ptr
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition subnet.h:626
isc::dhcp::SharedNetwork6Ptr
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
Definition shared_network.h:267
isc::dhcp::CfgSharedNetworks6Ptr
boost::shared_ptr< CfgSharedNetworks6 > CfgSharedNetworks6Ptr
Pointer to the configuration of IPv6 shared networks.
Definition cfg_shared_networks.h:240
isc::dhcp::SubnetID
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
isc::dhcp::DHCPSRV_CFGMGR_SUBNET6
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET6
Definition dhcpsrv_messages.h:40
isc::dhcp::DHCPSRV_CFGMGR_SUBNET6_IFACE_ID
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET6_IFACE_ID
Definition dhcpsrv_messages.h:42
isc::dhcp::Pkt6Ptr
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition pkt6.h:31
isc::dhcp::DHCPSRV_CFGMGR_DEL_SUBNET6
const isc::log::MessageID DHCPSRV_CFGMGR_DEL_SUBNET6
Definition dhcpsrv_messages.h:20
isc::dhcp::DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH
const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_ID_NO_MATCH
Definition dhcpsrv_messages.h:168
isc::dhcp::DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH
const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_ADDRESS_NO_MATCH
Definition dhcpsrv_messages.h:167
isc::dhcp::DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH
const isc::log::MessageID DHCPSRV_SUBNET6_SELECT_BY_INTERFACE_NO_MATCH
Definition dhcpsrv_messages.h:169
isc::dhcp::DHCPSRV_DBG_TRACE
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
Definition dhcpsrv_log.h:26
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
isc::stats
Definition context.cc:18
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
option_custom.h
isc::dhcp::Lease::TYPE_PD
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)
Definition lease.h:49
isc::dhcp::Lease::TYPE_NA
@ TYPE_NA
the lease contains non-temporary IPv6 address
Definition lease.h:47
isc::dhcp::SubnetPrefixIndexTag
Tag for the index for searching by subnet prefix.
Definition subnet.h:780
isc::dhcp::SubnetSelector
Subnet selector used to specify parameters used to select a subnet.
Definition subnet_selector.h:23
isc::dhcp::SubnetSelector::iface_name_
std::string iface_name_
Name of the interface on which the message was received.
Definition subnet_selector.h:49
isc::dhcp::SubnetSelector::client_classes_
ClientClasses client_classes_
Classes that the client belongs to.
Definition subnet_selector.h:47
isc::dhcp::SubnetSelector::remote_address_
asiolink::IOAddress remote_address_
Source address of the message.
Definition subnet_selector.h:45
isc::dhcp::SubnetSelector::interface_id_
OptionPtr interface_id_
Interface id option.
Definition subnet_selector.h:37
isc::dhcp::SubnetSelector::first_relay_linkaddr_
asiolink::IOAddress first_relay_linkaddr_
First relay link address.
Definition subnet_selector.h:39
isc::dhcp::SubnetSubnetIdIndexTag
Tag for the index for searching by subnet identifier.
Definition subnet.h:777
subnet_id.h