Kea 3.3.1
cfg_subnets4.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2026 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/iface_mgr.h>
10#include <dhcpsrv/cfgmgr.h>
12#include <dhcpsrv/dhcpsrv_log.h>
16#include <dhcpsrv/subnet_id.h>
17#include <asiolink/io_address.h>
19#include <stats/stats_mgr.h>
20#include <sstream>
21
22using namespace isc::asiolink;
23using namespace isc::data;
24
25namespace isc {
26namespace dhcp {
27
28void
30 if (getBySubnetId(subnet->getID())) {
31 isc_throw(isc::dhcp::DuplicateSubnetID, "ID of the new IPv4 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
42 .arg(subnet->toText());
43 static_cast<void>(subnets_.insert(subnet));
44}
45
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 IPv4 subnet with ID " <<subnet_id);
54 }
55 Subnet4Ptr old = *subnet_it;
56 bool ret = index.replace(subnet_it, subnet);
57
59 .arg(subnet_id).arg(ret);
60 if (ret) {
61 return (old);
62 } else {
63 return (Subnet4Ptr());
64 }
65}
66
67void
69 del(subnet->getID());
70}
71
72void
73CfgSubnets4::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 Subnet4Ptr subnet = *subnet_it;
82
83 index.erase(subnet_it);
84
86 .arg(subnet->toText());
87}
88
89void
91 CfgSubnets4& 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_id_it = index_id.find(other_subnet->getID());
103 if (subnet_id_it != index_id.end()) {
104
105 // Subnet found.
106 auto existing_subnet = *subnet_id_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 // Updating the prefix can lead to problems... e.g. pools
115 // and reservations going outside range.
116 // @todo: check prefix change.
117
118 // We're going to replace the existing subnet with the other
119 // version. If it belongs to a shared network, we need
120 // remove it from that network.
121 SharedNetwork4Ptr network;
122 existing_subnet->getSharedNetwork(network);
123 if (network) {
124 network->del(existing_subnet->getID());
125 }
126
127 // Now we remove the existing subnet.
128 index_id.erase(subnet_id_it);
129 }
130
131 // Check if there is a subnet with the same prefix.
132 auto subnet_prefix_it = index_prefix.find(other_subnet->toText());
133 if (subnet_prefix_it != index_prefix.end()) {
134
135 // Subnet found.
136 auto existing_subnet = *subnet_prefix_it;
137
138 // Updating the id can lead to problems... e.g. reservation
139 // for the previous subnet ID.
140 // @todo: check reservations
141
142 // We're going to replace the existing subnet with the other
143 // version. If it belongs to a shared network, we need
144 // remove it from that network.
145 SharedNetwork4Ptr network;
146 existing_subnet->getSharedNetwork(network);
147 if (network) {
148 network->del(existing_subnet->getID());
149 }
150
151 // Now we remove the existing subnet.
152 index_prefix.erase(subnet_prefix_it);
153 }
154
155 // Create the subnet's options based on the given definitions.
156 other_subnet->getCfgOption()->createOptions(cfg_def);
157
158 // Encapsulate options, so that the DHCP server can effectively return
159 // them to the clients without having to encapsulate them for each request.
160 other_subnet->getCfgOption()->encapsulate();
161
162 // Create the options for pool based on the given definitions.
163 for (auto const& pool : other_subnet->getPoolsWritable(Lease::TYPE_V4)) {
164 pool->getCfgOption()->createOptions(cfg_def);
165 pool->getCfgOption()->encapsulate();
166 }
167
168 // Add the "other" subnet to the our collection of subnets.
169 static_cast<void>(subnets_.insert(other_subnet));
170
171 // If it belongs to a shared network, find the network and
172 // add the subnet to it
173 std::string network_name = other_subnet->getSharedNetworkName();
174 if (!network_name.empty()) {
175 SharedNetwork4Ptr network = networks->getByName(network_name);
176 if (network) {
177 network->add(other_subnet);
178 } else {
179 // This implies the shared-network collection we were given
180 // is out of sync with the subnets we were given.
181 isc_throw(InvalidOperation, "Cannot assign subnet ID of "
182 << other_subnet->getID()
183 << " to shared network: " << network_name
184 << ", network does not exist");
185 }
186 }
187 // Instantiate the configured allocator and its state.
188 other_subnet->createAllocators();
189 }
190}
191
193CfgSubnets4::getByPrefix(const std::string& subnet_text) const {
194 auto const& index = subnets_.get<SubnetPrefixIndexTag>();
195 auto subnet_it = index.find(subnet_text);
196 return ((subnet_it != index.cend()) ? (*subnet_it) : ConstSubnet4Ptr());
197}
198
199bool
201 auto const& index = subnets_.get<SubnetServerIdIndexTag>();
202 auto subnet_it = index.find(server_id);
203 return (subnet_it != index.cend());
204}
205
208 SubnetSelector selector;
209 selector.ciaddr_ = query->getCiaddr();
210 selector.giaddr_ = query->getGiaddr();
211 selector.local_address_ = query->getLocalAddr();
212 selector.remote_address_ = query->getRemoteAddr();
213 selector.client_classes_ = query->classes_;
214 selector.iface_name_ = query->getIface();
215
216 // If the link-selection sub-option is present, extract its value.
217 // "The link-selection sub-option is used by any DHCP relay agent
218 // that desires to specify a subnet/link for a DHCP client request
219 // that it is relaying but needs the subnet/link specification to
220 // be different from the IP address the DHCP server should use
221 // when communicating with the relay agent." (RFC 3527)
222 //
223 // Try first Relay Agent Link Selection sub-option
224 OptionPtr rai = query->getOption(DHO_DHCP_AGENT_OPTIONS);
225 if (rai) {
226 OptionCustomPtr rai_custom =
227 boost::dynamic_pointer_cast<OptionCustom>(rai);
228 if (rai_custom) {
229 // If Relay Agent Information Link Selection is ignored in the
230 // configuration, skip returning the related subnet selector here,
231 // and move on to normal subnet selection.
232 bool ignore_link_sel = CfgMgr::instance().getCurrentCfg()->
233 getIgnoreRAILinkSelection();
234 if (!ignore_link_sel) {
235 OptionPtr link_select =
236 rai_custom->getOption(RAI_OPTION_LINK_SELECTION);
237 if (link_select) {
238 OptionBuffer link_select_buf = link_select->getData();
239 if (link_select_buf.size() == sizeof(uint32_t)) {
240 selector.option_select_ =
241 IOAddress::fromBytes(AF_INET, &link_select_buf[0]);
242 return (selector);
243 }
244 }
245 }
246 }
247 }
248 // The query does not include a RAI option or that option does
249 // not contain the link-selection sub-option. Try subnet-selection
250 // option.
251 OptionPtr sbnsel = query->getOption(DHO_SUBNET_SELECTION);
252 if (sbnsel) {
253 OptionCustomPtr oc =
254 boost::dynamic_pointer_cast<OptionCustom>(sbnsel);
255 if (oc) {
256 selector.option_select_ = oc->readAddress();
257 }
258 }
259 return (selector);
260}
261
264 for (auto const& subnet : subnets_) {
265 Cfg4o6& cfg4o6 = subnet->get4o6();
266
267 // Is this an 4o6 subnet at all?
268 if (!cfg4o6.enabled()) {
269 continue; // No? Let's try the next one.
270 }
271
272 // Is this subnet guarded?
273 if (!subnet->clientSupported(selector.client_classes_)) {
274 continue; // Guard is not supported: let's try the next one.
275 }
276
277 // First match criteria: check if we have a prefix/len defined.
278 std::pair<asiolink::IOAddress, uint8_t> pref = cfg4o6.getSubnet4o6();
279 if (!pref.first.isV6Zero()) {
280
281 // Let's check if the IPv6 address is in range
282 IOAddress first = firstAddrInPrefix(pref.first, pref.second);
283 IOAddress last = lastAddrInPrefix(pref.first, pref.second);
284 if ((first <= selector.remote_address_) &&
285 (selector.remote_address_ <= last)) {
286 return (subnet);
287 }
288 }
289
290 // Second match criteria: check if the interface-id matches
291 if (cfg4o6.getInterfaceId() && selector.interface_id_ &&
292 cfg4o6.getInterfaceId()->equals(selector.interface_id_)) {
293 return (subnet);
294 }
295
296 // Third match criteria: check if the interface name matches
297 if (!cfg4o6.getIface4o6().empty() && !selector.iface_name_.empty()
298 && cfg4o6.getIface4o6() == selector.iface_name_) {
299 return (subnet);
300 }
301 }
302
304
305 // Ok, wasn't able to find any matching subnet.
306 return (ConstSubnet4Ptr());
307}
308
311 // First use RAI link select sub-option or subnet select option
312 if (!selector.option_select_.isV4Zero()) {
313 return (selectSubnet(selector.option_select_,
314 selector.client_classes_));
315 } else {
318 }
319
320 // If relayed message has been received, try to match the giaddr with the
321 // relay address specified for a subnet and/or shared network. It is also
322 // possible that the relay address will not match with any of the relay
323 // addresses across all subnets, but we need to verify that for all subnets
324 // before we can try to use the giaddr to match with the subnet prefix.
325 if (!selector.giaddr_.isV4Zero()) {
326 for (auto const& subnet : subnets_) {
327
328 // If relay information is specified for this subnet, it must match.
329 // Otherwise, we ignore this subnet.
330 if (subnet->hasRelays()) {
331 if (!subnet->hasRelayAddress(selector.giaddr_)) {
332 continue;
333 }
334 } else {
335 // Relay information is not specified on the subnet level,
336 // so let's try matching on the shared network level.
337 SharedNetwork4Ptr network;
338 subnet->getSharedNetwork(network);
339 if (!network || !(network->hasRelayAddress(selector.giaddr_))) {
340 continue;
341 }
342 }
343
344 // If a subnet meets the client class criteria return it.
345 if (subnet->clientSupported(selector.client_classes_)) {
348 .arg(subnet->toText())
349 .arg(selector.giaddr_.toText());
350 return (subnet);
351 }
352 }
355 .arg(selector.giaddr_.toText());
356 } else {
359 }
360
361 // If we got to this point it means that we were not able to match the
362 // giaddr with any of the addresses specified for subnets. Let's determine
363 // what address from the client's packet to use to match with the
364 // subnets' prefixes.
365
367 // If there is a giaddr, use it for subnet selection.
368 if (!selector.giaddr_.isV4Zero()) {
369 address = selector.giaddr_;
370
371 // If it is a Renew or Rebind, use the ciaddr.
372 } else if (!selector.ciaddr_.isV4Zero() &&
373 !selector.local_address_.isV4Bcast()) {
374 address = selector.ciaddr_;
375
376 // If ciaddr is not specified, use the source address.
377 } else if (!selector.remote_address_.isV4Zero() &&
378 !selector.local_address_.isV4Bcast()) {
379 address = selector.remote_address_;
380
381 // If local interface name is known, use the local address on this
382 // interface.
383 } else if (!selector.iface_name_.empty()) {
385 // This should never happen in the real life. Hence we throw an
386 // exception.
387 if (iface == NULL) {
388 isc_throw(isc::BadValue, "interface " << selector.iface_name_
389 << " doesn't exist and therefore it is impossible"
390 " to find a suitable subnet for its IPv4 address");
391 }
392
393 // Attempt to select subnet based on the interface name.
394 ConstSubnet4Ptr subnet = selectSubnet(selector.iface_name_,
395 selector.client_classes_);
396
397 // If it matches - great. If not, we'll try to use a different
398 // selection criteria below.
399 if (subnet) {
400 return (subnet);
401 } else {
402 // Let's try to get an address from the local interface and
403 // try to match it to defined subnet.
404 iface->getAddress4(address);
405 }
406 }
407
408 // Unable to find a suitable address to use for subnet selection.
409 if (address.isV4Zero()) {
412
413 return (ConstSubnet4Ptr());
414 }
415
416 // We have identified an address in the client's packet that can be
417 // used for subnet selection. Match this packet with the subnets.
418 return (selectSubnet(address, selector.client_classes_));
419}
420
422CfgSubnets4::selectSubnet(const std::string& iface,
423 const ClientClasses& client_classes) const {
424 for (auto const& subnet : subnets_) {
425 ConstSubnet4Ptr subnet_selected;
426
427 // First, try subnet specific interface name.
428 if (!subnet->getIface(Network4::Inheritance::NONE).empty()) {
429 if (subnet->getIface(Network4::Inheritance::NONE) == iface) {
430 subnet_selected = subnet;
431 }
432
433 } else {
434 // Interface not specified for a subnet, so let's try if
435 // we can match with shared network specific setting of
436 // the interface.
437 SharedNetwork4Ptr network;
438 subnet->getSharedNetwork(network);
439 if (network &&
440 (network->getIface(Network4::Inheritance::NONE) == iface)) {
441 subnet_selected = subnet;
442 }
443 }
444
445 if (subnet_selected) {
446 // If a subnet meets the client class criteria return it.
447 if (subnet_selected->clientSupported(client_classes)) {
450 .arg(subnet->toText())
451 .arg(iface);
452 return (subnet_selected);
453 }
454 }
455 }
456
459 .arg(iface);
460
461 // Failed to find a subnet.
462 return (ConstSubnet4Ptr());
463}
464
466CfgSubnets4::getSubnet(const SubnetID subnet_id) const {
467 auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
468 auto subnet_it = index.find(subnet_id);
469 return ((subnet_it != index.cend()) ? (*subnet_it) : Subnet4Ptr());
470}
471
474 const ClientClasses& client_classes) const {
475 for (auto const& subnet : subnets_) {
476
477 // Address is in range for the subnet prefix, so return it.
478 if (!subnet->inRange(address)) {
479 continue;
480 }
481
482 // If a subnet meets the client class criteria return it.
483 if (subnet->clientSupported(client_classes)) {
485 .arg(subnet->toText())
486 .arg(address.toText());
487 return (subnet);
488 }
489 }
490
493 .arg(address.toText());
494
495 // Failed to find a subnet.
496 return (ConstSubnet4Ptr());
497}
498
500CfgSubnets4::getLinks(const IOAddress& link_addr) const {
501 SubnetIDSet links;
502 for (auto const& subnet : subnets_) {
503 if (!subnet->inRange(link_addr)) {
504 continue;
505 }
506 links.insert(subnet->getID());
507 }
508 return (links);
509}
510
511void
513 using namespace isc::stats;
514
515 // For each v4 subnet currently configured, remove the statistic.
516 StatsMgr& stats_mgr = StatsMgr::instance();
517 for (auto const& subnet4 : subnets_) {
518 SubnetID subnet_id = subnet4->getID();
519 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
520 "total-addresses"));
521
522 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
523 "assigned-addresses"));
524
525 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
526 "cumulative-assigned-addresses"));
527
528 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
529 "declined-addresses"));
530
531 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
532 "reclaimed-declined-addresses"));
533
534 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
535 "reclaimed-leases"));
536
537 for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
538 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
539 StatsMgr::generateName("pool", pool->getID(),
540 "total-addresses")));
541
542 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
543 StatsMgr::generateName("pool", pool->getID(),
544 "assigned-addresses")));
545
546 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
547 StatsMgr::generateName("pool", pool->getID(),
548 "cumulative-assigned-addresses")));
549
550 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
551 StatsMgr::generateName("pool", pool->getID(),
552 "declined-addresses")));
553
554 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
555 StatsMgr::generateName("pool", pool->getID(),
556 "reclaimed-declined-addresses")));
557
558 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
559 StatsMgr::generateName("pool", pool->getID(),
560 "reclaimed-leases")));
561 }
562 }
563}
564
565void
567 using namespace isc::stats;
568
569 StatsMgr& stats_mgr = StatsMgr::instance();
570 for (auto const& subnet4 : subnets_) {
571 SubnetID subnet_id = subnet4->getID();
572
573 stats_mgr.setValue(StatsMgr::
574 generateName("subnet", subnet_id, "total-addresses"),
575 int64_t(subnet4->getPoolCapacity(Lease::TYPE_V4)));
576 const std::string& name(StatsMgr::generateName("subnet", subnet_id,
577 "cumulative-assigned-addresses"));
578 if (!stats_mgr.getObservation(name)) {
579 stats_mgr.setValue(name, static_cast<int64_t>(0));
580 }
581
582 const std::string& name_reuses(StatsMgr::generateName("subnet", subnet_id,
583 "v4-lease-reuses"));
584 if (!stats_mgr.getObservation(name_reuses)) {
585 stats_mgr.setValue(name_reuses, int64_t(0));
586 }
587
588 const std::string& name_conflicts(StatsMgr::generateName("subnet", subnet_id,
589 "v4-reservation-conflicts"));
590 if (!stats_mgr.getObservation(name_conflicts)) {
591 stats_mgr.setValue(name_conflicts, static_cast<int64_t>(0));
592 }
593
594 for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
595 const std::string& name_total(StatsMgr::generateName("subnet", subnet_id,
596 StatsMgr::generateName("pool", pool->getID(),
597 "total-addresses")));
598 if (!stats_mgr.getObservation(name_total)) {
599 stats_mgr.setValue(name_total, static_cast<int64_t>(pool->getCapacity()));
600 } else {
601 stats_mgr.addValue(name_total, static_cast<int64_t>(pool->getCapacity()));
602 }
603
604 const std::string& name_ca(StatsMgr::generateName("subnet", subnet_id,
605 StatsMgr::generateName("pool", pool->getID(),
606 "cumulative-assigned-addresses")));
607 if (!stats_mgr.getObservation(name_ca)) {
608 stats_mgr.setValue(name_ca, static_cast<int64_t>(0));
609 }
610 }
611 }
612
613 // Only recount the stats if we have subnets.
614 if (subnets_.begin() != subnets_.end()) {
616 }
617}
618
619void
622 for (auto const& subnet : subnets_) {
623 subnet->initAllocatorsAfterConfigure();
624 }
625}
626
627void
629 subnets_.clear();
630}
631
635 // Iterate subnets
636 for (auto const& subnet : subnets_) {
637 result->add(subnet->toElement());
638 }
639 return (result);
640}
641
642} // end of namespace isc::dhcp
643} // end of namespace isc
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a function is called in a prohibited way.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:350
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition cfgmgr.cc:29
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
Definition cfgmgr.cc:116
Holds subnets configured for the DHCPv4 server.
ConstSubnet4Ptr getBySubnetId(const SubnetID &subnet_id) const
Returns const pointer to a subnet identified by the specified subnet identifier.
SubnetIDSet getLinks(const asiolink::IOAddress &link_addr) const
Convert a link address into a link set.
ConstSubnet4Ptr selectSubnet(const SubnetSelector &selector) const
Returns a pointer to the selected subnet.
void del(const ConstSubnet4Ptr &subnet)
Removes subnet from the configuration.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
void clear()
Clears all subnets from the configuration.
bool hasSubnetWithServerId(const asiolink::IOAddress &server_id) const
Checks if specified server identifier has been specified for any subnet.
ConstSubnet4Ptr getByPrefix(const std::string &subnet_prefix) const
Returns const pointer to a subnet which matches the specified prefix in the canonical form.
void updateStatistics()
Updates statistics.
void merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks4Ptr networks, CfgSubnets4 &other)
Merges specified subnet configuration into this configuration.
ConstSubnet4Ptr selectSubnet4o6(const SubnetSelector &selector) const
Attempts to do subnet selection based on DHCP4o6 information.
Subnet4Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
Subnet4Ptr replace(const Subnet4Ptr &subnet)
Replaces subnet in the configuration.
void initAllocatorsAfterConfigure()
Calls initAllocatorsAfterConfigure for each subnet.
void add(const Subnet4Ptr &subnet)
Adds new subnet to the configuration.
void removeStatistics()
Removes statistics.
const Subnet4Collection * getAll() const
Returns pointer to the collection of all IPv4 subnets.
static SubnetSelector initSelector(const Pkt4Ptr &query)
Build selector from a client's message.
Container for storing client class names.
Definition classify.h:111
Exception thrown upon attempt to add subnet with an ID that belongs to the subnet that already exists...
Definition subnet_id.h:36
IfacePtr getIface(const unsigned int ifindex)
Returns interface specified interface index.
Definition iface_mgr.cc:937
static IfaceMgr & instance()
IfaceMgr is a singleton class.
Definition iface_mgr.cc:52
static TrackingLeaseMgr & instance()
Return current lease manager.
void recountLeaseStats4()
Recalculates per-subnet and global stats for IPv4 leases.
Definition lease_mgr.cc:78
static void setInUse(bool in_use)
Sets the global in-use flag.
Statistics Manager class.
ObservationPtr getObservation(const std::string &name) const
Returns an observation.
static StatsMgr & instance()
Statistics Manager accessor method.
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
bool empty() const
Specialization of the Optional::empty method for strings.
Definition optional.h:188
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
bool del(const std::string &name)
Removes specified statistic.
void setValue(const std::string &name, const int64_t value)
Records absolute integer observation.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
int get(CalloutHandle &handle)
The gss-tsig-get command.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition macros.h:14
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
Definition dhcpsrv_log.h:56
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_INTERFACE_NO_MATCH
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_ADDRESS_NO_MATCH
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET4_IFACE
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition subnet.h:458
std::set< dhcp::SubnetID > SubnetIDSet
Ordered list aka set of subnetIDs.
Definition subnet_id.h:43
const isc::log::MessageID DHCPSRV_CFGMGR_UPDATE_SUBNET4
const isc::log::MessageID DHCPSRV_CFGMGR_ADD_SUBNET4
@ DHO_DHCP_AGENT_OPTIONS
Definition dhcp4.h:151
@ DHO_SUBNET_SELECTION
Definition dhcp4.h:182
const isc::log::MessageID DHCPSRV_SUBNET4O6_SELECT_FAILED
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:455
boost::shared_ptr< OptionCustom > OptionCustomPtr
A pointer to the OptionCustom object.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition pkt4.h:556
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
boost::shared_ptr< Iface > IfacePtr
Type definition for the pointer to an Iface object.
Definition iface_mgr.h:555
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_NO_RELAY_ADDRESS
const isc::log::MessageID DHCPSRV_CFGMGR_DEL_SUBNET4
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_NO_USABLE_ADDRESS
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET4_ADDR
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_NO_RAI_OPTIONS
const isc::log::MessageID DHCPSRV_CFGMGR_SUBNET4_RELAY
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
const isc::log::MessageID DHCPSRV_SUBNET4_SELECT_BY_RELAY_ADDRESS_NO_MATCH
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Definition option.h:24
boost::shared_ptr< CfgSharedNetworks4 > CfgSharedNetworks4Ptr
Pointer to the configuration of IPv4 shared networks.
@ RAI_OPTION_LINK_SELECTION
Definition dhcp4.h:269
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
Definition dhcpsrv_log.h:26
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
Defines the logger used by the top-level component of kea-lfc.
This structure contains information about DHCP4o6 (RFC7341).
Definition cfg_4o6.h:22
util::Optional< std::string > getIface4o6() const
Returns the DHCP4o6 interface.
Definition cfg_4o6.h:45
util::Optional< std::pair< asiolink::IOAddress, uint8_t > > getSubnet4o6() const
Returns prefix/len for the IPv6 subnet.
Definition cfg_4o6.h:58
bool enabled() const
Returns whether the DHCP4o6 is enabled or not.
Definition cfg_4o6.h:33
OptionPtr getInterfaceId() const
Returns the interface-id.
Definition cfg_4o6.h:72
@ TYPE_V4
IPv4 lease.
Definition lease.h:50
Tag for the index for searching by subnet prefix.
Definition subnet.h:777
Subnet selector used to specify parameters used to select a subnet.
asiolink::IOAddress local_address_
Address on which the message was received.
asiolink::IOAddress option_select_
RAI link select or subnet select option.
std::string iface_name_
Name of the interface on which the message was received.
asiolink::IOAddress ciaddr_
ciaddr from the client's message.
ClientClasses client_classes_
Classes that the client belongs to.
asiolink::IOAddress remote_address_
Source address of the message.
OptionPtr interface_id_
Interface id option.
asiolink::IOAddress giaddr_
giaddr from the client's message.
Tag for the index for searching by server identifier.
Definition subnet.h:780
Tag for the index for searching by subnet identifier.
Definition subnet.h:774