Kea: pool.cc Source File

| Kea 3.2.0-git

pool.cc
Go to the documentation of this file.
1// Copyright (C) 2012-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
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_PD)) {
259 isc_throw(BadValue, "Invalid Pool6 type: " << static_cast<int>(type)
260 << ", must be TYPE_IA or TYPE_PD");
261 }
262
263 if (last < first) {
264 isc_throw(BadValue, "Upper boundary is smaller than lower boundary.");
265 // This check is a bit strict. If we decide that it is too strict,
266 // we need to comment it and uncomment lines below.
267 // On one hand, letting the user specify 2001::f - 2001::1 is nice, but
268 // on the other hand, 2001::1 may be a typo and the user really meant
269 // 2001::1:0 (or 1 followed by some hex digit), so a at least a warning
270 // would be useful.
271
272 // first_ = last;
273 // last_ = first;
274 }
275
276 // TYPE_PD is not supported by this constructor. first-last style
277 // parameters are for NA only. There is another dedicated
278 // constructor for that (it uses prefix/length)
279 if (type != Lease::TYPE_NA) {
280 isc_throw(BadValue, "Invalid Pool6 type specified: "
281 << static_cast<int>(type));
282 }
283
284 // Let's calculate the theoretical number of leases in this pool.
285 // If the pool is extremely large (i.e. contains more than 2^64 addresses,
286 // we'll just cap it at max value of uint64_t).
287 capacity_ = addrsInRange(first, last);
288}
289
290 Pool6::Pool6(Lease::Type type, const isc::asiolink::IOAddress& prefix,
291 const uint8_t prefix_len, const uint8_t delegated_len /* = 128 */)
292 : Pool(type, prefix, IOAddress::IPV6_ZERO_ADDRESS()),
293 prefix_len_(delegated_len), pd_exclude_option_() {
294
295 init(type, prefix, prefix_len, delegated_len,
296 IOAddress::IPV6_ZERO_ADDRESS(), 0);
297}
298
299 Pool6::Pool6(const asiolink::IOAddress& prefix, const uint8_t prefix_len,
300 const uint8_t delegated_len,
301 const asiolink::IOAddress& excluded_prefix,
302 const uint8_t excluded_prefix_len)
303 : Pool(Lease::TYPE_PD, prefix, IOAddress::IPV6_ZERO_ADDRESS()),
304 prefix_len_(delegated_len), pd_exclude_option_() {
305
306 init(Lease::TYPE_PD, prefix, prefix_len, delegated_len, excluded_prefix,
307 excluded_prefix_len);
308
309 // The excluded prefix can only be specified using this constructor.
310 // Therefore, the initialization of the excluded prefix is takes place
311 // here, rather than in the init(...) function.
312 if (!excluded_prefix.isV6()) {
313 isc_throw(BadValue, "excluded prefix must be an IPv6 prefix");
314 }
315
316 // An "unspecified" prefix should have both value and length equal to 0.
317 if ((excluded_prefix.isV6Zero() && (excluded_prefix_len != 0)) ||
318 (!excluded_prefix.isV6Zero() && (excluded_prefix_len == 0))) {
319 isc_throw(BadValue, "invalid excluded prefix "
320 << excluded_prefix << "/"
321 << static_cast<unsigned>(excluded_prefix_len));
322 }
323
324 // If excluded prefix has been specified.
325 if (!excluded_prefix.isV6Zero() && (excluded_prefix_len != 0)) {
326 // Excluded prefix length must not be greater than 128.
327 if (excluded_prefix_len > 128) {
328 isc_throw(BadValue, "excluded prefix length "
329 << static_cast<unsigned>(excluded_prefix_len)
330 << " must not be greater than 128");
331 }
332
333 // Excluded prefix must be a sub-prefix of a delegated prefix. First
334 // check the prefix length as it is less involved.
335 if (excluded_prefix_len <= prefix_len_) {
336 isc_throw(BadValue, "excluded prefix length "
337 << static_cast<unsigned>(excluded_prefix_len)
338 << " must be longer than the delegated prefix length "
339 << static_cast<unsigned>(prefix_len_));
340 }
341
347 }
348}
349
350 Pool6Ptr
351Pool6::create(Lease::Type type, const IOAddress& first, const IOAddress& last) {
352 return (boost::make_shared<Pool6>(type, first, last));
353}
354
355 Pool6Ptr
356 Pool6::create(Lease::Type type, const IOAddress& prefix,
357 uint8_t prefix_len, uint8_t delegated_len) {
358 return (boost::make_shared<Pool6>(type, prefix, prefix_len, delegated_len));
359}
360
361 Pool6Ptr
362 Pool6::create(const IOAddress& prefix, const uint8_t prefix_len,
363 const uint8_t delegated_len, const IOAddress& excluded_prefix,
364 const uint8_t excluded_prefix_len) {
365 return (boost::make_shared<Pool6>(prefix, prefix_len,
366 delegated_len, excluded_prefix,
367 excluded_prefix_len));
368}
369
370void
371Pool6::init(const Lease::Type& type,
372 const asiolink::IOAddress& prefix,
373 const uint8_t prefix_len,
374 const uint8_t delegated_len,
375 const asiolink::IOAddress& excluded_prefix,
376 const uint8_t excluded_prefix_len) {
377 // Check if the prefix is sane
378 if (!prefix.isV6()) {
379 isc_throw(BadValue, "Invalid Pool6 address boundaries: not IPv6");
380 }
381
382 // Check if the prefix length is sane
383 if (prefix_len == 0 || prefix_len > 128) {
384 isc_throw(BadValue, "Invalid prefix length: "
385 << static_cast<unsigned>(prefix_len));
386 }
387
388 if (prefix_len > delegated_len) {
389 isc_throw(BadValue, "Delegated length ("
390 << static_cast<int>(delegated_len)
391 << ") must be longer than or equal to prefix length ("
392 << static_cast<int>(prefix_len) << ")");
393 }
394
395 if ((type != Lease::TYPE_PD) && (delegated_len != 128)) {
396 isc_throw(BadValue, "For NA or TA pools, delegated prefix length must"
397 << " be 128.");
398 }
399
400 // excluded_prefix_len == 0 means there's no excluded prefix at all.
401 if (excluded_prefix_len && (excluded_prefix_len <= delegated_len)) {
402 isc_throw(BadValue, "Excluded prefix ("
403 << static_cast<int>(excluded_prefix_len)
404 << ") must be longer than the delegated prefix length ("
405 << static_cast<int>(delegated_len) << ")");
406 }
407
408 if (prefix_len != 128) {
409 IOAddress first_address = firstAddrInPrefix(prefix, prefix_len);
410 if (first_address != prefix) {
411 isc_throw(BadValue, "Invalid Pool6 address boundaries: " << prefix
412 << " is not the first address in prefix: " << first_address
413 << "/" << static_cast<uint32_t>(prefix_len));
414 }
415 }
416
419
420 // Let's now calculate the last address in defined pool
421 last_ = lastAddrInPrefix(prefix, prefix_len);
422
423 // Let's calculate the theoretical number of leases in this pool.
424 // For addresses, we could use addrsInRange(prefix, last_), but it's
425 // much faster to do calculations on prefix lengths.
426 capacity_ = prefixesInRange(prefix_len, delegated_len);
427
428 // If user specified an excluded prefix, create an option that will
429 // be sent to clients obtaining prefixes from this pool.
430 if (excluded_prefix_len > 0) {
431 pd_exclude_option_.reset(new Option6PDExclude(prefix, delegated_len,
432 excluded_prefix,
433 excluded_prefix_len));
434 }
435}
436
437 data::ElementPtr
438Pool6::toElement() const {
439 // Prepare the map
440 ElementPtr map = Pool::toElement();
441
442 switch (getType()) {
443 case Lease::TYPE_NA: {
444 const IOAddress& first = getFirstAddress();
445 const IOAddress& last = getLastAddress();
446 std::string range = first.toText() + "-" + last.toText();
447
448 // Try to output a prefix (vs a range)
449 int prefix_len = prefixLengthFromRange(first, last);
450 if (prefix_len >= 0) {
451 std::ostringstream oss;
452 oss << first.toText() << "/" << prefix_len;
453 range = oss.str();
454 }
455
456 map->set("pool", Element::create(range));
457 break;
458 }
459 case Lease::TYPE_PD: {
460 // Set prefix
461 const IOAddress& prefix = getFirstAddress();
462 map->set("prefix", Element::create(prefix.toText()));
463
464 // Set prefix-len (get it from min - max)
465 const IOAddress& last = getLastAddress();
466 int prefix_len = prefixLengthFromRange(prefix, last);
467 if (prefix_len < 0) {
468 // The pool is bad: give up
469 isc_throw(ToElementError, "invalid prefix range "
470 << prefix.toText() << "-" << last.toText());
471 }
472 map->set("prefix-len", Element::create(prefix_len));
473
474 // Set delegated-len
475 uint8_t len = getLength();
476 map->set("delegated-len", Element::create(static_cast<int>(len)));
477
478 // Set excluded prefix
479 const Option6PDExcludePtr& xopt = getPrefixExcludeOption();
480 if (xopt) {
481 const IOAddress& xprefix = xopt->getExcludedPrefix(prefix, len);
482 map->set("excluded-prefix", Element::create(xprefix.toText()));
483
484 uint8_t xlen = xopt->getExcludedPrefixLength();
485 map->set("excluded-prefix-len",
486 Element::create(static_cast<int>(xlen)));
487 }
488 // Let's not insert empty excluded-prefix values. If we ever
489 // decide to insert it after all, here's the code to do it:
490 // else {
491 // map->set("excluded-prefix",
492 // Element::create(std::string("::")));
493 // map->set("excluded-prefix-len", Element::create(0));
495
496 break;
497 }
498 default:
499 isc_throw(ToElementError, "Lease type: " << getType()
500 << ", unsupported for Pool6");
501 break;
502 }
503
504 return (map);
505}
506
507std::string
508Pool6::toText() const {
509 std::ostringstream s;
510 s << "type=" << Lease::typeToText(type_) << ", " << first_
511 << "-" << last_ << ", delegated_len="
512 << static_cast<unsigned>(prefix_len_);
513
514 if (pd_exclude_option_) {
515 s << ", excluded_prefix="
516 << pd_exclude_option_->getExcludedPrefix(first_, prefix_len_).toText()
517 << "/"
518 << static_cast<unsigned>(pd_exclude_option_->getExcludedPrefixLength());
519 }
520 return (s.str());
521}
522
523} // namespace dhcp
524} // namespace isc
addr_utilities.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::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:53
isc::asiolink::IOAddress::toText
std::string toText() const
Convert the address to a string.
Definition io_address.cc:60
isc::asiolink::IOAddress::isV6
bool isV6() const
Convenience function to check for an IPv6 address.
Definition io_address.h:144
isc::asiolink::IOAddress::isV4
bool isV4() const
Convenience function to check for an IPv4 address.
Definition io_address.h:122
isc::asiolink::IOAddress::isV6Zero
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
Definition io_address.h:151
isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
Definition io_address.h:297
isc::data::Element::create
static ElementPtr create(const Position &pos=ZERO_POSITION())
Create a NullElement.
Definition data.cc:299
isc::data::Element::createMap
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:354
isc::dhcp::CfgOption
Represents option data configuration for the DHCP server.
Definition cfg_option.h:404
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:110
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:438
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:351
isc::dhcp::Pool6::toText
virtual std::string toText() const
returns textual representation of the pool
Definition pool.cc:508
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
if
if(!(yy_init))
Definition d2_lexer.cc:1515
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:29
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:44
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:976
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 check_exists_add.cc:18
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_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