Kea 3.1.8
cfg_subnets4.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2024 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 // First match criteria: check if we have a prefix/len defined.
273 std::pair<asiolink::IOAddress, uint8_t> pref = cfg4o6.getSubnet4o6();
274 if (!pref.first.isV6Zero()) {
275
276 // Let's check if the IPv6 address is in range
277 IOAddress first = firstAddrInPrefix(pref.first, pref.second);
278 IOAddress last = lastAddrInPrefix(pref.first, pref.second);
279 if ((first <= selector.remote_address_) &&
280 (selector.remote_address_ <= last)) {
281 return (subnet);
282 }
283 }
284
285 // Second match criteria: check if the interface-id matches
286 if (cfg4o6.getInterfaceId() && selector.interface_id_ &&
287 cfg4o6.getInterfaceId()->equals(selector.interface_id_)) {
288 return (subnet);
289 }
290
291 // Third match criteria: check if the interface name matches
292 if (!cfg4o6.getIface4o6().empty() && !selector.iface_name_.empty()
293 && cfg4o6.getIface4o6() == selector.iface_name_) {
294 return (subnet);
295 }
296 }
297
299
300 // Ok, wasn't able to find any matching subnet.
301 return (ConstSubnet4Ptr());
302}
303
306 // First use RAI link select sub-option or subnet select option
307 if (!selector.option_select_.isV4Zero()) {
308 return (selectSubnet(selector.option_select_,
309 selector.client_classes_));
310 } else {
313 }
314
315 // If relayed message has been received, try to match the giaddr with the
316 // relay address specified for a subnet and/or shared network. It is also
317 // possible that the relay address will not match with any of the relay
318 // addresses across all subnets, but we need to verify that for all subnets
319 // before we can try to use the giaddr to match with the subnet prefix.
320 if (!selector.giaddr_.isV4Zero()) {
321 for (auto const& subnet : subnets_) {
322
323 // If relay information is specified for this subnet, it must match.
324 // Otherwise, we ignore this subnet.
325 if (subnet->hasRelays()) {
326 if (!subnet->hasRelayAddress(selector.giaddr_)) {
327 continue;
328 }
329 } else {
330 // Relay information is not specified on the subnet level,
331 // so let's try matching on the shared network level.
332 SharedNetwork4Ptr network;
333 subnet->getSharedNetwork(network);
334 if (!network || !(network->hasRelayAddress(selector.giaddr_))) {
335 continue;
336 }
337 }
338
339 // If a subnet meets the client class criteria return it.
340 if (subnet->clientSupported(selector.client_classes_)) {
343 .arg(subnet->toText())
344 .arg(selector.giaddr_.toText());
345 return (subnet);
346 }
347 }
350 .arg(selector.giaddr_.toText());
351 } else {
354 }
355
356 // If we got to this point it means that we were not able to match the
357 // giaddr with any of the addresses specified for subnets. Let's determine
358 // what address from the client's packet to use to match with the
359 // subnets' prefixes.
360
362 // If there is a giaddr, use it for subnet selection.
363 if (!selector.giaddr_.isV4Zero()) {
364 address = selector.giaddr_;
365
366 // If it is a Renew or Rebind, use the ciaddr.
367 } else if (!selector.ciaddr_.isV4Zero() &&
368 !selector.local_address_.isV4Bcast()) {
369 address = selector.ciaddr_;
370
371 // If ciaddr is not specified, use the source address.
372 } else if (!selector.remote_address_.isV4Zero() &&
373 !selector.local_address_.isV4Bcast()) {
374 address = selector.remote_address_;
375
376 // If local interface name is known, use the local address on this
377 // interface.
378 } else if (!selector.iface_name_.empty()) {
380 // This should never happen in the real life. Hence we throw an
381 // exception.
382 if (iface == NULL) {
383 isc_throw(isc::BadValue, "interface " << selector.iface_name_
384 << " doesn't exist and therefore it is impossible"
385 " to find a suitable subnet for its IPv4 address");
386 }
387
388 // Attempt to select subnet based on the interface name.
389 ConstSubnet4Ptr subnet = selectSubnet(selector.iface_name_,
390 selector.client_classes_);
391
392 // If it matches - great. If not, we'll try to use a different
393 // selection criteria below.
394 if (subnet) {
395 return (subnet);
396 } else {
397 // Let's try to get an address from the local interface and
398 // try to match it to defined subnet.
399 iface->getAddress4(address);
400 }
401 }
402
403 // Unable to find a suitable address to use for subnet selection.
404 if (address.isV4Zero()) {
407
408 return (ConstSubnet4Ptr());
409 }
410
411 // We have identified an address in the client's packet that can be
412 // used for subnet selection. Match this packet with the subnets.
413 return (selectSubnet(address, selector.client_classes_));
414}
415
417CfgSubnets4::selectSubnet(const std::string& iface,
418 const ClientClasses& client_classes) const {
419 for (auto const& subnet : subnets_) {
420 ConstSubnet4Ptr subnet_selected;
421
422 // First, try subnet specific interface name.
423 if (!subnet->getIface(Network4::Inheritance::NONE).empty()) {
424 if (subnet->getIface(Network4::Inheritance::NONE) == iface) {
425 subnet_selected = subnet;
426 }
427
428 } else {
429 // Interface not specified for a subnet, so let's try if
430 // we can match with shared network specific setting of
431 // the interface.
432 SharedNetwork4Ptr network;
433 subnet->getSharedNetwork(network);
434 if (network &&
435 (network->getIface(Network4::Inheritance::NONE) == iface)) {
436 subnet_selected = subnet;
437 }
438 }
439
440 if (subnet_selected) {
441 // If a subnet meets the client class criteria return it.
442 if (subnet_selected->clientSupported(client_classes)) {
445 .arg(subnet->toText())
446 .arg(iface);
447 return (subnet_selected);
448 }
449 }
450 }
451
454 .arg(iface);
455
456 // Failed to find a subnet.
457 return (ConstSubnet4Ptr());
458}
459
461CfgSubnets4::getSubnet(const SubnetID subnet_id) const {
462 auto const& index = subnets_.get<SubnetSubnetIdIndexTag>();
463 auto subnet_it = index.find(subnet_id);
464 return ((subnet_it != index.cend()) ? (*subnet_it) : Subnet4Ptr());
465}
466
469 const ClientClasses& client_classes) const {
470 for (auto const& subnet : subnets_) {
471
472 // Address is in range for the subnet prefix, so return it.
473 if (!subnet->inRange(address)) {
474 continue;
475 }
476
477 // If a subnet meets the client class criteria return it.
478 if (subnet->clientSupported(client_classes)) {
480 .arg(subnet->toText())
481 .arg(address.toText());
482 return (subnet);
483 }
484 }
485
488 .arg(address.toText());
489
490 // Failed to find a subnet.
491 return (ConstSubnet4Ptr());
492}
493
495CfgSubnets4::getLinks(const IOAddress& link_addr) const {
496 SubnetIDSet links;
497 for (auto const& subnet : subnets_) {
498 if (!subnet->inRange(link_addr)) {
499 continue;
500 }
501 links.insert(subnet->getID());
502 }
503 return (links);
504}
505
506void
508 using namespace isc::stats;
509
510 // For each v4 subnet currently configured, remove the statistic.
511 StatsMgr& stats_mgr = StatsMgr::instance();
512 for (auto const& subnet4 : subnets_) {
513 SubnetID subnet_id = subnet4->getID();
514 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
515 "total-addresses"));
516
517 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
518 "assigned-addresses"));
519
520 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
521 "cumulative-assigned-addresses"));
522
523 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
524 "declined-addresses"));
525
526 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
527 "reclaimed-declined-addresses"));
528
529 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
530 "reclaimed-leases"));
531
532 for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
533 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
534 StatsMgr::generateName("pool", pool->getID(),
535 "total-addresses")));
536
537 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
538 StatsMgr::generateName("pool", pool->getID(),
539 "assigned-addresses")));
540
541 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
542 StatsMgr::generateName("pool", pool->getID(),
543 "cumulative-assigned-addresses")));
544
545 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
546 StatsMgr::generateName("pool", pool->getID(),
547 "declined-addresses")));
548
549 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
550 StatsMgr::generateName("pool", pool->getID(),
551 "reclaimed-declined-addresses")));
552
553 stats_mgr.del(StatsMgr::generateName("subnet", subnet_id,
554 StatsMgr::generateName("pool", pool->getID(),
555 "reclaimed-leases")));
556 }
557 }
558}
559
560void
562 using namespace isc::stats;
563
564 StatsMgr& stats_mgr = StatsMgr::instance();
565 for (auto const& subnet4 : subnets_) {
566 SubnetID subnet_id = subnet4->getID();
567
568 stats_mgr.setValue(StatsMgr::
569 generateName("subnet", subnet_id, "total-addresses"),
570 int64_t(subnet4->getPoolCapacity(Lease::TYPE_V4)));
571 const std::string& name(StatsMgr::generateName("subnet", subnet_id,
572 "cumulative-assigned-addresses"));
573 if (!stats_mgr.getObservation(name)) {
574 stats_mgr.setValue(name, static_cast<int64_t>(0));
575 }
576
577 const std::string& name_reuses(StatsMgr::generateName("subnet", subnet_id,
578 "v4-lease-reuses"));
579 if (!stats_mgr.getObservation(name_reuses)) {
580 stats_mgr.setValue(name_reuses, int64_t(0));
581 }
582
583 const std::string& name_conflicts(StatsMgr::generateName("subnet", subnet_id,
584 "v4-reservation-conflicts"));
585 if (!stats_mgr.getObservation(name_conflicts)) {
586 stats_mgr.setValue(name_conflicts, static_cast<int64_t>(0));
587 }
588
589 for (auto const& pool : subnet4->getPools(Lease::TYPE_V4)) {
590 const std::string& name_total(StatsMgr::generateName("subnet", subnet_id,
591 StatsMgr::generateName("pool", pool->getID(),
592 "total-addresses")));
593 if (!stats_mgr.getObservation(name_total)) {
594 stats_mgr.setValue(name_total, static_cast<int64_t>(pool->getCapacity()));
595 } else {
596 stats_mgr.addValue(name_total, static_cast<int64_t>(pool->getCapacity()));
597 }
598
599 const std::string& name_ca(StatsMgr::generateName("subnet", subnet_id,
600 StatsMgr::generateName("pool", pool->getID(),
601 "cumulative-assigned-addresses")));
602 if (!stats_mgr.getObservation(name_ca)) {
603 stats_mgr.setValue(name_ca, static_cast<int64_t>(0));
604 }
605 }
606 }
607
608 // Only recount the stats if we have subnets.
609 if (subnets_.begin() != subnets_.end()) {
611 }
612}
613
614void
617 for (auto const& subnet : subnets_) {
618 subnet->initAllocatorsAfterConfigure();
619 }
620}
621
622void
624 subnets_.clear();
625}
626
630 // Iterate subnets
631 for (auto const& subnet : subnets_) {
632 result->add(subnet->toElement());
633 }
634 return (result);
635}
636
637} // end of namespace isc::dhcp
638} // 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:349
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:110
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:900
static IfaceMgr & instance()
IfaceMgr is a singleton class.
Definition iface_mgr.cc:49
static TrackingLeaseMgr & instance()
Return current lease manager.
void recountLeaseStats4()
Recalculates per-subnet and global stats for IPv4 leases.
Definition lease_mgr.cc:75
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:175
#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:461
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:458
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:544
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:780
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:783
Tag for the index for searching by subnet identifier.
Definition subnet.h:777