8#include <kea_version.h>
116#include <boost/algorithm/string/erase.hpp>
117#include <boost/algorithm/string/join.hpp>
118#include <boost/algorithm/string/split.hpp>
119#include <boost/foreach.hpp>
120#include <boost/tokenizer.hpp>
135namespace ph = std::placeholders;
141 int hook_index_buffer6_receive_;
142 int hook_index_pkt6_receive_;
143 int hook_index_subnet6_select_;
144 int hook_index_leases6_committed_;
145 int hook_index_lease6_release_;
146 int hook_index_pkt6_send_;
147 int hook_index_buffer6_send_;
148 int hook_index_lease6_decline_;
149 int hook_index_host6_identifier_;
150 int hook_index_ddns6_update_;
151 int hook_index_addr6_register_;
187createStatusCode(
const Pkt6& pkt,
const uint16_t status_code,
188 const std::string& status_message) {
193 .arg(option_status->dataToText());
194 return (option_status);
212createStatusCode(
const Pkt6& pkt,
const Option6IA& ia,
const uint16_t status_code,
213 const std::string& status_message) {
219 .arg(option_status->dataToText());
220 return (option_status);
225std::set<std::string> dhcp6_statistics = {
227 "pkt6-solicit-received",
228 "pkt6-advertise-received",
229 "pkt6-request-received",
230 "pkt6-reply-received",
231 "pkt6-renew-received",
232 "pkt6-rebind-received",
233 "pkt6-decline-received",
234 "pkt6-release-received",
235 "pkt6-infrequest-received",
236 "pkt6-lease-query-received",
237 "pkt6-dhcpv4-query-received",
238 "pkt6-dhcpv4-response-received",
239 "pkt6-addr-reg-inform-received",
240 "pkt6-addr-reg-reply-received",
241 "pkt6-unknown-received",
243 "pkt6-advertise-sent",
245 "pkt6-lease-query-reply-sent",
246 "pkt6-dhcpv4-response-sent",
247 "pkt6-addr-reg-reply-sent",
248 "pkt6-service-disabled",
252 "pkt6-rfc-violation",
253 "pkt6-admin-filtered",
255 "pkt6-processing-failed",
256 "pkt6-limit-exceeded",
258 "v6-allocation-fail",
259 "v6-allocation-fail-shared-network",
260 "v6-allocation-fail-subnet",
261 "v6-allocation-fail-no-pools",
262 "v6-allocation-fail-classes",
263 "v6-ia-na-lease-reuses",
264 "v6-ia-pd-lease-reuses",
307 }
catch (
const std::exception &e) {
323 for (
auto const& it : dhcp6_statistics) {
325 stats_mgr.
setValue(it,
static_cast<int64_t
>(0));
335 }
catch (
const std::exception& ex) {
342 }
catch (
const std::exception& ex) {
361 if (!names.empty()) {
363 for (
size_t i = 1; i < names.size(); ++i) {
364 msg += std::string(
", ") + names[i];
370 io_service_->stopAndPoll();
396 if (
getServerID()->getData() != server_id->getData()){
398 .arg(pkt->getLabel())
402 static_cast<int64_t
>(1));
412 if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
414 .arg(pkt->getLabel())
415 .arg(pkt->getName());
417 static_cast<int64_t
>(1));
427 for (
auto const& id_type : cfg->getIdentifierTypes()) {
448 std::vector<uint8_t> id;
457 callout_handle->setArgument(
"query6", ctx.
query_);
458 callout_handle->setArgument(
"id_type", type);
459 callout_handle->setArgument(
"id_value",
id);
465 callout_handle->getArgument(
"id_type", type);
466 callout_handle->getArgument(
"id_value",
id);
472 .arg(ctx.
query_->getLabel())
492 ctx.
duid_ = query->getClientId();
519 if (global_host && !global_host->getClientClasses6().empty()) {
524 const ClientClasses& classes = global_host->getClientClasses6();
525 for (
auto const& cclass : classes) {
526 query->addClass(cclass);
535 query->addClass(
"KNOWN");
537 .arg(query->getLabel())
544 if (query->inClass(
"DROP")) {
547 .arg(query->makeLabel(query->getClientId(),
nullptr))
548 .arg(query->toText());
550 static_cast<int64_t
>(1));
552 static_cast<int64_t
>(1));
557 ctx.
hosts_[SUBNET_ID_GLOBAL] = global_host;
591 ctx.
subnet_->getSharedNetwork(sn);
603 global_host && !global_host->getClientClasses6().empty()) ||
604 (!sn && current_host && !current_host->getClientClasses6().empty())) {
625 if (!ctx.
hosts_.empty()) {
626 ctx.
query_->addClass(
"KNOWN");
628 .arg(ctx.
query_->getLabel())
631 ctx.
query_->addClass(
"UNKNOWN");
633 .arg(ctx.
query_->getLabel())
642 .arg(ctx.
query_->getLabel())
646 if (ctx.
query_->inClass(
"DROP")) {
648 .arg(ctx.
query_->makeLabel(ctx.
query_->getClientId(), 0))
649 .arg(ctx.
query_->toText());
651 static_cast<int64_t
>(1));
653 static_cast<int64_t
>(1));
665 const char*
interface = getenv(
"KEA_AFL_INTERFACE");
667 isc_throw(FuzzInitFail,
"no fuzzing interface has been set");
671 const char* address = getenv(
"KEA_AFL_ADDRESS");
673 isc_throw(FuzzInitFail,
"no fuzzing address has been set");
681 while (__AFL_LOOP(fuzzer.maxLoopCount())) {
693 }
catch (
const std::exception& e) {
724 uint32_t timeout = 1;
735 .arg(query->getRemoteAddr().toText())
736 .arg(query->getRemotePort())
737 .arg(query->getLocalAddr().toText())
738 .arg(query->getLocalPort())
739 .arg(query->getIface());
761 }
catch (
const std::exception& e) {
775 .arg(query->getLabel());
778 static_cast<int64_t
>(1));
780 static_cast<int64_t
>(1));
784 query->addPktEvent(
"mt_queued");
785 typedef function<void()> CallBack;
786 boost::shared_ptr<CallBack> call_back =
792 static_cast<int64_t
>(1));
794 static_cast<int64_t
>(1));
806 }
catch (
const std::exception& e) {
808 .arg(query->getLabel())
811 static_cast<int64_t
>(1));
813 static_cast<int64_t
>(1));
816 .arg(query->getLabel());
818 static_cast<int64_t
>(1));
820 static_cast<int64_t
>(1));
837 query->addPktEvent(
"process_started");
840 query->addClass(
"ALL");
842 bool skip_unpack =
false;
859 callout_handle->setArgument(
"query6", query);
870 .arg(query->getRemoteAddr().toText())
871 .arg(query->getLocalAddr().toText())
872 .arg(query->getIface());
881 .arg(query->getRemoteAddr().toText())
882 .arg(query->getLocalAddr().toText())
883 .arg(query->getIface());
890 callout_handle->getArgument(
"query6", query);
902 .arg(query->getRemoteAddr().toText())
903 .arg(query->getLocalAddr().toText())
904 .arg(query->getIface());
911 .arg(query->getLabel())
913 }
catch (
const std::exception &e) {
916 .arg(query->getLabel())
917 .arg(query->getRemoteAddr().toText())
918 .arg(query->getLocalAddr().toText())
919 .arg(query->getIface())
921 .arg(query->makeLabel(query->getClientId(),
nullptr));
925 static_cast<int64_t
>(1));
927 static_cast<int64_t
>(1));
934 .arg(query->getLabel());
937 processStatsReceived(query);
946 static_cast<int64_t
>(1));
956 static_cast<int64_t
>(1));
964 .arg(query->getLabel())
965 .arg(query->getName())
966 .arg(
static_cast<int>(query->getType()))
967 .arg(query->getRemoteAddr())
968 .arg(query->getLocalAddr())
969 .arg(query->getIface());
971 .arg(query->getLabel())
972 .arg(query->toText());
990 callout_handle->setArgument(
"query6", query);
1001 .arg(query->getLabel());
1007 callout_handle->getArgument(
"query6", query);
1021 if (query->inClass(
"DROP")) {
1023 .arg(query->makeLabel(query->getClientId(),
nullptr))
1024 .arg(query->toText());
1026 static_cast<int64_t
>(1));
1028 static_cast<int64_t
>(1));
1045 }
catch (
const std::exception& e) {
1047 .arg(query->getLabel())
1050 static_cast<int64_t
>(1));
1052 static_cast<int64_t
>(1));
1055 .arg(query->getLabel());
1057 static_cast<int64_t
>(1));
1059 static_cast<int64_t
>(1));
1080 if (!client_handler.
tryLock(query, cont)) {
1120 }
catch (
const std::exception& e) {
1122 .arg(query->getLabel())
1125 static_cast<int64_t
>(1));
1127 static_cast<int64_t
>(1));
1130 .arg(query->getLabel());
1132 static_cast<int64_t
>(1));
1134 static_cast<int64_t
>(1));
1147 callout_handle->getContext(
"subnet6", ctx.
subnet_);
1167 bool rfc_violation =
false;
1170 switch (query->getType()) {
1211 rfc_violation =
true;
1214 }
catch (
const std::exception& e) {
1224 .arg(query->getLabel())
1225 .arg(query->getName())
1226 .arg(query->getRemoteAddr().toText())
1231 if (!rfc_violation) {
1233 static_cast<int64_t
>(1));
1236 static_cast<int64_t
>(1));
1256 rsp->setRemoteAddr(query->getRemoteAddr());
1257 rsp->setLocalAddr(query->getLocalAddr());
1262 }
else if (rsp->relay_info_.empty()) {
1264 rsp->setRemotePort(DHCP6_CLIENT_PORT);
1268 rsp->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT);
1274 rsp->setLocalPort(DHCP6_SERVER_PORT);
1276 rsp->setIndex(query->getIndex());
1277 rsp->setIface(query->getIface());
1306 std::shared_ptr<ScopedCalloutHandleState> callout_handle_state =
1307 std::make_shared<ScopedCalloutHandleState>(callout_handle);
1312 callout_handle->setArgument(
"query6", query);
1316 callout_handle->setArgument(
"response6", rsp);
1322 if (new_lease->reuseable_valid_lft_ == 0) {
1323 new_leases->push_back(new_lease);
1327 callout_handle->setArgument(
"leases6", new_leases);
1332 for (
auto const& iac : ctx.
ias_) {
1333 if (!iac.old_leases_.empty()) {
1334 for (
auto const& old_lease : iac.old_leases_) {
1336 deleted_leases->push_back(old_lease);
1339 bool in_new =
false;
1341 if ((new_lease->addr_ == old_lease->addr_) &&
1343 (new_lease->prefixlen_ == old_lease->prefixlen_))) {
1349 deleted_leases->push_back(old_lease);
1354 callout_handle->setArgument(
"deleted_leases6", deleted_leases);
1357 uint32_t parked_packet_limit = 0;
1361 parked_packet_limit = ppl->intValue();
1364 if (parked_packet_limit) {
1366 getParkingLotPtr(
"leases6_committed");
1367 if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
1371 .arg(parked_packet_limit)
1372 .arg(query->getLabel());
1374 static_cast<int64_t
>(1));
1376 static_cast<int64_t
>(1));
1388 [
this, callout_handle, query, rsp, callout_handle_state, subnet]()
mutable {
1390 typedef function<void()> CallBack;
1391 boost::shared_ptr<CallBack> call_back =
1393 this, callout_handle, query, rsp, subnet));
1394 callout_handle_state->on_completion_ = [call_back]() {
1415 .arg(query->getLabel());
1426 .arg(query->getLabel());
1447 }
catch (
const std::exception& e) {
1449 .arg(query->getLabel())
1453 .arg(query->getLabel());
1461 query->addPktEvent(
"process_completed");
1467 bool skip_pack =
false;
1485 callout_handle->setArgument(
"query6", query);
1488 callout_handle->setArgument(
"response6", rsp);
1491 callout_handle->setArgument(
"subnet6", subnet);
1503 .arg(rsp->getLabel());
1510 .arg(rsp->getLabel());
1520 }
catch (
const std::exception& e) {
1522 .arg(query->getLabel())
1554 callout_handle->setArgument(
"response6", rsp);
1567 .arg(rsp->getLabel());
1571 callout_handle->getArgument(
"response6", rsp);
1575 .arg(rsp->getLabel())
1576 .arg(rsp->getName())
1577 .arg(
static_cast<int>(rsp->getType()))
1578 .arg(rsp->getLocalAddr().isV6Zero() ?
"*" : rsp->getLocalAddr().toText())
1579 .arg(rsp->getLocalPort())
1580 .arg(rsp->getRemoteAddr())
1581 .arg(rsp->getRemotePort())
1582 .arg(rsp->getIface());
1585 .arg(rsp->getLabel())
1586 .arg(rsp->getName())
1587 .arg(
static_cast<int>(rsp->getType()))
1588 .arg(rsp->toText());
1594 }
catch (
const std::exception& e) {
1596 .arg(rsp->getLabel())
1614 answer->addOption(clientid);
1619 if (!question->relay_info_.empty()) {
1620 answer->copyRelayInfo(question);
1638 co_list.push_back(ctx.
currentHost()->getCfgOption6());
1646 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
1648 resource.getAddress(),
1650 if (pool && !pool->getCfgOption()->empty()) {
1651 co_list.push_back(pool->getCfgOption());
1656 if (!ctx.
subnet_->getCfgOption()->empty()) {
1657 co_list.push_back(ctx.
subnet_->getCfgOption());
1662 ctx.
subnet_->getSharedNetwork(network);
1663 if (network && !network->getCfgOption()->empty()) {
1664 co_list.push_back(network->getCfgOption());
1670 for (
auto const& cclass : classes) {
1673 getClientClassDictionary()->findClass(cclass);
1678 .arg(question->getLabel())
1685 if (ccdef->getCfgOption()->empty()) {
1690 co_list.push_back(ccdef->getCfgOption());
1703 if (co_list.empty()) {
1707 set<uint16_t> requested_opts;
1716 for (uint16_t code : option_oro->getValues()) {
1717 static_cast<void>(requested_opts.insert(code));
1721 set<uint16_t> cancelled_opts;
1725 for (
auto const& copts : co_list) {
1733 BOOST_FOREACH(
auto const& desc, prange) {
1736 uint16_t code = desc.option_->getType();
1737 static_cast<void>(requested_opts.insert(code));
1743 BOOST_FOREACH(
auto const& desc, crange) {
1746 uint16_t code = desc.option_->getType();
1747 static_cast<void>(cancelled_opts.insert(code));
1752 const auto& cclasses = question->getClasses();
1755 for (uint16_t opt : requested_opts) {
1757 if (cancelled_opts.count(opt) > 0) {
1765 if (!answer->getOption(opt)) {
1767 for (
auto const& copts : co_list) {
1774 .arg(answer->getLabel());
1776 answer->addOption(desc.
option_);
1789 set<uint32_t> vendor_ids;
1793 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1795 uint32_t vendor_id = vendor_class->getVendorId();
1796 static_cast<void>(vendor_ids.insert(vendor_id));
1800 for (
auto const& copts : co_list) {
1803 if (!desc.option_ || !desc.allowedForClientClasses(cclasses)) {
1807 boost::dynamic_pointer_cast<OptionVendorClass>(desc.option_);
1808 if (!vendor_class) {
1812 uint32_t vendor_id = vendor_class->getVendorId();
1813 if (vendor_ids.count(vendor_id) > 0) {
1817 answer->addOption(desc.option_);
1818 static_cast<void>(vendor_ids.insert(vendor_id));
1827 set<uint32_t> vendor_ids;
1831 vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1833 uint32_t vendor_id = vendor_opts->getVendorId();
1834 static_cast<void>(vendor_ids.insert(vendor_id));
1838 for (
auto const& copts : co_list) {
1841 if (!desc.option_ || !desc.allowedForClientClasses(cclasses)) {
1845 boost::dynamic_pointer_cast<OptionVendor>(desc.option_);
1850 uint32_t vendor_id = vendor_opts->getVendorId();
1851 if (vendor_ids.count(vendor_id) > 0) {
1857 answer->addOption(vendor_opts);
1858 static_cast<void>(vendor_ids.insert(vendor_id));
1877 if (!ctx.
subnet_ || co_list.empty()) {
1881 set<uint32_t> vendor_ids;
1885 map<uint32_t, OptionVendorPtr> vendor_rsps;
1888 vendor_rsp = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1890 uint32_t vendor_id = vendor_rsp->getVendorId();
1891 vendor_rsps[vendor_id] = vendor_rsp;
1892 static_cast<void>(vendor_ids.insert(vendor_id));
1898 map<uint32_t, OptionVendorPtr> vendor_reqs;
1901 vendor_req = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1903 uint32_t vendor_id = vendor_req->getVendorId();
1904 vendor_reqs[vendor_id] = vendor_req;
1905 static_cast<void>(vendor_ids.insert(vendor_id));
1913 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1915 uint32_t vendor_id = vendor_class->getVendorId();
1916 static_cast<void>(vendor_ids.insert(vendor_id));
1922 if (vendor_ids.empty()) {
1926 map<uint32_t, set<uint16_t> > requested_opts;
1940 oro = boost::dynamic_pointer_cast<OptionUint16Array>(oro_generic);
1943 set<uint16_t> oro_req_opts;
1944 for (uint16_t code : oro->getValues()) {
1945 static_cast<void>(oro_req_opts.insert(code));
1951 map<uint32_t, set<uint16_t> > cancelled_opts;
1952 const auto& cclasses = question->getClasses();
1956 for (uint32_t vendor_id : vendor_ids) {
1957 for (
auto const& copts : co_list) {
1965 BOOST_FOREACH(
auto const& desc, prange) {
1966 if (!desc.option_) {
1970 uint16_t code = desc.option_->getType();
1971 static_cast<void>(requested_opts[vendor_id].insert(code));
1976 BOOST_FOREACH(
auto const& desc, crange) {
1977 if (!desc.option_) {
1981 uint16_t code = desc.option_->getType();
1982 static_cast<void>(cancelled_opts[vendor_id].insert(code));
1991 if (requested_opts[vendor_id].empty()) {
1998 if (vendor_rsps.count(vendor_id) > 0) {
1999 vendor_rsp = vendor_rsps[vendor_id];
2007 for (uint16_t opt : requested_opts[vendor_id]) {
2008 if (cancelled_opts[vendor_id].count(opt) > 0) {
2011 if (!vendor_rsp->getOption(opt)) {
2012 for (
auto const& copts : co_list) {
2017 vendor_rsp->addOption(desc.
option_);
2027 if (added && (vendor_rsps.count(vendor_id) == 0)) {
2028 answer->addOption(vendor_rsp);
2036 switch (pkt->getType()) {
2059 .arg(pkt->getLabel())
2060 .arg(
static_cast<int>(pkt->getType()))
2061 .arg(pkt->getIface());
2066 .arg(pkt->getLabel())
2067 .arg(pkt->getName())
2068 .arg(pkt->getRemoteAddr().toText())
2071 static_cast<int64_t
>(1));
2085 if (client_ids.size() != 1) {
2087 << pkt->getName() <<
", but " << client_ids.size()
2094 if (client_ids.size() > 1) {
2096 <<
") client-id options received in " << pkt->getName());
2098 if (!client_ids.empty()) {
2111 if (!server_ids.empty()) {
2113 << server_ids.size() <<
" received in " << pkt->getName());
2118 if (server_ids.size() != 1) {
2120 << server_ids.size() <<
"), exactly 1 expected in message "
2127 if (server_ids.size() > 1) {
2129 <<
") server-id options received in " << pkt->getName());
2131 if (!server_ids.empty()) {
2144 uint16_t len = opt->len() - opt->getHeaderLen();
2153 <<
". It matches the reserved empty-DUID sentinel 00:00:00");
2162 getCfgSubnets6()->selectSubnet(selector);
2172 shared_ptr<ScopedCalloutHandleState> callout_handle_state(
2173 std::make_shared<ScopedCalloutHandleState>(callout_handle));
2179 callout_handle->setArgument(
"query6", question);
2180 callout_handle->setArgument(
"subnet6", subnet);
2185 callout_handle->setArgument(
"subnet6collection",
2187 getCfgSubnets6()->getAll());
2189 auto const tpl(parkingLimitExceeded(
"subnet6_select"));
2190 bool const exceeded(
get<0>(tpl));
2192 uint32_t
const limit(
get<1>(tpl));
2197 .arg(question->getLabel());
2199 static_cast<int64_t
>(1));
2201 static_cast<int64_t
>(1));
2208 HooksManager::park(
"subnet6_select", question, [
this, question, callout_handle_state]() {
2210 boost::shared_ptr<function<void()>> callback(
2211 boost::make_shared<function<
void()>>([
this, question]()
mutable {
2214 callout_handle_state->on_completion_ = [callback]() {
2236 .arg(question->getLabel());
2249 .arg(question->getLabel());
2257 .arg(question->getLabel());
2263 callout_handle->getArgument(
"subnet6", subnet);
2269 .arg(question->getLabel())
2270 .arg(subnet->getID());
2274 .arg(question->getLabel())
2275 .arg(subnet->toText());
2279 .arg(question->getLabel());
2301 for (
auto const& opt : question->options_) {
2302 switch (opt.second->getType()) {
2305 boost::dynamic_pointer_cast<
2308 answer->addOption(answer_opt);
2314 boost::dynamic_pointer_cast<
2317 answer->addOption(answer_opt);
2343 if (ddns_params->getEnableUpdates() &&
2353 .arg(question->getLabel());
2366 .arg(question->getLabel())
2367 .arg(fqdn->toText());
2386 *ddns_params,
true),
2395 .arg(question->getLabel())
2396 .arg(scrubbed.
what());
2403 ctx.
hostname_ = fqdn_resp->getDomainName();
2410 .arg(question->getLabel())
2411 .arg(fqdn_resp->toText());
2412 answer->addOption(fqdn_resp);
2427 callout_handle->setArgument(
"query6", question);
2428 callout_handle->setArgument(
"response6", answer);
2429 callout_handle->setArgument(
"subnet6", subnet);
2430 callout_handle->setArgument(
"hostname", ctx.
hostname_);
2433 callout_handle->setArgument(
"ddns-params", ddns_params);
2439 string hook_hostname;
2440 bool hook_fwd_dns_update;
2441 bool hook_rev_dns_update;
2442 callout_handle->getArgument(
"hostname", hook_hostname);
2443 callout_handle->getArgument(
"fwd-update", hook_fwd_dns_update);
2444 callout_handle->getArgument(
"rev-update", hook_rev_dns_update);
2455 fqdn_resp = boost::dynamic_pointer_cast<Option6ClientFqdn>(answer->getOption(
D6O_CLIENT_FQDN));
2458 if (!(hook_fwd_dns_update || hook_rev_dns_update)) {
2485 <<
" encapsulating server's message must not be"
2486 <<
" NULL when creating DNS NameChangeRequest");
2499 bool do_fwd =
false;
2500 bool do_rev =
false;
2510 "client identifier is required when creating a new"
2511 " DNS NameChangeRequest");
2518 opt_fqdn->packDomainName(name_buf);
2519 const std::vector<uint8_t>& buf_vec = name_buf.
getVector();
2545 bool extended_only =
false;
2547 IOAddress ia_address = iaaddr->getAddress();
2548 for (
auto const& l : ia_ctx.reused_leases_) {
2549 if (l->addr_ == ia_address) {
2550 extended_only =
true;
2555 if (extended_only) {
2562 for (
auto const& l : ia_ctx.changed_leases_) {
2563 if (l->addr_ == ia_address) {
2567 bool ddns_changed = ((*(ctx.
duid_) != *(l->duid_)) ||
2568 (l->hostname_ != opt_fqdn->getDomainName()) ||
2569 (l->fqdn_fwd_ != do_fwd) || (l->fqdn_rev_ != do_rev));
2571 if ((l->reuseable_valid_lft_ > 0) ||
2572 (!ctx.
getDdnsParams()->getUpdateOnRenew() && !ddns_changed)) {
2573 extended_only =
true;
2587 if (!(do_fwd || do_rev) || (extended_only)) {
2602 do_rev, opt_fqdn->getDomainName(),
2603 iaaddr->getAddress().toText(),
2612 .arg(answer->getLabel())
2613 .arg(add_ncr->toText());
2623 remove_ncr->setNextNcr(add_ncr);
2625 }
else if (add_ncr) {
2633 getMACSources().get();
2635 for (
auto const& it : mac_sources) {
2636 hwaddr = pkt->getMAC(it);
2652 BOOST_FOREACH(
auto const& resv, resvs) {
2653 if ((resv.second.getPrefix() == lease->addr_) &&
2654 (resv.second.getPrefixLen() == lease->prefixlen_)) {
2655 return (resv.second.getPDExclude());
2662 Pool6Ptr pool = boost::dynamic_pointer_cast<Pool6>(
2665 return (pool->getPrefixExcludeOption());
2673 boost::shared_ptr<Option6IA> ia) {
2679 boost::dynamic_pointer_cast<Option6IAAddr>(ia->getOption(
D6O_IAADDR));
2682 hint = hint_opt->getAddress();
2687 .arg(query->getLabel())
2689 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2692 .arg(query->getLabel())
2694 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2714 "Server could not select subnet for"
2737 if (!leases.empty()) {
2738 lease = *leases.begin();
2752 .arg(query->getLabel())
2753 .arg(lease->addr_.toText())
2754 .arg(ia->getIAID());
2755 }
else if (lease->reuseable_valid_lft_ == 0) {
2757 .arg(query->getLabel())
2758 .arg(lease->addr_.toText())
2762 lease->valid_lft_ = lease->reuseable_valid_lft_;
2763 lease->preferred_lft_ = lease->reuseable_preferred_lft_;
2766 .arg(query->getLabel())
2767 .arg(lease->addr_.toText())
2774 "v6-ia-na-lease-reuses"),
2778 .arg(query->getLabel())
2780 .arg(lease->toText());
2783 setTeeTimes(lease->preferred_lft_, subnet, ia_rsp);
2786 lease->preferred_lft_,
2787 lease->valid_lft_));
2788 ia_rsp->addOption(addr);
2801 .arg(query->getLabel())
2802 .arg(ia->getIAID());
2804 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2806 "Sorry, no address could be"
2815 boost::shared_ptr<Option6IA> ia) {
2822 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
2825 hint = hint_opt->getAddress();
2830 .arg(query->getLabel())
2832 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2835 .arg(query->getLabel())
2837 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2855 "Sorry, no subnet available."));
2876 if (!leases.empty()) {
2880 uint32_t min_preferred_lft = (*leases.begin())->preferred_lft_;
2882 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2883 for (
auto const& l : leases) {
2889 .arg(query->getLabel())
2890 .arg(l->addr_.toText())
2891 .arg(
static_cast<int>(l->prefixlen_))
2892 .arg(ia->getIAID());
2893 }
else if (l->reuseable_valid_lft_ == 0) {
2895 .arg(query->getLabel())
2896 .arg(l->addr_.toText())
2897 .arg(
static_cast<int>(l->prefixlen_))
2901 l->valid_lft_ = l->reuseable_valid_lft_;
2902 l->preferred_lft_ = l->reuseable_preferred_lft_;
2904 .arg(query->getLabel())
2905 .arg(l->addr_.toText())
2906 .arg(
static_cast<int>(l->prefixlen_))
2913 "v6-ia-pd-lease-reuses"),
2918 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
2919 min_preferred_lft = l->preferred_lft_;
2922 boost::shared_ptr<Option6IAPrefix>
2924 l->prefixlen_, l->preferred_lft_,
2926 ia_rsp->addOption(addr);
2928 if (pd_exclude_requested) {
2930 if (pd_exclude_option) {
2931 addr->addOption(pd_exclude_option);
2950 .arg(query->getLabel())
2951 .arg(ia->getIAID());
2953 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2955 "Sorry, no prefixes could"
2964 boost::shared_ptr<Option6IA> ia) {
2967 .arg(query->getLabel())
2968 .arg(ia->getIAID());
2987 "Sorry, no known leases for this duid/iaid."));
2999 for (
auto const& it : addrs) {
3003 Option6IAAddrPtr iaaddr = boost::dynamic_pointer_cast<Option6IAAddr>(it.second);
3030 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
3033 for (
auto const& l : leases) {
3034 if (l->reuseable_valid_lft_ == 0) {
3036 .arg(query->getLabel())
3037 .arg(l->addr_.toText())
3038 .arg(ia->getIAID());
3040 l->valid_lft_ = l->reuseable_valid_lft_;
3041 l->preferred_lft_ = l->reuseable_preferred_lft_;
3043 .arg(query->getLabel())
3044 .arg(l->addr_.toText())
3051 "v6-ia-na-lease-reuses"),
3056 l->addr_, l->preferred_lft_, l->valid_lft_));
3057 ia_rsp->addOption(iaaddr);
3060 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
3061 min_preferred_lft = l->preferred_lft_;
3066 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
3076 if (
equalValues(query->getClientId(), l->duid_)) {
3079 ia_rsp->addOption(iaaddr);
3084 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
3092 .arg(query->getLabel())
3104 for (
auto const& hint : hints) {
3106 hint.getAddress(), 0, 0));
3107 ia_rsp->addOption(iaaddr);
3110 if (!leases.empty()) {
3116 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
3118 "Sorry, no addresses could be"
3119 " assigned at this time."));
3128 boost::shared_ptr<Option6IA> ia) {
3131 .arg(query->getLabel())
3132 .arg(ia->getIAID());
3149 "Sorry, no known PD leases"
3150 " for this duid/iaid."));
3170 " client sending Rebind to extend lifetime of the"
3171 " prefix (DUID=" << duid->toText() <<
", IAID="
3172 << ia->getIAID() <<
")");
3184 for (
auto const& it : addrs) {
3218 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
3222 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
3224 for (
auto const& l : leases) {
3225 if (l->reuseable_valid_lft_ == 0) {
3227 .arg(query->getLabel())
3228 .arg(l->addr_.toText())
3229 .arg(
static_cast<int>(l->prefixlen_))
3230 .arg(ia->getIAID());
3232 l->valid_lft_ = l->reuseable_valid_lft_;
3233 l->preferred_lft_ = l->reuseable_preferred_lft_;
3235 .arg(query->getLabel())
3236 .arg(l->addr_.toText())
3237 .arg(
static_cast<int>(l->prefixlen_))
3244 "v6-ia-pd-lease-reuses"),
3249 l->addr_, l->prefixlen_,
3250 l->preferred_lft_, l->valid_lft_));
3251 ia_rsp->addOption(prf);
3253 if (pd_exclude_requested) {
3255 if (pd_exclude_option) {
3256 prf->addOption(pd_exclude_option);
3261 if ((l->preferred_lft_ > 0) && (l->preferred_lft_ < min_preferred_lft)) {
3262 min_preferred_lft = l->preferred_lft_;
3267 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
3277 if (
equalValues(query->getClientId(), l->duid_)) {
3279 l->prefixlen_, 0, 0));
3280 ia_rsp->addOption(prefix);
3285 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
3290 for (
auto const& prefix : hints) {
3295 if (!prefix.getAddress().isV6Zero()) {
3297 prefix.getAddress(),
3298 prefix.getPrefixLength(),
3300 ia_rsp->addOption(prefix_opt);
3304 if (!leases.empty()) {
3311 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
3313 "Sorry, no prefixes could be"
3314 " assigned at this time."));
3334 for (
auto const& opt : query->options_) {
3335 switch (opt.second->getType()) {
3338 boost::dynamic_pointer_cast<
3341 reply->addOption(answer_opt);
3348 boost::dynamic_pointer_cast<
3351 reply->addOption(answer_opt);
3386 for (
auto const& opt : release->options_) {
3388 switch (opt.second->getType()) {
3391 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3394 reply->addOption(answer_opt);
3400 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3403 reply->addOption(answer_opt);
3420 reply->addOption(createStatusCode(*release, general_status,
3421 "Summary status for all processed IA_NAs"));
3426 int& general_status, boost::shared_ptr<Option6IA> ia,
3430 .arg(query->getLabel())
3431 .arg(ia->getIAID());
3447 if (!release_addr) {
3449 "You did not include an address in your RELEASE"));
3455 release_addr->getAddress());
3462 .arg(query->getLabel())
3463 .arg(release_addr->getAddress().toText());
3467 "Sorry, this address isn't assigned, can't release."));
3473 if (!lease->duid_) {
3479 .arg(query->getLabel())
3480 .arg(release_addr->getAddress().toText());
3484 "Database consistency check failed when trying to RELEASE"));
3488 if (*duid != *(lease->duid_)) {
3492 .arg(query->getLabel())
3493 .arg(release_addr->getAddress().toText())
3494 .arg(lease->duid_->toText());
3498 "This address does not belong to you, you can't release it"));
3502 if (ia->getIAID() != lease->iaid_) {
3505 .arg(query->getLabel())
3506 .arg(release_addr->getAddress().toText())
3508 .arg(ia->getIAID());
3510 "This is your address, but you used wrong IAID"));
3533 callout_handle->deleteAllArguments();
3536 callout_handle->setArgument(
"query6", query);
3539 callout_handle->setArgument(
"lease6", lease);
3551 .arg(query->getLabel());
3556 bool success =
false;
3557 bool expired =
false;
3564 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3565 expiration_cfg->getHoldReclaimedTime() &&
3568 lease->valid_lft_ = 0;
3569 lease->preferred_lft_ = 0;
3589 "Server failed to release a lease"));
3592 .arg(query->getLabel())
3593 .arg(lease->addr_.toText())
3602 .arg(query->getLabel())
3603 .arg(lease->addr_.toText())
3606 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3607 "Lease released. Thank you, please come again."));
3611 .arg(query->getLabel())
3612 .arg(lease->addr_.toText())
3616 .arg(query->getLabel())
3617 .arg(lease->addr_.toText())
3631 static_cast<int64_t
>(-1));
3635 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
3640 static_cast<int64_t
>(-1));
3650 int& general_status, boost::shared_ptr<Option6IA> ia,
3665 boost::shared_ptr<Option6IAPrefix> release_prefix =
3666 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
3667 if (!release_prefix) {
3669 "You did not include a prefix in your RELEASE"));
3675 release_prefix->getAddress());
3682 .arg(query->getLabel())
3683 .arg(release_prefix->getAddress().toText())
3684 .arg(
static_cast<int>(release_prefix->getLength()));
3688 "Sorry, this prefix isn't assigned, can't release."));
3694 if (!lease->duid_) {
3699 .arg(query->getLabel())
3700 .arg(release_prefix->getAddress().toText())
3701 .arg(
static_cast<int>(release_prefix->getLength()));
3705 "Database consistency check failed when trying to RELEASE"));
3709 if (*duid != *(lease->duid_)) {
3712 .arg(query->getLabel())
3713 .arg(release_prefix->getAddress().toText())
3714 .arg(
static_cast<int>(release_prefix->getLength()))
3715 .arg(lease->duid_->toText());
3719 "This address does not belong to you, you can't release it"));
3723 if (ia->getIAID() != lease->iaid_) {
3726 .arg(query->getLabel())
3727 .arg(release_prefix->getAddress().toText())
3728 .arg(
static_cast<int>(release_prefix->getLength()))
3730 .arg(ia->getIAID());
3732 "This is your address, but you used wrong IAID"));
3755 callout_handle->setArgument(
"query6", query);
3758 callout_handle->setArgument(
"lease6", lease);
3770 .arg(query->getLabel());
3775 bool success =
false;
3776 bool expired =
false;
3783 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3784 expiration_cfg->getHoldReclaimedTime() &&
3787 lease->valid_lft_ = 0;
3788 lease->preferred_lft_ = 0;
3808 "Server failed to release a lease"));
3811 .arg(query->getLabel())
3812 .arg(lease->addr_.toText())
3813 .arg(
static_cast<int>(lease->prefixlen_))
3821 .arg(query->getLabel())
3822 .arg(lease->addr_.toText())
3823 .arg(
static_cast<int>(lease->prefixlen_))
3826 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3827 "Lease released. Thank you, please come again."));
3831 .arg(query->getLabel())
3832 .arg(lease->addr_.toText())
3833 .arg(
static_cast<int>(lease->prefixlen_))
3837 .arg(query->getLabel())
3838 .arg(lease->addr_.toText())
3839 .arg(
static_cast<int>(lease->prefixlen_))
3848 static_cast<int64_t
>(-1));
3852 auto const& pool = subnet->getPool(
Lease::TYPE_PD, lease->addr_,
false);
3857 static_cast<int64_t
>(-1));
3868 .arg(query->makeLabel(query->getClientId(), 0))
3869 .arg(query->toText());
3871 for (
auto const& opt : query->options_) {
3872 switch (opt.second->getType()) {
3875 boost::dynamic_pointer_cast<
3878 answer->addOption(answer_opt);
3884 boost::dynamic_pointer_cast<
3887 answer->addOption(answer_opt);
3902 "Server rejected this request"));
3911 "Server rejected this request"));
3924 if (opt_rapid_commit) {
3927 .arg(solicit->getLabel());
3932 response->addOption(opt_rapid_commit);
3951 if (solicit->inClass(
"REJECT")) {
3952 reject(solicit, response);
3966 .arg(solicit->getLabel())
3967 .arg(solicit->getName())
3968 .arg(solicit->getClasses().toText());
3977 updateReservedFqdn(ctx, response);
3996 if (request->inClass(
"REJECT")) {
4011 .arg(request->getLabel())
4012 .arg(request->getName())
4013 .arg(request->getClasses().toText());
4022 updateReservedFqdn(ctx, reply);
4023 generateFqdn(reply, ctx);
4037 if (renew->inClass(
"REJECT")) {
4053 .arg(renew->getLabel())
4054 .arg(renew->getName())
4055 .arg(renew->getClasses().toText());
4064 updateReservedFqdn(ctx, reply);
4065 generateFqdn(reply, ctx);
4079 if (rebind->inClass(
"REJECT")) {
4095 .arg(rebind->getLabel())
4096 .arg(rebind->getName())
4097 .arg(rebind->getClasses().toText());
4106 updateReservedFqdn(ctx, reply);
4107 generateFqdn(reply, ctx);
4122 .arg(confirm->getLabel())
4123 .arg(confirm->getName())
4124 .arg(confirm->getClasses().toText());
4145 bool verified =
false;
4154 for (
auto const& ia : ias) {
4156 for (
auto const& opt : opts) {
4168 if (subnet && !subnet->inRange(iaaddr->getAddress())) {
4169 std::ostringstream status_msg;
4170 status_msg <<
"Address " << iaaddr->getAddress()
4171 <<
" is not on link.";
4172 reply->addOption(createStatusCode(*confirm,
4180 " to the Option6IAAddrPtr. This is programming"
4181 " error and should be reported");
4198 "All addresses are on-link"));
4201 "No subnet selected"));
4216 .arg(release->getLabel())
4217 .arg(release->getName())
4218 .arg(release->getClasses().toText());
4248 .arg(decline->getLabel())
4249 .arg(decline->getName())
4250 .arg(decline->getClasses().toText());
4289 for (
auto const& opt : decline->options_) {
4290 switch (opt.second->getType()) {
4293 boost::dynamic_pointer_cast<Option6IA>(opt.second),
4298 reply->addOption(answer_opt);
4319 int& general_status, boost::shared_ptr<Option6IA> ia,
4323 .arg(decline->getLabel())
4324 .arg(ia->getIAID());
4339 int total_addrs = 0;
4340 for (
auto const& opt : opts) {
4349 if (!decline_addr) {
4356 decline_addr->getAddress());
4361 .arg(decline->getLabel()).arg(decline_addr->getAddress().toText());
4369 "Server does not know about such an address."));
4377 if (!lease->duid_) {
4383 .arg(decline->getLabel())
4384 .arg(decline_addr->getAddress().toText());
4387 "Database consistency check failed when attempting Decline."));
4393 if (*duid != *(lease->duid_)) {
4397 .arg(decline->getLabel())
4398 .arg(decline_addr->getAddress().toText())
4399 .arg(lease->duid_->toText());
4402 "This address does not belong to you, you can't decline it"));
4408 if (ia->getIAID() != lease->iaid_) {
4411 .arg(decline->getLabel())
4412 .arg(lease->addr_.toText())
4416 "This is your address, but you used wrong IAID"));
4428 new_leases.push_back(lease);
4432 if (total_addrs == 0) {
4434 "No addresses sent in IA_NA"));
4447 container->addOption(status);
4452 boost::shared_ptr<Option6IA> ia_rsp) {
4476 callout_handle->setArgument(
"query6", decline);
4479 callout_handle->setArgument(
"lease6", lease);
4490 .arg(decline->getLabel())
4491 .arg(decline->getIface())
4492 .arg(lease->addr_.toText());
4500 .arg(decline->getLabel())
4501 .arg(decline->getIface())
4502 .arg(lease->addr_.toText());
4507 Lease6Ptr old_values = boost::make_shared<Lease6>(*lease);
4521 .arg(decline->getLabel())
4522 .arg(lease->addr_.toText())
4535 static_cast<int64_t
>(1));
4539 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
4544 static_cast<int64_t
>(1));
4552 .arg(lease->addr_.toText()).arg(lease->valid_lft_);
4554 ia_rsp->addOption(createStatusCode(*decline, *ia_rsp,
STATUS_Success,
4555 "Lease declined. Hopefully the next one will be better."));
4569 .arg(inf_request->getLabel())
4570 .arg(inf_request->getName())
4571 .arg(inf_request->getClasses().toText());
4627 if (allow_address_registration && !allow_address_registration->boolValue()) {
4629 .arg(ctx.
query_->getLabel());
4631 static_cast<int64_t
>(1));
4633 static_cast<int64_t
>(1));
4646 IOAddress addr = addr_reg_inf->getRemoteAddr();
4649 size_t relay_level = addr_reg_inf->relay_info_.size();
4650 if (relay_level > 0) {
4651 addr = addr_reg_inf->getRelay6PeerAddress(relay_level - 1);
4656 const uint32_t no_iaid = 0;
4659 bool invalid =
false;
4662 if (addr_reg_inf->getOption(
D6O_IA_NA)) {
4665 static_cast<int64_t
>(1));
4670 if (addr_reg_inf->getOption(
D6O_IA_TA)) {
4673 static_cast<int64_t
>(1));
4678 if (addr_reg_inf->getOption(
D6O_IA_PD)) {
4681 static_cast<int64_t
>(1));
4688 if (addrs.size() != 1) {
4691 static_cast<int64_t
>(1));
4693 << addrs.size() <<
" received");
4695 iaaddr = boost::dynamic_pointer_cast<Option6IAAddr>(addrs.begin()->second);
4699 static_cast<int64_t
>(1));
4704 if (addr != iaaddr->getAddress()) {
4707 static_cast<int64_t
>(1));
4709 <<
" wants to register " << iaaddr->getAddress());
4713 if (!subnet->inRange(addr)) {
4715 static_cast<int64_t
>(1));
4717 << subnet->
toText() <<
" (id " << subnet->getID() <<
")");
4728 static_cast<int64_t
>(1));
4735 if (!hosts.empty()) {
4738 static_cast<int64_t
>(1));
4741 }
catch (
const std::exception &ex) {
4748 static_cast<int64_t
>(1));
4751 static_cast<int64_t
>(1));
4757 if (old_lease->duid_ && (*ctx.
duid_ != *(old_lease->duid_))) {
4760 .arg(ctx.
duid_->toText())
4761 .arg(old_lease->duid_->toText());
4767 addr_reg_inf->getTransid()));
4768 addr_reg_rep->addOption(iaaddr);
4776 ia->addOption(iaaddr);
4783 no_iaid, iaaddr->getPreferred(),
4784 iaaddr->getValid(), subnet->getID(),
4796 .arg(addr_reg_inf->getLabel())
4797 .arg(addr_reg_inf->getName())
4798 .arg(addr_reg_inf->getClasses().toText());
4816 callout_handle->setArgument(
"query6", addr_reg_inf);
4820 callout_handle->setArgument(
"response6", addr_reg_rep);
4823 callout_handle->setArgument(
"address6", addr);
4826 callout_handle->setArgument(
"old_lease6", old_lease);
4829 callout_handle->setArgument(
"new_lease6", lease);
4839 .arg(addr_reg_inf->getLabel())
4840 .arg(old_lease ?
"update" :
"add")
4849 .arg(addr_reg_inf->getLabel())
4860 }
catch (
const std::exception& ex) {
4870 if (old_lease->subnet_id_ != lease->subnet_id_) {
4874 static_cast<int64_t
>(-1));
4878 static_cast<int64_t
>(1));
4881 "cumulative-registered-nas"),
4882 static_cast<int64_t
>(1));
4895 static_cast<int64_t
>(1));
4898 "cumulative-registered-nas"),
4899 static_cast<int64_t
>(1));
4901 static_cast<int64_t
>(1));
4908 updateReservedFqdn(ctx, addr_reg_rep);
4909 generateFqdn(addr_reg_rep, ctx);
4912 return (addr_reg_rep);
4915void Dhcpv6Srv::classifyByVendor(
const Pkt6Ptr& pkt) {
4918 vclass = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
4919 if (!vclass || vclass->getTuplesNum() == 0) {
4938 pkt->addClass(
"ALL");
4941 classifyByVendor(pkt);
4952 for (
auto const& it : *defs_ptr) {
4960 if (it->getAdditional()) {
4964 if (it->getDependOnKnown() != depend_on_known) {
4967 it->test(pkt, expr_ptr);
4976 for (
auto const& def : *defs_ptr) {
4980 if (def->getMatchExpr()) {
4981 pkt->classes_.erase(def->getName());
4991 for (
auto const& cclass : classes) {
4992 pkt->addClass(cclass);
5002 ctx.
subnet_->getSharedNetwork(shared_network);
5003 if (shared_network) {
5005 if (host && (host->getIPv6SubnetID() != SUBNET_ID_GLOBAL)) {
5024 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
5026 resource.getAddress(),
5029 const ClientClasses& pool_to_add = pool->getAdditionalClasses();
5030 for (
auto const& cclass : pool_to_add) {
5037 const ClientClasses& to_add = subnet->getAdditionalClasses();
5038 for (
auto const& cclass : to_add) {
5044 subnet->getSharedNetwork(network);
5046 const ClientClasses& net_to_add = network->getAdditionalClasses();
5047 for (
auto const& cclass : net_to_add) {
5057 for (
auto const& cclass : classes) {
5072 pkt->addClass(cclass);
5080 .arg(pkt->getLabel())
5082 .arg(status ?
"true" :
"false");
5085 pkt->addClass(cclass);
5089 .arg(pkt->getLabel())
5101 " a message must not be NULL when updating reserved FQDN");
5112 std::string name = fqdn->getDomainName();
5124 if (new_name != name) {
5129 answer->addOption(fqdn);
5135Dhcpv6Srv::generateFqdn(
const Pkt6Ptr& answer,
5136 AllocEngine::ClientContext6& ctx) {
5138 isc_throw(isc::Unexpected,
"an instance of the object encapsulating"
5139 " a message must not be NULL when generating FQDN");
5150 if (!fqdn || !fqdn->getDomainName().empty()) {
5164 if (!iaaddr || iaaddr->getValid() == 0) {
5169 IOAddress addr = iaaddr->getAddress();
5170 std::string generated_name =
5174 .arg(answer->getLabel())
5175 .arg(generated_name);
5192 lease->hostname_ = generated_name;
5193 lease->reuseable_valid_lft_ = 0;
5197 isc_throw(isc::Unexpected,
"there is no lease in the database "
5198 " for address " << addr <<
", so as it is impossible"
5199 " to update FQDN data. This is a programmatic error"
5200 " as the given address is now being handed to the"
5208 answer->addOption(fqdn);
5210 }
catch (
const Exception& ex) {
5212 .arg(answer->getLabel())
5226 this, ph::_1, ph::_2));
5245 .arg((ncr ? ncr->toText() :
" NULL "));
5254 std::stringstream tmp;
5258 tmp <<
" (" << SOURCE_OF_INSTALLATION <<
")" << endl;
5259 tmp <<
"premium: " << PREMIUM_EXTENDED_VERSION << endl;
5260 tmp <<
"linked with:" << endl;
5265 tmp << endl <<
"lease backends:";
5267 tmp << endl <<
"- " <<
version;
5272 tmp << endl <<
"host backends:";
5274 tmp << endl <<
"- " <<
version;
5279 tmp << endl <<
"forensic backends:";
5281 tmp << endl <<
"- " <<
version;
5292 if (query->relay_info_.empty()) {
5303 for (
int i = query->relay_info_.size(); i > 0 ; --i) {
5305 if (rsoo_container) {
5310 for (
auto const& opt : rsoo) {
5314 if (cfg_rsoo->enabled(opt.second->getType()) &&
5315 !rsp->getOption(opt.second->getType())) {
5316 rsp->addOption(opt.second);
5325 if (query->relay_info_.empty()) {
5333 return (query->getRemotePort());
5339void Dhcpv6Srv::processStatsReceived(
const Pkt6Ptr& query) {
5343 string stat_name =
"pkt6-unknown-received";
5344 switch (query->getType()) {
5346 stat_name =
"pkt6-solicit-received";
5350 stat_name =
"pkt6-advertise-received";
5353 stat_name =
"pkt6-request-received";
5356 stat_name =
"pkt6-confirm-received";
5359 stat_name =
"pkt6-renew-received";
5362 stat_name =
"pkt6-rebind-received";
5366 stat_name =
"pkt6-reply-received";
5369 stat_name =
"pkt6-release-received";
5372 stat_name =
"pkt6-decline-received";
5375 stat_name =
"pkt6-reconfigure-received";
5378 stat_name =
"pkt6-infrequest-received";
5381 stat_name =
"pkt6-dhcpv4-query-received";
5385 stat_name =
"pkt6-dhcpv4-response-received";
5388 stat_name =
"pkt6-addr-reg-inform-received";
5392 stat_name =
"pkt6-addr-reg-reply-received";
5407 switch (response->getType()) {
5409 stat_name =
"pkt6-advertise-sent";
5412 stat_name =
"pkt6-reply-sent";
5415 stat_name =
"pkt6-dhcpv4-response-sent";
5418 stat_name =
"pkt6-addr-reg-reply-sent";
5429 return (
Hooks.hook_index_buffer6_send_);
5433Dhcpv6Srv::requestedInORO(
const Pkt6Ptr& query,
const uint16_t code)
const {
5435 boost::dynamic_pointer_cast<OptionUint16Array>(query->getOption(
D6O_ORO));
5438 const std::vector<uint16_t>& codes = oro->getValues();
5439 return (std::find(codes.begin(), codes.end(), code) != codes.end());
5445tuple<bool, uint32_t>
5446Dhcpv6Srv::parkingLimitExceeded(
string const& hook_label) {
5448 uint32_t parked_packet_limit(0);
5452 parked_packet_limit = ppl->intValue();
5455 if (parked_packet_limit) {
5459 if (parking_lot && parked_packet_limit <= parking_lot->size()) {
5460 return make_tuple(
true, parked_packet_limit);
5463 return make_tuple(
false, parked_packet_limit);
5474 char const*
const rotate(getenv(
"KEA_DHCP6_FUZZING_ROTATE_PORT"));
5478 while (!locker.
lock()) {
5479 this_thread::sleep_for(1s);
5482 port_file.open(
"/tmp/port6.txt", ios::in);
5485 getline(port_file, line);
5497 port_file.open(
"/tmp/port6.txt", ios::out | ios::trunc);
5498 port_file << to_string(port) << endl;
5513 uint32_t t2_time = 0;
5516 if (!subnet->getT2().unspecified()) {
5517 t2_time = subnet->getT2();
5518 }
else if (subnet->getCalculateTeeTimes()) {
5520 t2_time =
static_cast<uint32_t
>(round(subnet->getT2Percent() * preferred_lft));
5524 resp->setT2(t2_time);
5527 uint32_t t1_time = 0;
5530 if (!subnet->getT1().unspecified()) {
5531 t1_time = subnet->getT1();
5532 }
else if (subnet->getCalculateTeeTimes()) {
5534 t1_time =
static_cast<uint32_t
>(round(subnet->getT1Percent() * preferred_lft));
5538 if (t1_time < t2_time) {
5539 resp->setT1(t1_time);
5550 bool reprocess_client_name =
false;
5557 if (iaaddr && (iaaddr->getValid() > 0)) {
5559 auto pool = ddns_params->setPoolFromAddress(iaaddr->getAddress());
5562 reprocess_client_name = pool->hasDdnsParameters();
5568 if (ctx.
subnet_ && orig_subnet && (orig_subnet->getID() != ctx.
subnet_->getID())) {
5573 orig_subnet->getSharedNetwork(network);
5575 .arg(question->getLabel())
5576 .arg(orig_subnet->toText())
5578 .arg(network ? network->getName() :
"<no network?>");
5581 reprocess_client_name =
true;
5586 if (reprocess_client_name) {
5588 std::string prev_hostname = ctx.
hostname_;
5609 l->reuseable_valid_lft_ = 0;
5617 static std::list<std::list<std::string>>
const list({
5618 {
"config-control",
"config-databases",
"[]"},
5619 {
"hooks-libraries",
"[]",
"parameters",
"*"},
5621 {
"hosts-databases",
"[]"},
Defines elements for storing the names of client classes.
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A generic exception that is thrown when an unexpected error condition occurs.
The IOAddress class represents an IP addresses (version agnostic).
std::string toText() const
Convert the address to a string.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
void clearIOServices()
Clear the list of IOService objects.
static IOServiceMgr & instance()
Access the IOServiceMgr singleton instance.
size_t pollIOServices()
Poll IOService objects.
The IOService class is a wrapper for the ASIO io_context class.
static std::string getVersion()
Get version string.
DHCPv4 and DHCPv6 allocation engine.
std::vector< Resource > HintContainer
Container for client's hints.
Implementation of the mechanisms to control the use of the Configuration Backends by the DHCPv6 serve...
@ ALLOW_ADDRESS_REGISTRATION
@ EARLY_GLOBAL_RESERVATIONS_LOOKUP
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
static SubnetSelector initSelector(const Pkt6Ptr &query)
Build selector from a client's message.
Container for storing client class names.
void insert(const ClientClass &class_name)
Insert an element.
static std::string escape(const std::string &name, bool escape_escape=true)
Escape a client class name.
std::string toText(const std::string &separator=", ") const
Returns all class names as text.
Client race avoidance RAII handler.
bool tryLock(Pkt4Ptr query, ContinuationPtr cont=ContinuationPtr())
Tries to acquires a client.
D2ClientMgr isolates Kea from the details of being a D2 client.
std::string generateFqdn(const asiolink::IOAddress &address, const DdnsParams &ddns_params, const bool trailing_dot=true) const
Builds a FQDN based on the configuration and given IP address.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS is enabled.
void getUpdateDirections(const T &fqdn_resp, bool &forward, bool &reverse)
Get directional update flags based on server FQDN flags.
void stop()
Stop the sender.
void suspendUpdates()
Suspends sending requests.
void adjustDomainName(const T &fqdn, T &fqdn_resp, const DdnsParams &ddns_params)
Set server FQDN name based on configuration and a given FQDN.
void sendRequest(dhcp_ddns::NameChangeRequestPtr &ncr)
Send the given NameChangeRequests to kea-dhcp-ddns.
void stopSender()
Disables sending NameChangeRequests to kea-dhcp-ddns.
void adjustFqdnFlags(const T &fqdn, T &fqdn_resp, const DdnsParams &ddns_params)
Set server FQDN flags based on configuration and a given FQDN.
std::string qualifyName(const std::string &partial_name, const DdnsParams &ddns_params, const bool trailing_dot) const
Adds a qualifying suffix to a given domain name.
void startSender(D2ClientErrorHandler error_handler, const isc::asiolink::IOServicePtr &io_service)
Enables sending NameChangeRequests to kea-dhcp-ddns.
This exception is thrown when DHCP server hits the error which should result in discarding the messag...
Factory for generating DUIDs (DHCP Unique Identifiers).
DuidPtr get()
Returns current DUID.
Holds DUID (DHCPv6 Unique Identifier).
static constexpr size_t MIN_DUID_LEN
minimum duid size
static const DUID & EMPTY()
Defines the constant "empty" DUID.
static constexpr size_t MAX_DUID_LEN
maximum duid size
const std::vector< uint8_t > & getDuid() const
Returns a const reference to the actual DUID value.
void send(const Pkt6Ptr &pkt)
Send message over IPC.
void close()
Close communication socket.
static Dhcp6to4Ipc & instance()
Returns pointer to the sole instance of Dhcp6to4Ipc.
static uint16_t client_port
std::queue< isc::dhcp_ddns::NameChangeRequest > name_change_reqs_
Holds a list of isc::dhcp_ddns::NameChangeRequest objects, which are waiting for sending to kea-dhcp-...
void shutdown() override
Instructs the server to shut down.
RequirementLevel
defines if certain option may, must or must not appear
OptionPtr getServerID()
Returns server-identifier option.
OptionPtr rejectIA_PD(const isc::dhcp::Pkt6Ptr &query, Option6IAPtr ia)
Reject IA_PD.
Pkt6Ptr processPacket(Pkt6Ptr query)
Process a single incoming DHCPv6 packet.
Pkt6Ptr processLocalizedQuery6(AllocEngine::ClientContext6 &ctx)
Process a localized incoming DHCPv6 query.
void processPacketAndSendResponseNoThrow(Pkt6Ptr query)
Process a single incoming DHCPv6 packet and sends the response.
OptionPtr extendIA_PD(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Extends lifetime of the prefix.
void setReservedClientClasses(const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
Assigns classes retrieved from host reservation database.
Pkt6Ptr processDecline(AllocEngine::ClientContext6 &ctx)
Process incoming Decline message.
void evaluateClasses(const Pkt6Ptr &pkt, bool depend_on_known)
Evaluate classes.
Pkt6Ptr processRenew(AllocEngine::ClientContext6 &ctx)
Processes incoming Renew message.
static void processStatsSent(const Pkt6Ptr &response)
Updates statistics for transmitted packets.
void reject(const Pkt6Ptr &query, Pkt6Ptr &answer)
Reject query.
void evaluateAdditionalClasses(const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx)
Evaluates classes in the additional classes lists.
void processLocalizedQuery6AndSendResponse(Pkt6Ptr query, AllocEngine::ClientContext6 &ctx)
Process a localized incoming DHCPv6 query.
int run()
Main server processing loop.
void setPacketStatisticsDefaults()
This function sets statistics related to DHCPv6 packets processing to their initial values.
bool sanityCheck(const Pkt6Ptr &pkt)
Verifies if specified packet meets RFC requirements.
static uint16_t checkRelaySourcePort(const Pkt6Ptr &query)
Used for DHCPv4-over-DHCPv6 too.
void assignLeases(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Assigns leases.
void stopD2()
Stops DHCP_DDNS client IO if DDNS updates are enabled.
void copyClientOptions(const Pkt6Ptr &question, Pkt6Ptr &answer)
Copies required options from client message to server answer.
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
virtual void sendPacket(const Pkt6Ptr &pkt)
dummy wrapper around IfaceMgr::send()
bool testServerID(const Pkt6Ptr &pkt)
Compare received server id with our server id.
virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
Implements the error handler for DHCP_DDNS IO errors.
OptionPtr declineIA(const Pkt6Ptr &decline, const DuidPtr &duid, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Collection &new_leases)
Declines leases in a single IA_NA option.
OptionPtr rejectIA_NA(const isc::dhcp::Pkt6Ptr &query, Option6IAPtr ia)
Reject IA_NA.
uint16_t getServerPort() const
Get UDP port on which server should listen.
void runOne()
Main server processing step.
virtual Pkt6Ptr receivePacket(int timeout)
dummy wrapper around IfaceMgr::receive6
void processPacketBufferSend(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &rsp)
Executes buffer6_send callout and sends the response.
OptionPtr releaseIA_NA(const DuidPtr &duid, const Pkt6Ptr &query, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Ptr &old_lease)
Releases specific IA_NA option.
void buildCfgOptionList(const Pkt6Ptr &question, AllocEngine::ClientContext6 &ctx, CfgOptionList &co_list)
Build the configured option list.
void appendDefaultOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
Appends default options to server's answer.
OptionPtr assignIA_NA(const isc::dhcp::Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Processes IA_NA option (and assigns addresses if necessary).
static const std::string VENDOR_CLASS_PREFIX
this is a prefix added to the content of vendor-class option
OptionPtr serverid_
Server DUID (to be sent in server-identifier option).
void setTeeTimes(uint32_t preferred_lft, const ConstSubnet6Ptr &subnet, Option6IAPtr &resp)
Sets the T1 and T2 timers in the outbound IA.
void conditionallySetReservedClientClasses(const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
Assigns classes retrieved from host reservation database if they haven't been yet set.
void processPacketAndSendResponse(Pkt6Ptr query)
Process a single incoming DHCPv6 packet and sends the response.
OptionPtr releaseIA_PD(const DuidPtr &duid, const Pkt6Ptr &query, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Ptr &old_lease)
Releases specific IA_PD option.
void processDhcp4Query(const Pkt6Ptr &dhcp4_query)
Processes incoming DHCPv4-query message.
Pkt6Ptr processRebind(AllocEngine::ClientContext6 &ctx)
Processes incoming Rebind message.
bool earlyGHRLookup(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx)
Initialize client context and perform early global reservations lookup.
void initContext0(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx)
Initialize client context (first part).
virtual ~Dhcpv6Srv()
Destructor. Used during DHCPv6 service shutdown.
void initContext(AllocEngine::ClientContext6 &ctx, bool &drop)
Initializes client context for specified packet.
Pkt6Ptr processRequest(AllocEngine::ClientContext6 &ctx)
Processes incoming Request and returns Reply response.
void sendResponseNoThrow(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr query, Pkt6Ptr &rsp, ConstSubnet6Ptr &subnet)
Process an unparked DHCPv6 packet and sends the response.
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets for kea-dhcp6.
OptionPtr assignIA_PD(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, boost::shared_ptr< Option6IA > ia)
Processes IA_PD option (and assigns prefixes if necessary).
bool testUnicast(const Pkt6Ptr &pkt) const
Check if the message can be sent to unicast.
Pkt6Ptr processRelease(AllocEngine::ClientContext6 &ctx)
Process incoming Release message.
void processClientFqdn(const Pkt6Ptr &question, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Processes Client FQDN Option.
void setStatusCode(boost::shared_ptr< Option6IA > &container, const OptionPtr &status)
A simple utility method that sets the status code.
static int getHookIndexBuffer6Send()
Returns the index of the buffer6_send hook.
void classifyPacket(const Pkt6Ptr &pkt)
Assigns incoming packet to zero or more classes.
static HWAddrPtr getMAC(const Pkt6Ptr &pkt)
Attempts to get a MAC/hardware address using configured sources.
Dhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Default constructor.
bool declineLeases(const Pkt6Ptr &decline, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to decline all leases in specified Decline message.
void releaseLeases(const Pkt6Ptr &release, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to release received addresses.
void extendLeases(const Pkt6Ptr &query, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to extend the lifetime of IAs.
void processRSOO(const Pkt6Ptr &query, const Pkt6Ptr &rsp)
Processes Relay-supplied options, if present.
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
Pkt6Ptr processAddrRegInform(AllocEngine::ClientContext6 &ctx)
Processes incoming Addr-reg-inform message.
OptionPtr extendIA_NA(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Extends lifetime of the specific IA_NA option.
Pkt6Ptr processConfirm(AllocEngine::ClientContext6 &ctx)
Processes incoming Confirm message and returns Reply.
void sanityCheckDUID(const OptionPtr &opt, const std::string &opt_name)
verifies if received DUID option (client-id or server-id) is sane
static void setHostIdentifiers(AllocEngine::ClientContext6 &ctx)
Set host identifiers within a context.
void processPacketPktSend(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp, ConstSubnet6Ptr &subnet)
Executes pkt6_send callout.
Pkt6Ptr processDhcp6Query(Pkt6Ptr query)
Process a single incoming DHCPv6 query.
void processDhcp6QueryAndSendResponse(Pkt6Ptr query)
Process a single incoming DHCPv6 query.
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
void appendRequestedOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
Appends requested options to server's answer.
uint16_t client_port_
UDP port number to which server sends all responses.
CBControlDHCPv6Ptr cb_control_
Controls access to the configuration backends.
isc::dhcp::ConstSubnet6Ptr selectSubnet(const Pkt6Ptr &question, bool &drop)
Selects a subnet for a given client's packet.
volatile bool shutdown_
Indicates if shutdown is in progress.
void checkPostAssignmentChanges(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const ConstSubnet6Ptr orig_subnet)
Iterates over new leases, update stale DNS entries.
Pkt6Ptr processSolicit(AllocEngine::ClientContext6 &ctx)
Processes incoming Solicit and returns response.
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
static std::string duidToString(const OptionPtr &opt)
converts DUID to text Converts content of DUID option to a text representation, e....
OptionPtr getPDExclude(const AllocEngine::ClientContext6 &ctx, const Lease6Ptr &lease)
Return the PD exclude option to include.
static void removeDependentEvaluatedClasses(const Pkt6Ptr &pkt)
Removed evaluated client classes.
void createNameChangeRequests(const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Creates a number of isc::dhcp_ddns::NameChangeRequest objects based on the DHCPv6 Client FQDN Option.
Pkt6Ptr processInfRequest(AllocEngine::ClientContext6 &ctx)
Processes incoming Information-request message.
uint16_t server_port_
UDP port number on which server listens.
void appendRequestedVendorOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const CfgOptionList &co_list)
Appends requested vendor options to server's answer.
bool declineLease(const Pkt6Ptr &decline, const Lease6Ptr lease, boost::shared_ptr< Option6IA > ia_rsp)
Declines specific IPv6 lease.
void discardPackets()
Discards parked packets Clears the packet parking lots of all packets.
Exception thrown when host name sanitizing reduces the domain name to an empty string.
static std::list< std::string > getDBVersions()
Return extended version info for registered backends.
ConstHostCollection getAll6(const SubnetID &subnet_id, const HostMgrOperationTarget target) const
Return all hosts in a DHCPv6 subnet.
static void create()
Creates new instance of the HostMgr.
static HostMgr & instance()
Returns a sole instance of the HostMgr.
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
IdentifierType
Type of the host identifier.
@ IDENT_FLEX
Flexible host identifier.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
bool send(const Pkt6Ptr &pkt)
Sends an IPv6 packet.
void closeSockets()
Closes all open sockets.
static TrackingLeaseMgr & instance()
Return current lease manager.
static std::list< std::string > getDBVersions()
Return extended version info for registered backends.
static void destroy()
Destroy lease manager.
virtual bool deleteLease(const Lease4Ptr &lease)=0
Deletes an IPv4 lease.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const =0
Returns existing IPv6 lease for a given IPv6 address.
virtual void updateLease6(const Lease6Ptr &lease6)=0
Updates IPv6 lease.
static std::list< std::string > getDBVersions()
Return extended version info for registered backends.
static void splitNtpServerOptions6(isc::dhcp::OptionCollection &options)
Split NTP server option to one suboption per instance.
Controls the DHCP service enabling status.
Represents DHCPv6 Client FQDN Option (code 39).
static const uint8_t FLAG_S
S bit.
static const uint8_t FLAG_N
N bit.
Class that represents IAPREFIX option in DHCPv6.
uint32_t getIAID() const
Returns IA identifier.
OptionPtr option_
Option instance.
bool allowedForClientClasses(const ClientClasses &cclasses) const
Validates an OptionDescriptor's client-classes against a list of classes.
This class represents vendor-specific information option.
const OptionCollection & getOptions() const
Returns all encapsulated options.
OptionPtr getOption(uint16_t type) const
Returns shared_ptr to suboption of specific type.
Represents a DHCPv6 packet.
virtual std::string getLabel() const
Returns text representation of the primary packet identifiers.
An exception that is thrown if a DHCPv6 protocol violation occurs while processing a message (e....
RAII object enabling copying options retrieved from the packet.
Exception thrown when a call to select is interrupted by a signal.
Exception thrown during option unpacking This exception is thrown when an error has occurred,...
Container class for handling the DHCID value within a NameChangeRequest.
Represents a DHCP-DDNS client request.
static std::string const & resultToText(Result const &result)
Convert enum to string.
Result
Defines the outcome of an asynchronous NCR send.
@ NEXT_STEP_PARK
park the packet
@ NEXT_STEP_CONTINUE
continue normally
@ NEXT_STEP_DROP
drop the packet
@ NEXT_STEP_SKIP
skip the next processing step
static int registerHook(const std::string &name)
Register Hook.
static bool calloutsPresent(int index)
Are callouts present?
static std::vector< std::string > getLibraryNames()
Return list of loaded libraries.
static bool unloadLibraries()
Unload libraries.
static void park(const std::string &hook_name, T parked_object, std::function< void()> unpark_callback)
Park an object (packet).
static void callCallouts(int index, CalloutHandle &handle)
Calls the callouts for a given hook.
static void prepareUnloadLibraries()
Prepare the unloading of libraries.
static bool drop(const std::string &hook_name, T parked_object)
Removes parked object without calling a callback.
static void clearParkingLots()
Clears any parking packets.
Wrapper class around callout handle which automatically resets handle's state.
static ServerHooks & getServerHooks()
Return ServerHooks object.
static std::string getVersion()
Version.
File-based Interprocess Sync Class.
Interprocess Sync Locker Class.
bool unlock()
Release the lock.
bool lock()
Acquire the lock (blocks if something else has acquired a lock on the same task name).
int getExitValue()
Fetches the exit value.
Statistics Manager class.
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.
RAII class creating a critical section.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
ThreadPool< std::function< void()> > & getThreadPool()
Get the dhcp thread pool.
void apply(bool enabled, uint32_t thread_count, uint32_t queue_size)
Apply the multi-threading related settings.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
const std::vector< uint8_t > & getVector() const
Return the buffer.
Defines classes for storing client class definitions.
int version()
returns Kea hooks version.
Defines the D2ClientConfig class.
Defines the D2ClientMgr class.
@ DHCPV6_INFORMATION_REQUEST
Defines the Dhcp6to4Ipc class.
#define VENDOR_ID_CABLE_LABS
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< OptionUint16Array > OptionUint16ArrayPtr
OptionIntArray< uint16_t > OptionUint16Array
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.
When a message is logged with DEBUG severity, the debug level associated with the message is also spe...
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< const Element > ConstElementPtr
ConflictResolutionMode StringToConflictResolutionMode(const std::string &mode_str)
Function which converts string to ConflictResolutionMode enum values.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
const isc::log::MessageID DHCP6_DDNS_REQUEST_SEND_FAILED
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
const isc::log::MessageID DHCP6_PD_LEASE_ADVERT
const isc::log::MessageID DHCP6_BUFFER_RECEIVED
const isc::log::MessageID DHCP6_RELEASE_NA_DELETED
isc::log::Logger bad_packet6_logger(DHCP6_BAD_PACKET_LOGGER_NAME)
Logger for rejected packets.
const isc::log::MessageID DHCP6_PACKET_DROP_PARSE_FAIL
const isc::log::MessageID DHCP6_ADDITIONAL_CLASS_NO_TEST
const isc::log::MessageID DHCP6_ADDITIONAL_CLASS_EVAL_RESULT
const isc::log::MessageID DHCP6_RELEASE_PD_DELETED
const isc::log::MessageID DHCP6_PACKET_REJECT_CLASS
const isc::log::MessageID DHCP6_LEASE_ALLOC
const isc::log::MessageID DHCP6_FLEX_ID
const isc::log::MessageID DHCP6_REGISTERED_LEASE_ADD_FAIL
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional< double > &ddns_ttl_percent, const util::Optional< uint32_t > &ddns_ttl, const util::Optional< uint32_t > &ddns_ttl_min, const util::Optional< uint32_t > &ddns_ttl_max)
Calculates TTL for a DNS resource record based on lease life time.
const isc::log::MessageID DHCP6_PACKET_PROCESS_EXCEPTION_MAIN
const isc::log::MessageID DHCP6_HOOK_PACKET_SEND_SKIP
const isc::log::MessageID DHCP6_ADDR_REG_INFORM_CLIENT_CHANGE
const isc::log::MessageID DHCP6_SUBNET_SELECTION_FAILED
const isc::log::MessageID DHCP6_PACKET_DROP_SERVERID_MISMATCH
const isc::log::MessageID DHCP6_HOOK_DECLINE_SKIP
const isc::log::MessageID DHCP6_PD_LEASE_REUSE
const isc::log::MessageID DHCP6_PACKET_DROP_UNICAST
const isc::log::MessageID DHCP6_LEASE_PD_WITHOUT_DUID
const isc::log::MessageID DHCP6_LEASE_ALLOC_FAIL
const isc::log::MessageID DHCP6_ADDITIONAL_CLASS_UNDEFINED
const isc::log::MessageID DHCP6_PACKET_SEND_FAIL
const isc::log::MessageID DHCP6_PACKET_PROCESS_EXCEPTION
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates NameChangeRequest from the DHCPv4 lease and queues it to be sent to D2.
const isc::log::MessageID DHCP6_CLIENT_FQDN_SCRUBBED_EMPTY
const isc::log::MessageID DHCP6_QUERY_LABEL
const isc::log::MessageID DHCP6_BUFFER_UNPACK
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
std::vector< uint32_t > CfgMACSources
Container for defined MAC/hardware address sources.
const isc::log::MessageID DHCP6_SRV_D2STOP_ERROR
const isc::log::MessageID DHCP6_REGISTERED_LEASE_UPDATE_FAIL
const isc::log::MessageID DHCP6_PACKET_SEND
const isc::log::MessageID DHCP6_DECLINE_FAIL_LEASE_WITHOUT_DUID
const int DBG_DHCP6_BASIC_DATA
Debug level used to log the traces with some basic data.
const isc::log::MessageID DHCP6_HOOK_PACKET_RCVD_SKIP
const isc::log::MessageID DHCP6_ADDR6_REGISTER_DISABLED_DROP
const isc::log::MessageID DHCP6_ADDITIONAL_CLASS_EVAL_ERROR
boost::shared_ptr< DUID > DuidPtr
const isc::log::MessageID DHCP6_OPEN_SOCKET
const isc::log::MessageID DHCP6_PACK_FAIL
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID
const isc::log::MessageID DHCP6_HOOK_DDNS_UPDATE
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
const int DBG_DHCP6_HOOKS
Debug level used to trace hook related operations.
const isc::log::MessageID DHCP6_HOOK_LEASE6_RELEASE_NA_SKIP
ContinuationPtr makeContinuation(Continuation &&cont)
Continuation factory.
const int DBG_DHCP6_START
Debug level used to log information during server startup.
const isc::log::MessageID DHCP6_PD_LEASE_ALLOC
const isc::log::MessageID DHCP6_DDNS_GENERATE_FQDN
const isc::log::MessageID DHCP6_RELEASE_PD_EXPIRED
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
const isc::log::MessageID DHCP6_DDNS_REMOVE_OLD_LEASE_FQDN
boost::shared_ptr< const CfgRSOO > ConstCfgRSOOPtr
Pointer to the const object.
boost::shared_ptr< const CfgHostOperations > ConstCfgHostOperationsPtr
Pointer to the const object.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
const isc::log::MessageID DHCP6_SUBNET_DATA
const isc::log::MessageID DHCP6_UNKNOWN_MSG_RECEIVED
boost::shared_ptr< ClientClassDef > ClientClassDefPtr
a pointer to an ClientClassDef
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
const isc::log::MessageID DHCP6_HOOK_SUBNET6_SELECT_DROP
const isc::log::MessageID DHCP6_ADD_GLOBAL_STATUS_CODE
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
const isc::log::MessageID DHCP6_DDNS_RESPONSE_FQDN_DATA
const isc::log::MessageID DHCP6_RELEASE_NA
const isc::log::MessageID DHCP6_CLASSES_ASSIGNED
const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL
const isc::log::MessageID DHCP6_PROCESS_IA_NA_EXTEND
std::pair< IPv6ResrvIterator, IPv6ResrvIterator > IPv6ResrvRange
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL
const isc::log::MessageID DHCP6_SRV_CONSTRUCT_ERROR
const isc::log::MessageID DHCP6_LEASE_RENEW
const char * DOCSIS3_CLASS_EROUTER
The class as specified in vendor-class option by the devices.
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
const isc::log::MessageID DHCP6_PACKET_PROCESS_STD_EXCEPTION
const isc::log::MessageID DHCP6_PACKET_RECEIVE_FAIL
const isc::log::MessageID DHCP6_PROCESS_IA_NA_SOLICIT
const isc::log::MessageID DHCP6_ADDR_REG_INFORM_FAIL
const isc::log::MessageID DHCP6_DECLINE_FAIL_IAID_MISMATCH
const isc::log::MessageID DHCP6_HOOK_SUBNET6_SELECT_PARK
OptionContainer::nth_index< 5 >::type OptionContainerCancelIndex
Type of the index #5 - option cancellation flag.
boost::shared_ptr< Option6StatusCode > Option6StatusCodePtr
Pointer to the isc::dhcp::Option6StatusCode.
std::pair< OptionContainerPersistIndex::const_iterator, OptionContainerPersistIndex::const_iterator > OptionContainerPersistRange
Pair of iterators to represent the range of options having the same persistency flag.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
const isc::log::MessageID DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL
isc::log::Logger packet6_logger(DHCP6_PACKET_LOGGER_NAME)
Logger for processed packets.
const isc::log::MessageID DHCP6_DECLINE_LEASE
boost::shared_ptr< Expression > ExpressionPtr
const isc::log::MessageID DHCP6_LEASE_ADVERT_FAIL
const isc::log::MessageID DHCP6_HOOK_LEASES6_PARKING_LOT_FULL
const isc::log::MessageID DHCP6_PD_LEASE_ADVERT_FAIL
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
isc::hooks::CalloutHandlePtr getCalloutHandle(const T &pktptr)
CalloutHandle Store.
const isc::log::MessageID DHCP6_PACKET_PROCESS_FAIL
const isc::log::MessageID DHCP6_RELEASE_NA_EXPIRED
boost::shared_ptr< ClientClassDictionary > ClientClassDictionaryPtr
Defines a pointer to a ClientClassDictionary.
const isc::log::MessageID DHCP6_PACKET_RECEIVED
const isc::log::MessageID DHCP6_RESPONSE_DATA
const isc::log::MessageID DHCP6_DDNS_RECEIVE_FQDN
const isc::log::MessageID DHCP6_PACKET_OPTIONS_SKIPPED
const isc::log::MessageID DHCP6_NO_INTERFACES
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID
const isc::log::MessageID DHCP6_LEASE_REUSE
isc::log::Logger ddns6_logger(DHCP6_DDNS_LOGGER_NAME)
Logger for Hostname or FQDN processing.
const isc::log::MessageID DHCP6_HOOK_ADDR6_REGISTER_SKIP
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
boost::shared_ptr< OptionContainer > OptionContainerPtr
Pointer to the OptionContainer object.
boost::shared_ptr< ClientClassDefList > ClientClassDefListPtr
Defines a pointer to a ClientClassDefList.
const isc::log::MessageID DHCP6_HOOK_LEASES6_COMMITTED_DROP
const isc::log::MessageID DHCP6_HOOK_PACKET_SEND_DROP
const isc::log::MessageID DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS2
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
const char * DOCSIS3_CLASS_MODEM
DOCSIS3.0 compatible cable modem.
const isc::log::MessageID DHCP6_SHUTDOWN_REQUEST
const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_SKIP
const isc::log::MessageID DHCP6_DECLINE_FAIL
bool evaluateBool(const Expression &expr, Pkt &pkt)
Evaluate a RPN expression for a v4 or v6 packet and return a true or false decision.
const isc::log::MessageID DHCP6_QUERY_DATA
const int DBG_DHCP6_DETAIL_DATA
This level is used to log the contents of packets received and sent.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
const isc::log::MessageID DHCP6_PROCESS_IA_PD_SOLICIT
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
const isc::log::MessageID DHCP6_DECLINE_PROCESS_IA
NameChangeRequestPtr generateNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates NameChangeRequest from the DHCPv4 lease.
const isc::log::MessageID DHCP6_PROCESS_IA_NA_REQUEST
OptionContainer::nth_index< 2 >::type OptionContainerPersistIndex
Type of the index #2 - option persistency flag.
isc::log::Logger lease6_logger(DHCP6_LEASE_LOGGER_NAME)
Logger for lease allocation logic.
const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED
boost::shared_ptr< OptionVendorClass > OptionVendorClassPtr
Defines a pointer to the OptionVendorClass.
const isc::log::MessageID DHCP6_LEASE_NA_WITHOUT_DUID
const isc::log::MessageID DHCP6_HOOK_DECLINE_DROP
const isc::log::MessageID DHCP6_PROCESS_IA_PD_REQUEST
const isc::log::MessageID DHCP6_HOOK_SUBNET6_SELECT_SKIP
const isc::log::MessageID DHCP6_PD_LEASE_RENEW
const isc::log::MessageID DHCP6_CLASS_ASSIGNED
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_NOT_ASSIGNED
const isc::log::MessageID DHCP6_PROCESS_IA_NA_RELEASE
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS_EARLY
const isc::log::MessageID DHCP6_LEASE_ADVERT
const isc::log::MessageID DHCP6_DECLINE_FAIL_DUID_MISMATCH
const isc::log::MessageID DHCP6_SRV_UNLOAD_LIBRARIES_ERROR
const isc::log::MessageID DHCP6_HOOK_LEASES6_COMMITTED_PARK
const isc::log::MessageID DHCP6_DECLINE_FAIL_NO_LEASE
const isc::log::MessageID DHCP6_RAPID_COMMIT
const isc::log::MessageID DHCP6_BUFFER_WAIT_SIGNAL
bool isClientClassBuiltIn(const ClientClass &client_class)
Check if a client class name is builtin.
boost::shared_ptr< Option6ClientFqdn > Option6ClientFqdnPtr
A pointer to the Option6ClientFqdn object.
const isc::log::MessageID DHCP6_PROCESS_IA_PD_EXTEND
std::pair< OptionContainerCancelIndex::const_iterator, OptionContainerCancelIndex::const_iterator > OptionContainerCancelRange
Pair of iterators to represent the range of options having the same cancellation flag.
const isc::log::MessageID DHCP6_CLASSES_ASSIGNED_AFTER_SUBNET_SELECTION
const isc::log::MessageID DHCP6_PACKET_PROCESS_STD_EXCEPTION_MAIN
const int DBG_DHCP6_BASIC
Debug level used to trace basic operations within the code.
const isc::log::MessageID DHCP6_HOOK_ADDR6_REGISTER_DROP
isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME)
Base logger for DHCPv6 server.
const isc::log::MessageID DHCP6_SUBNET_SELECTED
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_WRONG_IAID
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_NOT_ASSIGNED
const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_DROP
const isc::log::MessageID DHCP6_ADD_DEPRECATED_UNICAST
boost::shared_ptr< Option > OptionPtr
const isc::log::MessageID DHCP6_DDNS_CREATE_ADD_NAME_CHANGE_REQUEST
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_WRONG_DUID
const isc::log::MessageID DHCP6_ADD_STATUS_CODE_FOR_IA
isc::log::Logger options6_logger(DHCP6_OPTIONS_LOGGER_NAME)
Logger for options parser.
const isc::log::MessageID DHCP6_LEASE_DATA
const isc::log::MessageID DHCP6_HOOK_BUFFER_SEND_SKIP
const int DBG_DHCP6_DETAIL
Debug level used to trace detailed errors.
const isc::log::MessageID DHCP6_SUBNET_DYNAMICALLY_CHANGED
const isc::log::MessageID DHCP6_PACKET_QUEUE_FULL
const isc::log::MessageID DHCP6_PD_LEASE_ALLOC_FAIL
const isc::log::MessageID DHCP6_HOOK_LEASE6_RELEASE_PD_SKIP
const isc::log::MessageID DHCP6_RELEASE_PD
std::list< ConstCfgOptionPtr > CfgOptionList
Const pointer list.
const isc::log::MessageID DHCP6_DDNS_FQDN_GENERATED
const isc::log::MessageID DHCP6_PACKET_DROP_DHCP_DISABLED
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
isc::log::Logger hooks_logger("hooks")
Hooks Logger.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
boost::shared_ptr< ParkingLot > ParkingLotPtr
Type of the pointer to the parking lot.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
const int DBGLVL_PKT_HANDLING
This debug level is reserved for logging the details of packet handling, such as dropping the packet ...
string dumpAsHex(const uint8_t *data, size_t length)
Dumps a buffer of bytes as a string of hexadecimal digits.
bool equalValues(const T &ptr1, const T &ptr2)
This function checks if two pointers are non-null and values are equal.
Defines the logger used by the top-level component of kea-lfc.
This file defines abstract classes for exchanging NameChangeRequests.
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
Standard implementation of read-write mutexes with writer preference using C++11 mutex and condition ...
#define DHCP6_OPTION_SPACE
Lease6Collection old_leases_
A pointer to any old leases that the client had before update but are no longer valid after the updat...
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
Lease::Type type_
Lease type (IA or PD).
Lease6Collection changed_leases_
A pointer to any leases that have changed FQDN information.
void addHint(const asiolink::IOAddress &prefix, const uint8_t prefix_len=128, const uint32_t preferred=0, const uint32_t valid=0)
Convenience method adding new hint.
Lease6Collection reused_leases_
Set of leases marked for reuse by lease caching.
HintContainer hints_
Client's hints.
uint32_t iaid_
The IAID field from IA_NA or IA_PD that is being processed.
Context information for the DHCPv6 leases allocation.
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
std::vector< IAContext > ias_
Container holding IA specific contexts.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
bool fake_allocation_
Indicates if this is a real or fake allocation.
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
DuidPtr duid_
Client identifier.
Lease6Collection new_leases_
A collection of newly allocated leases.
std::vector< IAContext > & getIAContexts()
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL).
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
DdnsParamsPtr getDdnsParams()
Returns the set of DDNS behavioral parameters based on the selected subnet.
ConstHostPtr globalHost() const
Returns global host reservation if there is one.
Pkt6Ptr query_
A pointer to the client's message.
bool early_global_reservations_lookup_
Indicates if early global reservation is enabled.
std::string hostname_
Hostname.
void createIAContext()
Creates new IA context.
ConstSubnet6Ptr subnet_
Subnet selected for the client by the server.
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
Structure that holds a lease for IPv6 address and/or prefix.
static const uint32_t INFINITY_LFT
Infinity (means static, i.e. never expire).
static constexpr uint32_t STATE_DEFAULT
A lease in the default state.
static std::string lifetimeToText(uint32_t lifetime)
Print lifetime.
static constexpr uint32_t STATE_REGISTERED
Registered self-generated lease.
static constexpr uint32_t STATE_RELEASED
Released lease held in the database for lease affinity.
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)
@ TYPE_NA
the lease contains non-temporary IPv6 address
Subnet selector used to specify parameters used to select a subnet.
bool add(const WorkItemPtr &item)
add a work item to the thread pool