Kea: pool.cc Source File

| Kea 3.0.0

pool.cc
Go to the documentation of this file.
1// Copyright (C) 2012-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
9#include <asiolink/io_address.h>
10#include <asiolink/addr_utilities.h>
11#include <dhcpsrv/pool.h>
12#include <boost/make_shared.hpp>
13#include <sstream>
14
15using namespace isc::asiolink;
16using namespace isc::data;
17
18namespace isc {
19namespace dhcp {
20
21Pool::Pool(Lease::Type type, const isc::asiolink::IOAddress& first,
22 const isc::asiolink::IOAddress& last)
23 : id_(0), first_(first), last_(last), type_(type), capacity_(0),
24 cfg_option_(new CfgOption()) {
25}
26
27bool
28Pool::inRange(const isc::asiolink::IOAddress& addr) const {
29 return (first_ <= addr && addr <= last_);
30}
31
32bool
33Pool::clientSupported(const ClientClasses& classes) const {
34 return (client_classes_.empty() || client_classes_.intersects(classes));
35}
36
37void
38Pool::allowClientClass(const ClientClass& class_name) {
39 if (!client_classes_.contains(class_name)) {
40 client_classes_.insert(class_name);
41 }
42}
43
44void
45Pool::addAdditionalClass(const isc::dhcp::ClientClass& class_name) {
46 if (!additional_classes_.contains(class_name)) {
47 additional_classes_.insert(class_name);
48 }
49}
50
51std::string
52Pool::toText() const {
53 std::stringstream tmp;
54 tmp << "type=" << Lease::typeToText(type_) << ", " << first_
55 << "-" << last_;
56 return (tmp.str());
57}
58
59bool
60Pool::hasDdnsParameters() const {
61 return (!(ddns_send_updates_.unspecified() &&
62 ddns_override_no_update_.unspecified() &&
63 ddns_override_client_update_.unspecified() &&
64 ddns_replace_client_name_mode_.unspecified() &&
65 ddns_generated_prefix_.unspecified() &&
66 ddns_qualifying_suffix_.unspecified() &&
67 ddns_update_on_renew_.unspecified() &&
68 ddns_conflict_resolution_mode_.unspecified() &&
69 ddns_ttl_percent_.unspecified() &&
70 ddns_ttl_.unspecified() &&
71 ddns_ttl_min_.unspecified() &&
72 ddns_ttl_max_.unspecified() &&
73 hostname_char_set_.unspecified() &&
74 hostname_char_replacement_.unspecified()));
75}
76
77Pool4::Pool4(const isc::asiolink::IOAddress& first,
78 const isc::asiolink::IOAddress& last)
79 : Pool(Lease::TYPE_V4, first, last) {
80 // check if specified address boundaries are sane
81 if (!first.isV4() || !last.isV4()) {
82 isc_throw(BadValue, "Invalid Pool4 address boundaries: not IPv4");
83 }
84
85 if (last < first) {
86 isc_throw(BadValue, "Upper boundary is smaller than lower boundary.");
87 }
88
89 // This is IPv4 pool, which only has one type. We can calculate
90 // the number of theoretically possible leases in it. As there's 2^32
91 // possible IPv4 addresses, we'll be able to accurately store that
92 // info.
93 capacity_ = addrsInRange(first, last);
94}
95
96 Pool4::Pool4(const isc::asiolink::IOAddress& prefix, uint8_t prefix_len)
97 : Pool(Lease::TYPE_V4, prefix, IOAddress("0.0.0.0")) {
98
99 // check if the prefix is sane
100 if (!prefix.isV4()) {
101 isc_throw(BadValue, "Invalid Pool4 address boundaries: not IPv4");
102 }
103
104 // check if the prefix length is sane
105 if (prefix_len == 0 || prefix_len > 32) {
106 isc_throw(BadValue, "Invalid prefix length");
107 }
108
109 IOAddress first_address = firstAddrInPrefix(prefix, prefix_len);
110 if (first_address != prefix) {
111 isc_throw(BadValue, "Invalid Pool4 address boundaries: " << prefix
112 << " is not the first address in prefix: " << first_address
113 << "/" << static_cast<uint32_t>(prefix_len));
114 }
115
116 // Let's now calculate the last address in defined pool
117 last_ = lastAddrInPrefix(prefix, prefix_len);
118
119 // This is IPv4 pool, which only has one type. We can calculate
120 // the number of theoretically possible leases in it. As there's 2^32
121 // possible IPv4 addresses, we'll be able to accurately store that
122 // info.
123 capacity_ = addrsInRange(prefix, last_);
124}
125
126 Pool4Ptr
127Pool4::create(const IOAddress& first, const IOAddress& last) {
128 return (boost::make_shared<Pool4>(first, last));
129}
130
131 Pool4Ptr
132 Pool4::create(const IOAddress& prefix, uint8_t prefix_len) {
133 return (boost::make_shared<Pool4>(prefix, prefix_len));
134}
135
136 data::ElementPtr
137Pool::toElement() const {
138 // Prepare the map
139 ElementPtr map = Element::createMap();
140
141 // Set user-context
142 contextToElement(map);
143
144 // Set pool options
145 ConstCfgOptionPtr opts = getCfgOption();
146 map->set("option-data", opts->toElement());
147
148 // Set client-classes
149 if (!client_classes_.empty()) {
150 map->set("client-classes", client_classes_.toElement());
151 }
152
153 // Set evaluate-additional-classes
154 if (!additional_classes_.empty()) {
155 map->set("evaluate-additional-classes",
156 additional_classes_.toElement());
157 }
158
159 if (id_) {
160 map->set("pool-id", Element::create(static_cast<long long>(id_)));
161 }
162
163 // Add in DDNS parameters for non-prefix pools.
164 if (type_ != Lease::TYPE_PD) {
165 if (!ddns_send_updates_.unspecified()) {
166 map->set("ddns-send-updates", Element::create(ddns_send_updates_));
167 }
168
169 if (!ddns_override_no_update_.unspecified()) {
170 map->set("ddns-override-no-update", Element::create(ddns_override_no_update_));
171 }
172
173 if (!ddns_override_client_update_.unspecified()) {
174 map->set("ddns-override-client-update", Element::create(ddns_override_client_update_));
175 }
176
177 if (!ddns_replace_client_name_mode_.unspecified()) {
178 map->set("ddns-replace-client-name",
179 Element::create(D2ClientConfig::
180 replaceClientNameModeToString(ddns_replace_client_name_mode_)));
181 }
182
183 if (!ddns_generated_prefix_.unspecified()) {
184 map->set("ddns-generated-prefix", Element::create(ddns_generated_prefix_));
185 }
186
187 if (!ddns_qualifying_suffix_.unspecified()) {
188 map->set("ddns-qualifying-suffix", Element::create(ddns_qualifying_suffix_));
189 }
190
191 if (!ddns_update_on_renew_.unspecified()) {
192 map->set("ddns-update-on-renew", Element::create(ddns_update_on_renew_));
193 }
194
195 if (!ddns_conflict_resolution_mode_.unspecified()) {
196 map->set("ddns-conflict-resolution-mode", Element::create(ddns_conflict_resolution_mode_));
197 }
198
199 if (!ddns_ttl_percent_.unspecified()) {
200 map->set("ddns-ttl-percent", Element::create(ddns_ttl_percent_));
201 }
202
203 if (!ddns_ttl_.unspecified()) {
204 map->set("ddns-ttl", Element::create(ddns_ttl_));
205 }
206
207 if (!ddns_ttl_min_.unspecified()) {
208 map->set("ddns-ttl-min", Element::create(ddns_ttl_min_));
209 }
210
211 if (!ddns_ttl_max_.unspecified()) {
212 map->set("ddns-ttl-max", Element::create(ddns_ttl_max_));
213 }
214
215 if (!hostname_char_set_.unspecified()) {
216 map->set("hostname-char-set", Element::create(hostname_char_set_));
217 }
218
219 if (!hostname_char_replacement_.unspecified()) {
220 map->set("hostname-char-replacement", Element::create(hostname_char_replacement_));
221 }
222 }
223
224 return (map);
225}
226
227 data::ElementPtr
228Pool4::toElement() const {
229 // Prepare the map
230 ElementPtr map = Pool::toElement();
231
232 // Set pool
233 const IOAddress& first = getFirstAddress();
234 const IOAddress& last = getLastAddress();
235 std::string range = first.toText() + "-" + last.toText();
236
237 // Try to output a prefix (vs a range)
238 int prefix_len = prefixLengthFromRange(first, last);
239 if (prefix_len >= 0) {
240 std::ostringstream oss;
241 oss << first.toText() << "/" << prefix_len;
242 range = oss.str();
243 }
244
245 map->set("pool", Element::create(range));
246 return (map);
247}
248
249Pool6::Pool6(Lease::Type type, const isc::asiolink::IOAddress& first,
250 const isc::asiolink::IOAddress& last)
251 : Pool(type, first, last), prefix_len_(128), pd_exclude_option_() {
252
253 // check if specified address boundaries are sane
254 if (!first.isV6() || !last.isV6()) {
255 isc_throw(BadValue, "Invalid Pool6 address boundaries: not IPv6");
256 }
257
258 if ((type != Lease::TYPE_NA) && (type != Lease::TYPE_TA) &&
259 (type != Lease::TYPE_PD)) {
260 isc_throw(BadValue, "Invalid Pool6 type: " << static_cast<int>(type)
261 << ", must be TYPE_IA, TYPE_TA or TYPE_PD");
262 }
263
264 if (last < first) {
265 isc_throw(BadValue, "Upper boundary is smaller than lower boundary.");
266 // This check is a bit strict. If we decide that it is too strict,
267 // we need to comment it and uncomment lines below.
268 // On one hand, letting the user specify 2001::f - 2001::1 is nice, but
269 // on the other hand, 2001::1 may be a typo and the user really meant
270 // 2001::1:0 (or 1 followed by some hex digit), so a at least a warning
271 // would be useful.
272
273 // first_ = last;
274 // last_ = first;
275 }
276
277 // TYPE_PD is not supported by this constructor. first-last style
278 // parameters are for IA and TA only. There is another dedicated
279 // constructor for that (it uses prefix/length)
280 if ((type != Lease::TYPE_NA) && (type != Lease::TYPE_TA)) {
281 isc_throw(BadValue, "Invalid Pool6 type specified: "
282 << static_cast<int>(type));
283 }
284
285 // Let's calculate the theoretical number of leases in this pool.
286 // If the pool is extremely large (i.e. contains more than 2^64 addresses,
287 // we'll just cap it at max value of uint64_t).
288 capacity_ = addrsInRange(first, last);
289}
290
291 Pool6::Pool6(Lease::Type type, const isc::asiolink::IOAddress& prefix,
292 const uint8_t prefix_len, const uint8_t delegated_len /* = 128 */)
293 : Pool(type, prefix, IOAddress::IPV6_ZERO_ADDRESS()),
294 prefix_len_(delegated_len), pd_exclude_option_() {
295
296 init(type, prefix, prefix_len, delegated_len,
297 IOAddress::IPV6_ZERO_ADDRESS(), 0);
298}
299
300 Pool6::Pool6(const asiolink::IOAddress& prefix, const uint8_t prefix_len,
301 const uint8_t delegated_len,
302 const asiolink::IOAddress& excluded_prefix,
303 const uint8_t excluded_prefix_len)
304 : Pool(Lease::TYPE_PD, prefix, IOAddress::IPV6_ZERO_ADDRESS()),
305 prefix_len_(delegated_len), pd_exclude_option_() {
306
307 init(Lease::TYPE_PD, prefix, prefix_len, delegated_len, excluded_prefix,
308 excluded_prefix_len);
309
310 // The excluded prefix can only be specified using this constructor.
311 // Therefore, the initialization of the excluded prefix is takes place
312 // here, rather than in the init(...) function.
313 if (!excluded_prefix.isV6()) {
314 isc_throw(BadValue, "excluded prefix must be an IPv6 prefix");
315 }
316
317 // An "unspecified" prefix should have both value and length equal to 0.
318 if ((excluded_prefix.isV6Zero() && (excluded_prefix_len != 0)) ||
319 (!excluded_prefix.isV6Zero() && (excluded_prefix_len == 0))) {
320 isc_throw(BadValue, "invalid excluded prefix "
321 << excluded_prefix << "/"
322 << static_cast<unsigned>(excluded_prefix_len));
323 }
324
325 // If excluded prefix has been specified.
326 if (!excluded_prefix.isV6Zero() && (excluded_prefix_len != 0)) {
327 // Excluded prefix length must not be greater than 128.
328 if (excluded_prefix_len > 128) {
329 isc_throw(BadValue, "excluded prefix length "
330 << static_cast<unsigned>(excluded_prefix_len)
331 << " must not be greater than 128");
332 }
333
334 // Excluded prefix must be a sub-prefix of a delegated prefix. First
335 // check the prefix length as it is less involved.
336 if (excluded_prefix_len <= prefix_len_) {
337 isc_throw(BadValue, "excluded prefix length "
338 << static_cast<unsigned>(excluded_prefix_len)
339 << " must be longer than the delegated prefix length "
340 << static_cast<unsigned>(prefix_len_));
341 }
342
348 }
349}
350
351 Pool6Ptr
352Pool6::create(Lease::Type type, const IOAddress& first, const IOAddress& last) {
353 return (boost::make_shared<Pool6>(type, first, last));
354}
355
356 Pool6Ptr
357 Pool6::create(Lease::Type type, const IOAddress& prefix,
358 uint8_t prefix_len, uint8_t delegated_len) {
359 return (boost::make_shared<Pool6>(type, prefix, prefix_len, delegated_len));
360}
361
362 Pool6Ptr
363 Pool6::create(const IOAddress& prefix, const uint8_t prefix_len,
364 const uint8_t delegated_len, const IOAddress& excluded_prefix,
365 const uint8_t excluded_prefix_len) {
366 return (boost::make_shared<Pool6>(prefix, prefix_len,
367 delegated_len, excluded_prefix,
368 excluded_prefix_len));
369}
370
371void
372Pool6::init(const Lease::Type& type,
373 const asiolink::IOAddress& prefix,
374 const uint8_t prefix_len,
375 const uint8_t delegated_len,
376 const asiolink::IOAddress& excluded_prefix,
377 const uint8_t excluded_prefix_len) {
378 // Check if the prefix is sane
379 if (!prefix.isV6()) {
380 isc_throw(BadValue, "Invalid Pool6 address boundaries: not IPv6");
381 }
382
383 // Check if the prefix length is sane
384 if (prefix_len == 0 || prefix_len > 128) {
385 isc_throw(BadValue, "Invalid prefix length: "
386 << static_cast<unsigned>(prefix_len));
387 }
388
389 if (prefix_len > delegated_len) {
390 isc_throw(BadValue, "Delegated length ("
391 << static_cast<int>(delegated_len)
392 << ") must be longer than or equal to prefix length ("
393 << static_cast<int>(prefix_len) << ")");
394 }
395
396 if ((type != Lease::TYPE_PD) && (delegated_len != 128)) {
397 isc_throw(BadValue, "For NA or TA pools, delegated prefix length must"
398 << " be 128.");
399 }
400
401 // excluded_prefix_len == 0 means there's no excluded prefix at all.
402 if (excluded_prefix_len && (excluded_prefix_len <= delegated_len)) {
403 isc_throw(BadValue, "Excluded prefix ("
404 << static_cast<int>(excluded_prefix_len)
405 << ") must be longer than the delegated prefix length ("
406 << static_cast<int>(delegated_len) << ")");
407 }
408
409 if (prefix_len != 128) {
410 IOAddress first_address = firstAddrInPrefix(prefix, prefix_len);
411 if (first_address != prefix) {
412 isc_throw(BadValue, "Invalid Pool6 address boundaries: " << prefix
413 << " is not the first address in prefix: " << first_address
414 << "/" << static_cast<uint32_t>(prefix_len));
415 }
416 }
417
420
421 // Let's now calculate the last address in defined pool
422 last_ = lastAddrInPrefix(prefix, prefix_len);
423
424 // Let's calculate the theoretical number of leases in this pool.
425 // For addresses, we could use addrsInRange(prefix, last_), but it's
426 // much faster to do calculations on prefix lengths.
427 capacity_ = prefixesInRange(prefix_len, delegated_len);
428
429 // If user specified an excluded prefix, create an option that will
430 // be sent to clients obtaining prefixes from this pool.
431 if (excluded_prefix_len > 0) {
432 pd_exclude_option_.reset(new Option6PDExclude(prefix, delegated_len,
433 excluded_prefix,
434 excluded_prefix_len));
435 }
436}
437
438 data::ElementPtr
439Pool6::toElement() const {
440 // Prepare the map
441 ElementPtr map = Pool::toElement();
442
443 switch (getType()) {
444 case Lease::TYPE_NA: {
445 const IOAddress& first = getFirstAddress();
446 const IOAddress& last = getLastAddress();
447 std::string range = first.toText() + "-" + last.toText();
448
449 // Try to output a prefix (vs a range)
450 int prefix_len = prefixLengthFromRange(first, last);
451 if (prefix_len >= 0) {
452 std::ostringstream oss;
453 oss << first.toText() << "/" << prefix_len;
454 range = oss.str();
455 }
456
457 map->set("pool", Element::create(range));
458 break;
459 }
460 case Lease::TYPE_PD: {
461 // Set prefix
462 const IOAddress& prefix = getFirstAddress();
463 map->set("prefix", Element::create(prefix.toText()));
464
465 // Set prefix-len (get it from min - max)
466 const IOAddress& last = getLastAddress();
467 int prefix_len = prefixLengthFromRange(prefix, last);
468 if (prefix_len < 0) {
469 // The pool is bad: give up
470 isc_throw(ToElementError, "invalid prefix range "
471 << prefix.toText() << "-" << last.toText());
472 }
473 map->set("prefix-len", Element::create(prefix_len));
474
475 // Set delegated-len
476 uint8_t len = getLength();
477 map->set("delegated-len", Element::create(static_cast<int>(len)));
478
479 // Set excluded prefix
480 const Option6PDExcludePtr& xopt = getPrefixExcludeOption();
481 if (xopt) {
482 const IOAddress& xprefix = xopt->getExcludedPrefix(prefix, len);
483 map->set("excluded-prefix", Element::create(xprefix.toText()));
484
485 uint8_t xlen = xopt->getExcludedPrefixLength();
486 map->set("excluded-prefix-len",
487 Element::create(static_cast<int>(xlen)));
488 }
489 // Let's not insert empty excluded-prefix values. If we ever
490 // decide to insert it after all, here's the code to do it:
491 // else {
492 // map->set("excluded-prefix",
493 // Element::create(std::string("::")));
494 // map->set("excluded-prefix-len", Element::create(0));
496
497 break;
498 }
499 default:
500 isc_throw(ToElementError, "Lease type: " << getType()
501 << ", unsupported for Pool6");
502 break;
503 }
504
505 return (map);
506}
507
508std::string
509Pool6::toText() const {
510 std::ostringstream s;
511 s << "type=" << Lease::typeToText(type_) << ", " << first_
512 << "-" << last_ << ", delegated_len="
513 << static_cast<unsigned>(prefix_len_);
514
515 if (pd_exclude_option_) {
516 s << ", excluded_prefix="
517 << pd_exclude_option_->getExcludedPrefix(first_, prefix_len_).toText()
518 << "/"
519 << static_cast<unsigned>(pd_exclude_option_->getExcludedPrefixLength());
520 }
521 return (s.str());
522}
523
524} // namespace dhcp
525} // namespace isc
addr_utilities.h
if
if(!(yy_init))
Definition agent_lexer.cc:1900
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::ToElementError
Cannot unparse error.
Definition cfg_to_element.h:19
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::asiolink::IOAddress::isV6
bool isV6() const
Convenience function to check for an IPv6 address.
Definition io_address.h:136
isc::asiolink::IOAddress::isV4
bool isV4() const
Convenience function to check for an IPv4 address.
Definition io_address.h:114
isc::asiolink::IOAddress::isV6Zero
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
Definition io_address.h:143
isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
Definition io_address.h:289
isc::data::Element::create
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
isc::data::Element::createMap
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
isc::dhcp::CfgOption
Represents option data configuration for the DHCP server.
Definition cfg_option.h:372
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:109
isc::dhcp::D2ClientConfig
Acts as a storage vault for D2 client configuration.
Definition d2_client_cfg.h:57
isc::dhcp::Pool4::toElement
virtual data::ElementPtr toElement() const
Unparse a Pool4 object.
Definition pool.cc:228
isc::dhcp::Pool4::Pool4
Pool4(const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
the constructor for Pool4 "min-max" style definition
Definition pool.cc:77
isc::dhcp::Pool4::create
static Pool4Ptr create(const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
Factory function for creating an instance of the Pool4.
Definition pool.cc:127
isc::dhcp::Pool6::getLength
uint8_t getLength() const
returns delegated prefix length
Definition pool.h:668
isc::dhcp::Pool6::toElement
virtual data::ElementPtr toElement() const
Unparse a Pool6 object.
Definition pool.cc:439
isc::dhcp::Pool6::getPrefixExcludeOption
Option6PDExcludePtr getPrefixExcludeOption() const
Returns instance of the pool specific Prefix Exclude option.
Definition pool.h:676
isc::dhcp::Pool6::create
static Pool6Ptr create(Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
Factory function for creating an instance of the Pool6.
Definition pool.cc:352
isc::dhcp::Pool6::toText
virtual std::string toText() const
returns textual representation of the pool
Definition pool.cc:509
isc::dhcp::Pool6::Pool6
Pool6(Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
the constructor for Pool6 "min-max" style definition
Definition pool.cc:249
isc::dhcp::Pool6::getType
Lease::Type getType() const
returns pool type
Definition pool.h:659
isc::dhcp::Pool::toElement
virtual data::ElementPtr toElement() const
Unparse a pool object.
Definition pool.cc:137
isc::dhcp::Pool::ddns_ttl_
util::Optional< uint32_t > ddns_ttl_
Explicit value to use for DNS TTL.
Definition pool.h:457
isc::dhcp::Pool::cfg_option_
CfgOptionPtr cfg_option_
Pointer to the option data configuration for this pool.
Definition pool.h:406
isc::dhcp::Pool::hostname_char_replacement_
util::Optional< std::string > hostname_char_replacement_
A string to replace invalid characters when scrubbing hostnames.
Definition pool.h:471
isc::dhcp::Pool::ddns_ttl_max_
util::Optional< uint32_t > ddns_ttl_max_
Maximum value to use for DNS TTL.
Definition pool.h:463
isc::dhcp::Pool::ddns_update_on_renew_
util::Optional< bool > ddns_update_on_renew_
Should Kea perform updates when leases are extended.
Definition pool.h:448
isc::dhcp::Pool::Pool
Pool(Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
protected constructor
Definition pool.cc:21
isc::dhcp::Pool::ddns_qualifying_suffix_
util::Optional< std::string > ddns_qualifying_suffix_
Suffix Kea should use when to qualify partial domain-names.
Definition pool.h:445
isc::dhcp::Pool::hostname_char_set_
util::Optional< std::string > hostname_char_set_
Regular expression describing invalid characters for client hostnames.
Definition pool.h:467
isc::dhcp::Pool::getFirstAddress
const isc::asiolink::IOAddress & getFirstAddress() const
Returns the first address in a pool.
Definition pool.h:63
isc::dhcp::Pool::ddns_replace_client_name_mode_
util::Optional< D2ClientConfig::ReplaceClientNameMode > ddns_replace_client_name_mode_
How Kea should handle the domain-name supplied by the client.
Definition pool.h:439
isc::dhcp::Pool::additional_classes_
ClientClasses additional_classes_
Additional classes.
Definition pool.h:419
isc::dhcp::Pool::hasDdnsParameters
bool hasDdnsParameters() const
Checks if any of the DDNS parameters has a value.
Definition pool.cc:60
isc::dhcp::Pool::ddns_ttl_min_
util::Optional< uint32_t > ddns_ttl_min_
Minimum value to use for DNS TTL.
Definition pool.h:460
isc::dhcp::Pool::id_
uint64_t id_
pool-id
Definition pool.h:386
isc::dhcp::Pool::getLastAddress
const isc::asiolink::IOAddress & getLastAddress() const
Returns the last address in a pool.
Definition pool.h:69
isc::dhcp::Pool::ddns_generated_prefix_
util::Optional< std::string > ddns_generated_prefix_
Prefix Kea should use when generating domain-names.
Definition pool.h:442
isc::dhcp::Pool::ddns_override_client_update_
util::Optional< bool > ddns_override_client_update_
Should Kea perform updates, even if client requested delegation.
Definition pool.h:436
isc::dhcp::Pool::ddns_ttl_percent_
util::Optional< double > ddns_ttl_percent_
Percentage of the lease lifetime to use for DNS TTL.
Definition pool.h:454
isc::dhcp::Pool::capacity_
isc::util::uint128_t capacity_
Stores number of possible leases.
Definition pool.h:403
isc::dhcp::Pool::client_classes_
ClientClasses client_classes_
List of client classes allowed to use this pool.
Definition pool.h:414
isc::dhcp::Pool::allowClientClass
void allowClientClass(const isc::dhcp::ClientClass &class_name)
Adds class clas_name to the allowed client classes list.
Definition pool.cc:38
isc::dhcp::Pool::ddns_override_no_update_
util::Optional< bool > ddns_override_no_update_
Should Kea perform updates, even if client requested no updates.
Definition pool.h:433
isc::dhcp::Pool::last_
isc::asiolink::IOAddress last_
The last address in a pool.
Definition pool.h:392
isc::dhcp::Pool::first_
isc::asiolink::IOAddress first_
The first address in a pool.
Definition pool.h:389
isc::dhcp::Pool::ddns_conflict_resolution_mode_
util::Optional< std::string > ddns_conflict_resolution_mode_
DDNS conflict resolution mode.
Definition pool.h:451
isc::dhcp::Pool::ddns_send_updates_
util::Optional< bool > ddns_send_updates_
Should Kea perform DNS updates.
Definition pool.h:429
isc::dhcp::Pool::getCfgOption
CfgOptionPtr getCfgOption()
Returns pointer to the option data configuration for this pool.
Definition pool.h:106
isc::dhcp::Pool::toText
virtual std::string toText() const
returns textual representation of the pool
Definition pool.cc:52
isc::dhcp::Pool::inRange
bool inRange(const isc::asiolink::IOAddress &addr) const
Checks if a given address is in the range.
Definition pool.cc:28
isc::dhcp::Pool::addAdditionalClass
void addAdditionalClass(const ClientClass &class_name)
Adds class class_name to the additional classes list.
Definition pool.cc:45
isc::dhcp::Pool::clientSupported
bool clientSupported(const ClientClasses &client_classes) const
Checks whether this pool supports client that belongs to specified classes.
Definition pool.cc:33
isc::dhcp::Pool::type_
Lease::Type type_
defines a lease type that will be served from this pool
Definition pool.h:395
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition exceptions/exceptions.h:210
io_address.h
isc::asiolink
Definition addr_utilities.cc:170
isc::asiolink::firstAddrInPrefix
IOAddress firstAddrInPrefix(const IOAddress &prefix, uint8_t len)
This code is based on similar code from the Dibbler project.
Definition addr_utilities.cc:172
isc::asiolink::addrsInRange
uint128_t addrsInRange(const IOAddress &min, const IOAddress &max)
Returns number of available addresses in the specified range (min - max).
Definition addr_utilities.cc:203
isc::asiolink::prefixesInRange
uint128_t prefixesInRange(const uint8_t pool_len, const uint8_t delegated_len)
Returns number of available IPv6 prefixes in the specified prefix.
Definition addr_utilities.cc:352
isc::asiolink::lastAddrInPrefix
IOAddress lastAddrInPrefix(const IOAddress &prefix, uint8_t len)
returns a last address in a given prefix
Definition addr_utilities.cc:182
isc::asiolink::prefixLengthFromRange
int prefixLengthFromRange(const IOAddress &min, const IOAddress &max)
Returns prefix length from the specified range (min - max).
Definition addr_utilities.cc:273
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::Pool4Ptr
boost::shared_ptr< Pool4 > Pool4Ptr
a pointer an IPv4 Pool
Definition pool.h:477
isc::dhcp::ClientClass
std::string ClientClass
Defines a single class name.
Definition classify.h:43
isc::dhcp::Option6PDExcludePtr
boost::shared_ptr< Option6PDExclude > Option6PDExcludePtr
Pointer to the Option6PDExclude object.
Definition option6_pdexclude.h:125
isc::dhcp::ConstCfgOptionPtr
boost::shared_ptr< const CfgOption > ConstCfgOptionPtr
Const pointer.
Definition cfg_option.h:895
isc::dhcp::Pool6Ptr
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
Definition pool.h:536
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
pool.h
isc::data::UserContext::contextToElement
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Definition user_context.cc:15
isc::dhcp::Lease
a common structure for IPv4 and IPv6 leases
Definition lease.h:31
isc::dhcp::Lease::Type
Type
Type of lease or pool.
Definition lease.h:46
isc::dhcp::Lease::TYPE_TA
@ TYPE_TA
the lease contains temporary IPv6 address
Definition lease.h:48
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::Lease::typeToText
static std::string typeToText(Type type)
returns text representation of a lease type
Definition lease.cc:56