8#include <kea_version.h>
115#include <boost/algorithm/string/erase.hpp>
116#include <boost/algorithm/string/join.hpp>
117#include <boost/algorithm/string/split.hpp>
118#include <boost/foreach.hpp>
119#include <boost/tokenizer.hpp>
133namespace ph = std::placeholders;
139 int hook_index_buffer6_receive_;
140 int hook_index_pkt6_receive_;
141 int hook_index_subnet6_select_;
142 int hook_index_leases6_committed_;
143 int hook_index_lease6_release_;
144 int hook_index_pkt6_send_;
145 int hook_index_buffer6_send_;
146 int hook_index_lease6_decline_;
147 int hook_index_host6_identifier_;
148 int hook_index_ddns6_update_;
149 int hook_index_addr6_register_;
185createStatusCode(
const Pkt6& pkt,
const uint16_t status_code,
186 const std::string& status_message) {
191 .arg(option_status->dataToText());
192 return (option_status);
210createStatusCode(
const Pkt6& pkt,
const Option6IA& ia,
const uint16_t status_code,
211 const std::string& status_message) {
217 .arg(option_status->dataToText());
218 return (option_status);
223std::set<std::string> dhcp6_statistics = {
225 "pkt6-solicit-received",
226 "pkt6-advertise-received",
227 "pkt6-request-received",
228 "pkt6-reply-received",
229 "pkt6-renew-received",
230 "pkt6-rebind-received",
231 "pkt6-decline-received",
232 "pkt6-release-received",
233 "pkt6-infrequest-received",
234 "pkt6-lease-query-received",
235 "pkt6-dhcpv4-query-received",
236 "pkt6-dhcpv4-response-received",
237 "pkt6-addr-reg-inform-received",
238 "pkt6-addr-reg-reply-received",
239 "pkt6-unknown-received",
241 "pkt6-advertise-sent",
243 "pkt6-lease-query-reply-sent",
244 "pkt6-dhcpv4-response-sent",
245 "pkt6-addr-reg-reply-sent",
246 "pkt6-service-disabled",
250 "pkt6-rfc-violation",
251 "pkt6-admin-filtered",
253 "pkt6-processing-failed",
254 "pkt6-limit-exceeded",
256 "v6-allocation-fail",
257 "v6-allocation-fail-shared-network",
258 "v6-allocation-fail-subnet",
259 "v6-allocation-fail-no-pools",
260 "v6-allocation-fail-classes",
261 "v6-ia-na-lease-reuses",
262 "v6-ia-pd-lease-reuses",
305 }
catch (
const std::exception &e) {
321 for (
auto const& it : dhcp6_statistics) {
323 stats_mgr.
setValue(it,
static_cast<int64_t
>(0));
333 }
catch (
const std::exception& ex) {
340 }
catch (
const std::exception& ex) {
359 if (!names.empty()) {
361 for (
size_t i = 1; i < names.size(); ++i) {
362 msg += std::string(
", ") + names[i];
368 io_service_->stopAndPoll();
394 if (
getServerID()->getData() != server_id->getData()){
396 .arg(pkt->getLabel())
400 static_cast<int64_t
>(1));
410 if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
412 .arg(pkt->getLabel())
413 .arg(pkt->getName());
415 static_cast<int64_t
>(1));
425 for (
auto const& id_type : cfg->getIdentifierTypes()) {
446 std::vector<uint8_t> id;
455 callout_handle->setArgument(
"query6", ctx.
query_);
456 callout_handle->setArgument(
"id_type", type);
457 callout_handle->setArgument(
"id_value",
id);
463 callout_handle->getArgument(
"id_type", type);
464 callout_handle->getArgument(
"id_value",
id);
470 .arg(ctx.
query_->getLabel())
490 ctx.
duid_ = query->getClientId();
517 if (global_host && !global_host->getClientClasses6().empty()) {
522 const ClientClasses& classes = global_host->getClientClasses6();
523 for (
auto const& cclass : classes) {
524 query->addClass(cclass);
533 query->addClass(
"KNOWN");
535 .arg(query->getLabel())
542 if (query->inClass(
"DROP")) {
545 .arg(query->makeLabel(query->getClientId(),
nullptr))
546 .arg(query->toText());
548 static_cast<int64_t
>(1));
550 static_cast<int64_t
>(1));
555 ctx.
hosts_[SUBNET_ID_GLOBAL] = global_host;
589 ctx.
subnet_->getSharedNetwork(sn);
601 global_host && !global_host->getClientClasses6().empty()) ||
602 (!sn && current_host && !current_host->getClientClasses6().empty())) {
623 if (!ctx.
hosts_.empty()) {
624 ctx.
query_->addClass(
"KNOWN");
626 .arg(ctx.
query_->getLabel())
629 ctx.
query_->addClass(
"UNKNOWN");
631 .arg(ctx.
query_->getLabel())
640 .arg(ctx.
query_->getLabel())
644 if (ctx.
query_->inClass(
"DROP")) {
646 .arg(ctx.
query_->makeLabel(ctx.
query_->getClientId(), 0))
647 .arg(ctx.
query_->toText());
649 static_cast<int64_t
>(1));
651 static_cast<int64_t
>(1));
663 const char*
interface = getenv(
"KEA_AFL_INTERFACE");
665 isc_throw(FuzzInitFail,
"no fuzzing interface has been set");
669 const char* address = getenv(
"KEA_AFL_ADDRESS");
671 isc_throw(FuzzInitFail,
"no fuzzing address has been set");
679 while (__AFL_LOOP(fuzzer.maxLoopCount())) {
691 }
catch (
const std::exception& e) {
722 uint32_t timeout = 1;
733 .arg(query->getRemoteAddr().toText())
734 .arg(query->getRemotePort())
735 .arg(query->getLocalAddr().toText())
736 .arg(query->getLocalPort())
737 .arg(query->getIface());
759 }
catch (
const std::exception& e) {
773 .arg(query->getLabel());
776 static_cast<int64_t
>(1));
778 static_cast<int64_t
>(1));
782 query->addPktEvent(
"mt_queued");
783 typedef function<void()> CallBack;
784 boost::shared_ptr<CallBack> call_back =
790 static_cast<int64_t
>(1));
792 static_cast<int64_t
>(1));
804 }
catch (
const std::exception& e) {
806 .arg(query->getLabel())
809 static_cast<int64_t
>(1));
811 static_cast<int64_t
>(1));
814 .arg(query->getLabel());
816 static_cast<int64_t
>(1));
818 static_cast<int64_t
>(1));
835 query->addPktEvent(
"process_started");
838 query->addClass(
"ALL");
840 bool skip_unpack =
false;
857 callout_handle->setArgument(
"query6", query);
868 .arg(query->getRemoteAddr().toText())
869 .arg(query->getLocalAddr().toText())
870 .arg(query->getIface());
879 .arg(query->getRemoteAddr().toText())
880 .arg(query->getLocalAddr().toText())
881 .arg(query->getIface());
888 callout_handle->getArgument(
"query6", query);
900 .arg(query->getRemoteAddr().toText())
901 .arg(query->getLocalAddr().toText())
902 .arg(query->getIface());
909 .arg(query->getLabel())
911 }
catch (
const std::exception &e) {
914 .arg(query->getLabel())
915 .arg(query->getRemoteAddr().toText())
916 .arg(query->getLocalAddr().toText())
917 .arg(query->getIface())
919 .arg(query->makeLabel(query->getClientId(),
nullptr));
923 static_cast<int64_t
>(1));
925 static_cast<int64_t
>(1));
932 .arg(query->getLabel());
935 processStatsReceived(query);
944 static_cast<int64_t
>(1));
954 static_cast<int64_t
>(1));
962 .arg(query->getLabel())
963 .arg(query->getName())
964 .arg(
static_cast<int>(query->getType()))
965 .arg(query->getRemoteAddr())
966 .arg(query->getLocalAddr())
967 .arg(query->getIface());
969 .arg(query->getLabel())
970 .arg(query->toText());
988 callout_handle->setArgument(
"query6", query);
999 .arg(query->getLabel());
1005 callout_handle->getArgument(
"query6", query);
1019 if (query->inClass(
"DROP")) {
1021 .arg(query->makeLabel(query->getClientId(),
nullptr))
1022 .arg(query->toText());
1024 static_cast<int64_t
>(1));
1026 static_cast<int64_t
>(1));
1043 }
catch (
const std::exception& e) {
1045 .arg(query->getLabel())
1048 static_cast<int64_t
>(1));
1050 static_cast<int64_t
>(1));
1053 .arg(query->getLabel());
1055 static_cast<int64_t
>(1));
1057 static_cast<int64_t
>(1));
1078 if (!client_handler.
tryLock(query, cont)) {
1118 }
catch (
const std::exception& e) {
1120 .arg(query->getLabel())
1123 static_cast<int64_t
>(1));
1125 static_cast<int64_t
>(1));
1128 .arg(query->getLabel());
1130 static_cast<int64_t
>(1));
1132 static_cast<int64_t
>(1));
1145 callout_handle->getContext(
"subnet6", ctx.
subnet_);
1165 bool rfc_violation =
false;
1168 switch (query->getType()) {
1209 rfc_violation =
true;
1212 }
catch (
const std::exception& e) {
1222 .arg(query->getLabel())
1223 .arg(query->getName())
1224 .arg(query->getRemoteAddr().toText())
1229 if (!rfc_violation) {
1231 static_cast<int64_t
>(1));
1234 static_cast<int64_t
>(1));
1254 rsp->setRemoteAddr(query->getRemoteAddr());
1255 rsp->setLocalAddr(query->getLocalAddr());
1260 }
else if (rsp->relay_info_.empty()) {
1262 rsp->setRemotePort(DHCP6_CLIENT_PORT);
1266 rsp->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT);
1272 rsp->setLocalPort(DHCP6_SERVER_PORT);
1274 rsp->setIndex(query->getIndex());
1275 rsp->setIface(query->getIface());
1304 std::shared_ptr<ScopedCalloutHandleState> callout_handle_state =
1305 std::make_shared<ScopedCalloutHandleState>(callout_handle);
1310 callout_handle->setArgument(
"query6", query);
1314 callout_handle->setArgument(
"response6", rsp);
1320 if (new_lease->reuseable_valid_lft_ == 0) {
1321 new_leases->push_back(new_lease);
1325 callout_handle->setArgument(
"leases6", new_leases);
1330 for (
auto const& iac : ctx.
ias_) {
1331 if (!iac.old_leases_.empty()) {
1332 for (
auto const& old_lease : iac.old_leases_) {
1334 deleted_leases->push_back(old_lease);
1337 bool in_new =
false;
1339 if ((new_lease->addr_ == old_lease->addr_) &&
1341 (new_lease->prefixlen_ == old_lease->prefixlen_))) {
1347 deleted_leases->push_back(old_lease);
1352 callout_handle->setArgument(
"deleted_leases6", deleted_leases);
1355 uint32_t parked_packet_limit = 0;
1359 parked_packet_limit = ppl->intValue();
1362 if (parked_packet_limit) {
1364 getParkingLotPtr(
"leases6_committed");
1365 if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
1369 .arg(parked_packet_limit)
1370 .arg(query->getLabel());
1372 static_cast<int64_t
>(1));
1374 static_cast<int64_t
>(1));
1386 [
this, callout_handle, query, rsp, callout_handle_state, subnet]()
mutable {
1388 typedef function<void()> CallBack;
1389 boost::shared_ptr<CallBack> call_back =
1391 this, callout_handle, query, rsp, subnet));
1392 callout_handle_state->on_completion_ = [call_back]() {
1413 .arg(query->getLabel());
1424 .arg(query->getLabel());
1445 }
catch (
const std::exception& e) {
1447 .arg(query->getLabel())
1451 .arg(query->getLabel());
1459 query->addPktEvent(
"process_completed");
1465 bool skip_pack =
false;
1483 callout_handle->setArgument(
"query6", query);
1486 callout_handle->setArgument(
"response6", rsp);
1489 callout_handle->setArgument(
"subnet6", subnet);
1501 .arg(rsp->getLabel());
1508 .arg(rsp->getLabel());
1518 }
catch (
const std::exception& e) {
1520 .arg(query->getLabel())
1552 callout_handle->setArgument(
"response6", rsp);
1565 .arg(rsp->getLabel());
1569 callout_handle->getArgument(
"response6", rsp);
1573 .arg(rsp->getLabel())
1574 .arg(rsp->getName())
1575 .arg(
static_cast<int>(rsp->getType()))
1576 .arg(rsp->getLocalAddr().isV6Zero() ?
"*" : rsp->getLocalAddr().toText())
1577 .arg(rsp->getLocalPort())
1578 .arg(rsp->getRemoteAddr())
1579 .arg(rsp->getRemotePort())
1580 .arg(rsp->getIface());
1583 .arg(rsp->getLabel())
1584 .arg(rsp->getName())
1585 .arg(
static_cast<int>(rsp->getType()))
1586 .arg(rsp->toText());
1592 }
catch (
const std::exception& e) {
1594 .arg(rsp->getLabel())
1606 for (
auto const& it :
data) {
1610 tmp << hex << setw(2) << setfill('0') << static_cast<uint16_t>(it);
1624 answer->addOption(clientid);
1629 if (!question->relay_info_.empty()) {
1630 answer->copyRelayInfo(question);
1648 co_list.push_back(ctx.
currentHost()->getCfgOption6());
1656 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
1658 resource.getAddress(),
1660 if (pool && !pool->getCfgOption()->empty()) {
1661 co_list.push_back(pool->getCfgOption());
1666 if (!ctx.
subnet_->getCfgOption()->empty()) {
1667 co_list.push_back(ctx.
subnet_->getCfgOption());
1672 ctx.
subnet_->getSharedNetwork(network);
1673 if (network && !network->getCfgOption()->empty()) {
1674 co_list.push_back(network->getCfgOption());
1680 for (
auto const& cclass : classes) {
1683 getClientClassDictionary()->findClass(cclass);
1688 .arg(question->getLabel())
1695 if (ccdef->getCfgOption()->empty()) {
1700 co_list.push_back(ccdef->getCfgOption());
1713 if (co_list.empty()) {
1717 set<uint16_t> requested_opts;
1726 for (uint16_t code : option_oro->getValues()) {
1727 static_cast<void>(requested_opts.insert(code));
1731 set<uint16_t> cancelled_opts;
1735 for (
auto const& copts : co_list) {
1743 BOOST_FOREACH(
auto const& desc, prange) {
1746 uint16_t code = desc.option_->getType();
1747 static_cast<void>(requested_opts.insert(code));
1753 BOOST_FOREACH(
auto const& desc, crange) {
1756 uint16_t code = desc.option_->getType();
1757 static_cast<void>(cancelled_opts.insert(code));
1762 const auto& cclasses = question->getClasses();
1765 for (uint16_t opt : requested_opts) {
1767 if (cancelled_opts.count(opt) > 0) {
1775 if (!answer->getOption(opt)) {
1777 for (
auto const& copts : co_list) {
1784 .arg(answer->getLabel());
1786 answer->addOption(desc.
option_);
1799 set<uint32_t> vendor_ids;
1803 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1805 uint32_t vendor_id = vendor_class->getVendorId();
1806 static_cast<void>(vendor_ids.insert(vendor_id));
1810 for (
auto const& copts : co_list) {
1813 if (!desc.option_ || !desc.allowedForClientClasses(cclasses)) {
1817 boost::dynamic_pointer_cast<OptionVendorClass>(desc.option_);
1818 if (!vendor_class) {
1822 uint32_t vendor_id = vendor_class->getVendorId();
1823 if (vendor_ids.count(vendor_id) > 0) {
1827 answer->addOption(desc.option_);
1828 static_cast<void>(vendor_ids.insert(vendor_id));
1837 set<uint32_t> vendor_ids;
1841 vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1843 uint32_t vendor_id = vendor_opts->getVendorId();
1844 static_cast<void>(vendor_ids.insert(vendor_id));
1848 for (
auto const& copts : co_list) {
1851 if (!desc.option_ || !desc.allowedForClientClasses(cclasses)) {
1855 boost::dynamic_pointer_cast<OptionVendor>(desc.option_);
1860 uint32_t vendor_id = vendor_opts->getVendorId();
1861 if (vendor_ids.count(vendor_id) > 0) {
1867 answer->addOption(vendor_opts);
1868 static_cast<void>(vendor_ids.insert(vendor_id));
1887 if (!ctx.
subnet_ || co_list.empty()) {
1891 set<uint32_t> vendor_ids;
1895 map<uint32_t, OptionVendorPtr> vendor_rsps;
1898 vendor_rsp = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1900 uint32_t vendor_id = vendor_rsp->getVendorId();
1901 vendor_rsps[vendor_id] = vendor_rsp;
1902 static_cast<void>(vendor_ids.insert(vendor_id));
1908 map<uint32_t, OptionVendorPtr> vendor_reqs;
1911 vendor_req = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1913 uint32_t vendor_id = vendor_req->getVendorId();
1914 vendor_reqs[vendor_id] = vendor_req;
1915 static_cast<void>(vendor_ids.insert(vendor_id));
1923 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1925 uint32_t vendor_id = vendor_class->getVendorId();
1926 static_cast<void>(vendor_ids.insert(vendor_id));
1932 if (vendor_ids.empty()) {
1936 map<uint32_t, set<uint16_t> > requested_opts;
1950 oro = boost::dynamic_pointer_cast<OptionUint16Array>(oro_generic);
1953 set<uint16_t> oro_req_opts;
1954 for (uint16_t code : oro->getValues()) {
1955 static_cast<void>(oro_req_opts.insert(code));
1961 map<uint32_t, set<uint16_t> > cancelled_opts;
1962 const auto& cclasses = question->getClasses();
1966 for (uint32_t vendor_id : vendor_ids) {
1967 for (
auto const& copts : co_list) {
1975 BOOST_FOREACH(
auto const& desc, prange) {
1976 if (!desc.option_) {
1980 uint16_t code = desc.option_->getType();
1981 static_cast<void>(requested_opts[vendor_id].insert(code));
1986 BOOST_FOREACH(
auto const& desc, crange) {
1987 if (!desc.option_) {
1991 uint16_t code = desc.option_->getType();
1992 static_cast<void>(cancelled_opts[vendor_id].insert(code));
2001 if (requested_opts[vendor_id].empty()) {
2008 if (vendor_rsps.count(vendor_id) > 0) {
2009 vendor_rsp = vendor_rsps[vendor_id];
2017 for (uint16_t opt : requested_opts[vendor_id]) {
2018 if (cancelled_opts[vendor_id].count(opt) > 0) {
2021 if (!vendor_rsp->getOption(opt)) {
2022 for (
auto const& copts : co_list) {
2027 vendor_rsp->addOption(desc.
option_);
2037 if (added && (vendor_rsps.count(vendor_id) == 0)) {
2038 answer->addOption(vendor_rsp);
2046 switch (pkt->getType()) {
2069 .arg(pkt->getLabel())
2070 .arg(
static_cast<int>(pkt->getType()))
2071 .arg(pkt->getIface());
2076 .arg(pkt->getLabel())
2077 .arg(pkt->getName())
2078 .arg(pkt->getRemoteAddr().toText())
2081 static_cast<int64_t
>(1));
2095 if (client_ids.size() != 1) {
2097 << pkt->getName() <<
", but " << client_ids.size()
2104 if (client_ids.size() > 1) {
2106 <<
") client-id options received in " << pkt->getName());
2108 if (!client_ids.empty()) {
2121 if (!server_ids.empty()) {
2123 << server_ids.size() <<
" received in " << pkt->getName());
2128 if (server_ids.size() != 1) {
2130 << server_ids.size() <<
"), exactly 1 expected in message "
2137 if (server_ids.size() > 1) {
2139 <<
") server-id options received in " << pkt->getName());
2141 if (!server_ids.empty()) {
2154 uint16_t len = opt->len() - opt->getHeaderLen();
2167 getCfgSubnets6()->selectSubnet(selector);
2177 shared_ptr<ScopedCalloutHandleState> callout_handle_state(
2178 std::make_shared<ScopedCalloutHandleState>(callout_handle));
2184 callout_handle->setArgument(
"query6", question);
2185 callout_handle->setArgument(
"subnet6", subnet);
2190 callout_handle->setArgument(
"subnet6collection",
2192 getCfgSubnets6()->getAll());
2194 auto const tpl(parkingLimitExceeded(
"subnet6_select"));
2195 bool const exceeded(
get<0>(tpl));
2197 uint32_t
const limit(
get<1>(tpl));
2202 .arg(question->getLabel());
2204 static_cast<int64_t
>(1));
2206 static_cast<int64_t
>(1));
2213 HooksManager::park(
"subnet6_select", question, [
this, question, callout_handle_state]() {
2215 boost::shared_ptr<function<void()>> callback(
2216 boost::make_shared<function<
void()>>([
this, question]()
mutable {
2219 callout_handle_state->on_completion_ = [callback]() {
2241 .arg(question->getLabel());
2254 .arg(question->getLabel());
2262 .arg(question->getLabel());
2268 callout_handle->getArgument(
"subnet6", subnet);
2274 .arg(question->getLabel())
2275 .arg(subnet->getID());
2279 .arg(question->getLabel())
2280 .arg(subnet->toText());
2284 .arg(question->getLabel());
2306 for (
auto const& opt : question->options_) {
2307 switch (opt.second->getType()) {
2310 boost::dynamic_pointer_cast<
2313 answer->addOption(answer_opt);
2319 boost::dynamic_pointer_cast<
2322 answer->addOption(answer_opt);
2348 if (ddns_params->getEnableUpdates() &&
2358 .arg(question->getLabel());
2371 .arg(question->getLabel())
2372 .arg(fqdn->toText());
2391 *ddns_params,
true),
2400 .arg(question->getLabel())
2401 .arg(scrubbed.
what());
2408 ctx.
hostname_ = fqdn_resp->getDomainName();
2415 .arg(question->getLabel())
2416 .arg(fqdn_resp->toText());
2417 answer->addOption(fqdn_resp);
2432 callout_handle->setArgument(
"query6", question);
2433 callout_handle->setArgument(
"response6", answer);
2434 callout_handle->setArgument(
"subnet6", subnet);
2435 callout_handle->setArgument(
"hostname", ctx.
hostname_);
2438 callout_handle->setArgument(
"ddns-params", ddns_params);
2444 string hook_hostname;
2445 bool hook_fwd_dns_update;
2446 bool hook_rev_dns_update;
2447 callout_handle->getArgument(
"hostname", hook_hostname);
2448 callout_handle->getArgument(
"fwd-update", hook_fwd_dns_update);
2449 callout_handle->getArgument(
"rev-update", hook_rev_dns_update);
2460 fqdn_resp = boost::dynamic_pointer_cast<Option6ClientFqdn>(answer->getOption(
D6O_CLIENT_FQDN));
2463 if (!(hook_fwd_dns_update || hook_rev_dns_update)) {
2490 <<
" encapsulating server's message must not be"
2491 <<
" NULL when creating DNS NameChangeRequest");
2504 bool do_fwd =
false;
2505 bool do_rev =
false;
2515 "client identifier is required when creating a new"
2516 " DNS NameChangeRequest");
2523 opt_fqdn->packDomainName(name_buf);
2524 const std::vector<uint8_t>& buf_vec = name_buf.
getVector();
2550 bool extended_only =
false;
2552 IOAddress ia_address = iaaddr->getAddress();
2553 for (
auto const& l : ia_ctx.reused_leases_) {
2554 if (l->addr_ == ia_address) {
2555 extended_only =
true;
2560 if (extended_only) {
2567 for (
auto const& l : ia_ctx.changed_leases_) {
2568 if (l->addr_ == ia_address) {
2572 bool ddns_changed = ((*(ctx.
duid_) != *(l->duid_)) ||
2573 (l->hostname_ != opt_fqdn->getDomainName()) ||
2574 (l->fqdn_fwd_ != do_fwd) || (l->fqdn_rev_ != do_rev));
2576 if ((l->reuseable_valid_lft_ > 0) ||
2577 (!ctx.
getDdnsParams()->getUpdateOnRenew() && !ddns_changed)) {
2578 extended_only =
true;
2592 if (!(do_fwd || do_rev) || (extended_only)) {
2607 do_rev, opt_fqdn->getDomainName(),
2608 iaaddr->getAddress().toText(),
2617 .arg(answer->getLabel())
2618 .arg(add_ncr->toText());
2629 remove_ncr->setNextNcr(add_ncr);
2631 }
else if (add_ncr) {
2639 getMACSources().get();
2641 for (
auto const& it : mac_sources) {
2642 hwaddr = pkt->getMAC(it);
2658 BOOST_FOREACH(
auto const& resv, resvs) {
2659 if ((resv.second.getPrefix() == lease->addr_) &&
2660 (resv.second.getPrefixLen() == lease->prefixlen_)) {
2661 return (resv.second.getPDExclude());
2668 Pool6Ptr pool = boost::dynamic_pointer_cast<Pool6>(
2671 return (pool->getPrefixExcludeOption());
2679 boost::shared_ptr<Option6IA> ia) {
2685 boost::dynamic_pointer_cast<Option6IAAddr>(ia->getOption(
D6O_IAADDR));
2688 hint = hint_opt->getAddress();
2693 .arg(query->getLabel())
2695 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2698 .arg(query->getLabel())
2700 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2720 "Server could not select subnet for"
2743 if (!leases.empty()) {
2744 lease = *leases.begin();
2758 .arg(query->getLabel())
2759 .arg(lease->addr_.toText())
2760 .arg(ia->getIAID());
2761 }
else if (lease->reuseable_valid_lft_ == 0) {
2763 .arg(query->getLabel())
2764 .arg(lease->addr_.toText())
2768 lease->valid_lft_ = lease->reuseable_valid_lft_;
2769 lease->preferred_lft_ = lease->reuseable_preferred_lft_;
2772 .arg(query->getLabel())
2773 .arg(lease->addr_.toText())
2780 "v6-ia-na-lease-reuses"),
2784 .arg(query->getLabel())
2786 .arg(lease->toText());
2789 setTeeTimes(lease->preferred_lft_, subnet, ia_rsp);
2792 lease->preferred_lft_,
2793 lease->valid_lft_));
2794 ia_rsp->addOption(addr);
2807 .arg(query->getLabel())
2808 .arg(ia->getIAID());
2810 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2812 "Sorry, no address could be"
2821 boost::shared_ptr<Option6IA> ia) {
2828 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
2831 hint = hint_opt->getAddress();
2836 .arg(query->getLabel())
2838 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2841 .arg(query->getLabel())
2843 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2861 "Sorry, no subnet available."));
2882 if (!leases.empty()) {
2886 uint32_t min_preferred_lft = (*leases.begin())->preferred_lft_;
2888 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2889 for (
auto const& l : leases) {
2895 .arg(query->getLabel())
2896 .arg(l->addr_.toText())
2897 .arg(
static_cast<int>(l->prefixlen_))
2898 .arg(ia->getIAID());
2899 }
else if (l->reuseable_valid_lft_ == 0) {
2901 .arg(query->getLabel())
2902 .arg(l->addr_.toText())
2903 .arg(
static_cast<int>(l->prefixlen_))
2907 l->valid_lft_ = l->reuseable_valid_lft_;
2908 l->preferred_lft_ = l->reuseable_preferred_lft_;
2910 .arg(query->getLabel())
2911 .arg(l->addr_.toText())
2912 .arg(
static_cast<int>(l->prefixlen_))
2919 "v6-ia-pd-lease-reuses"),
2924 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
2925 min_preferred_lft = l->preferred_lft_;
2928 boost::shared_ptr<Option6IAPrefix>
2930 l->prefixlen_, l->preferred_lft_,
2932 ia_rsp->addOption(addr);
2934 if (pd_exclude_requested) {
2936 if (pd_exclude_option) {
2937 addr->addOption(pd_exclude_option);
2956 .arg(query->getLabel())
2957 .arg(ia->getIAID());
2959 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2961 "Sorry, no prefixes could"
2970 boost::shared_ptr<Option6IA> ia) {
2973 .arg(query->getLabel())
2974 .arg(ia->getIAID());
2993 "Sorry, no known leases for this duid/iaid."));
3005 for (
auto const& it : addrs) {
3009 Option6IAAddrPtr iaaddr = boost::dynamic_pointer_cast<Option6IAAddr>(it.second);
3036 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
3039 for (
auto const& l : leases) {
3040 if (l->reuseable_valid_lft_ == 0) {
3042 .arg(query->getLabel())
3043 .arg(l->addr_.toText())
3044 .arg(ia->getIAID());
3046 l->valid_lft_ = l->reuseable_valid_lft_;
3047 l->preferred_lft_ = l->reuseable_preferred_lft_;
3049 .arg(query->getLabel())
3050 .arg(l->addr_.toText())
3057 "v6-ia-na-lease-reuses"),
3062 l->addr_, l->preferred_lft_, l->valid_lft_));
3063 ia_rsp->addOption(iaaddr);
3066 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
3067 min_preferred_lft = l->preferred_lft_;
3072 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
3082 if (
equalValues(query->getClientId(), l->duid_)) {
3085 ia_rsp->addOption(iaaddr);
3090 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
3098 .arg(query->getLabel())
3110 for (
auto const& hint : hints) {
3112 hint.getAddress(), 0, 0));
3113 ia_rsp->addOption(iaaddr);
3116 if (!leases.empty()) {
3122 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
3124 "Sorry, no addresses could be"
3125 " assigned at this time."));
3134 boost::shared_ptr<Option6IA> ia) {
3137 .arg(query->getLabel())
3138 .arg(ia->getIAID());
3155 "Sorry, no known PD leases"
3156 " for this duid/iaid."));
3176 " client sending Rebind to extend lifetime of the"
3177 " prefix (DUID=" << duid->toText() <<
", IAID="
3178 << ia->getIAID() <<
")");
3190 for (
auto const& it : addrs) {
3224 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
3228 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
3230 for (
auto const& l : leases) {
3231 if (l->reuseable_valid_lft_ == 0) {
3233 .arg(query->getLabel())
3234 .arg(l->addr_.toText())
3235 .arg(
static_cast<int>(l->prefixlen_))
3236 .arg(ia->getIAID());
3238 l->valid_lft_ = l->reuseable_valid_lft_;
3239 l->preferred_lft_ = l->reuseable_preferred_lft_;
3241 .arg(query->getLabel())
3242 .arg(l->addr_.toText())
3243 .arg(
static_cast<int>(l->prefixlen_))
3250 "v6-ia-pd-lease-reuses"),
3255 l->addr_, l->prefixlen_,
3256 l->preferred_lft_, l->valid_lft_));
3257 ia_rsp->addOption(prf);
3259 if (pd_exclude_requested) {
3261 if (pd_exclude_option) {
3262 prf->addOption(pd_exclude_option);
3267 if ((l->preferred_lft_ > 0) && (l->preferred_lft_ < min_preferred_lft)) {
3268 min_preferred_lft = l->preferred_lft_;
3273 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
3283 if (
equalValues(query->getClientId(), l->duid_)) {
3285 l->prefixlen_, 0, 0));
3286 ia_rsp->addOption(prefix);
3291 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
3296 for (
auto const& prefix : hints) {
3301 if (!prefix.getAddress().isV6Zero()) {
3303 prefix.getAddress(),
3304 prefix.getPrefixLength(),
3306 ia_rsp->addOption(prefix_opt);
3310 if (!leases.empty()) {
3317 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
3319 "Sorry, no prefixes could be"
3320 " assigned at this time."));
3340 for (
auto const& opt : query->options_) {
3341 switch (opt.second->getType()) {
3344 boost::dynamic_pointer_cast<
3347 reply->addOption(answer_opt);
3354 boost::dynamic_pointer_cast<
3357 reply->addOption(answer_opt);
3392 for (
auto const& opt : release->options_) {
3394 switch (opt.second->getType()) {
3397 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3400 reply->addOption(answer_opt);
3406 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3409 reply->addOption(answer_opt);
3426 reply->addOption(createStatusCode(*release, general_status,
3427 "Summary status for all processed IA_NAs"));
3432 int& general_status, boost::shared_ptr<Option6IA> ia,
3436 .arg(query->getLabel())
3437 .arg(ia->getIAID());
3453 if (!release_addr) {
3455 "You did not include an address in your RELEASE"));
3461 release_addr->getAddress());
3468 "Sorry, no known leases for this duid/iaid, can't release."));
3474 if (!lease->duid_) {
3480 .arg(query->getLabel())
3481 .arg(release_addr->getAddress().toText());
3485 "Database consistency check failed when trying to RELEASE"));
3489 if (*duid != *(lease->duid_)) {
3493 .arg(query->getLabel())
3494 .arg(release_addr->getAddress().toText())
3495 .arg(lease->duid_->toText());
3499 "This address does not belong to you, you can't release it"));
3503 if (ia->getIAID() != lease->iaid_) {
3506 .arg(query->getLabel())
3507 .arg(release_addr->getAddress().toText())
3509 .arg(ia->getIAID());
3511 "This is your address, but you used wrong IAID"));
3534 callout_handle->deleteAllArguments();
3537 callout_handle->setArgument(
"query6", query);
3540 callout_handle->setArgument(
"lease6", lease);
3552 .arg(query->getLabel());
3557 bool success =
false;
3558 bool expired =
false;
3565 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3566 expiration_cfg->getHoldReclaimedTime() &&
3569 lease->valid_lft_ = 0;
3570 lease->preferred_lft_ = 0;
3590 "Server failed to release a lease"));
3593 .arg(query->getLabel())
3594 .arg(lease->addr_.toText())
3603 .arg(query->getLabel())
3604 .arg(lease->addr_.toText())
3607 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3608 "Lease released. Thank you, please come again."));
3612 .arg(query->getLabel())
3613 .arg(lease->addr_.toText())
3617 .arg(query->getLabel())
3618 .arg(lease->addr_.toText())
3632 static_cast<int64_t
>(-1));
3636 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
3641 static_cast<int64_t
>(-1));
3651 int& general_status, boost::shared_ptr<Option6IA> ia,
3666 boost::shared_ptr<Option6IAPrefix> release_prefix =
3667 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
3668 if (!release_prefix) {
3670 "You did not include a prefix in your RELEASE"));
3676 release_prefix->getAddress());
3683 "Sorry, no known leases for this duid/iaid, can't release."));
3689 if (!lease->duid_) {
3694 .arg(query->getLabel())
3695 .arg(release_prefix->getAddress().toText())
3696 .arg(
static_cast<int>(release_prefix->getLength()));
3700 "Database consistency check failed when trying to RELEASE"));
3704 if (*duid != *(lease->duid_)) {
3707 .arg(query->getLabel())
3708 .arg(release_prefix->getAddress().toText())
3709 .arg(
static_cast<int>(release_prefix->getLength()))
3710 .arg(lease->duid_->toText());
3714 "This address does not belong to you, you can't release it"));
3718 if (ia->getIAID() != lease->iaid_) {
3721 .arg(query->getLabel())
3722 .arg(release_prefix->getAddress().toText())
3723 .arg(
static_cast<int>(release_prefix->getLength()))
3725 .arg(ia->getIAID());
3727 "This is your address, but you used wrong IAID"));
3750 callout_handle->setArgument(
"query6", query);
3753 callout_handle->setArgument(
"lease6", lease);
3765 .arg(query->getLabel());
3770 bool success =
false;
3771 bool expired =
false;
3778 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3779 expiration_cfg->getHoldReclaimedTime() &&
3782 lease->valid_lft_ = 0;
3783 lease->preferred_lft_ = 0;
3803 "Server failed to release a lease"));
3806 .arg(query->getLabel())
3807 .arg(lease->addr_.toText())
3808 .arg(
static_cast<int>(lease->prefixlen_))
3816 .arg(query->getLabel())
3817 .arg(lease->addr_.toText())
3818 .arg(
static_cast<int>(lease->prefixlen_))
3821 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3822 "Lease released. Thank you, please come again."));
3826 .arg(query->getLabel())
3827 .arg(lease->addr_.toText())
3828 .arg(
static_cast<int>(lease->prefixlen_))
3832 .arg(query->getLabel())
3833 .arg(lease->addr_.toText())
3834 .arg(
static_cast<int>(lease->prefixlen_))
3843 static_cast<int64_t
>(-1));
3847 auto const& pool = subnet->getPool(
Lease::TYPE_PD, lease->addr_,
false);
3852 static_cast<int64_t
>(-1));
3863 .arg(query->makeLabel(query->getClientId(), 0))
3864 .arg(query->toText());
3866 for (
auto const& opt : query->options_) {
3867 switch (opt.second->getType()) {
3870 boost::dynamic_pointer_cast<
3873 answer->addOption(answer_opt);
3879 boost::dynamic_pointer_cast<
3882 answer->addOption(answer_opt);
3897 "Server rejected this request"));
3906 "Server rejected this request"));
3919 if (opt_rapid_commit) {
3922 .arg(solicit->getLabel());
3927 response->addOption(opt_rapid_commit);
3946 if (solicit->inClass(
"REJECT")) {
3947 reject(solicit, response);
3961 .arg(solicit->getLabel())
3962 .arg(solicit->getName())
3963 .arg(solicit->getClasses().toText());
3972 updateReservedFqdn(ctx, response);
3991 if (request->inClass(
"REJECT")) {
4006 .arg(request->getLabel())
4007 .arg(request->getName())
4008 .arg(request->getClasses().toText());
4017 updateReservedFqdn(ctx, reply);
4018 generateFqdn(reply, ctx);
4032 if (renew->inClass(
"REJECT")) {
4048 .arg(renew->getLabel())
4049 .arg(renew->getName())
4050 .arg(renew->getClasses().toText());
4059 updateReservedFqdn(ctx, reply);
4060 generateFqdn(reply, ctx);
4074 if (rebind->inClass(
"REJECT")) {
4090 .arg(rebind->getLabel())
4091 .arg(rebind->getName())
4092 .arg(rebind->getClasses().toText());
4101 updateReservedFqdn(ctx, reply);
4102 generateFqdn(reply, ctx);
4117 .arg(confirm->getLabel())
4118 .arg(confirm->getName())
4119 .arg(confirm->getClasses().toText());
4140 bool verified =
false;
4149 for (
auto const& ia : ias) {
4151 for (
auto const& opt : opts) {
4163 if (subnet && !subnet->inRange(iaaddr->getAddress())) {
4164 std::ostringstream status_msg;
4165 status_msg <<
"Address " << iaaddr->getAddress()
4166 <<
" is not on link.";
4167 reply->addOption(createStatusCode(*confirm,
4175 " to the Option6IAAddrPtr. This is programming"
4176 " error and should be reported");
4193 "All addresses are on-link"));
4196 "No subnet selected"));
4211 .arg(release->getLabel())
4212 .arg(release->getName())
4213 .arg(release->getClasses().toText());
4243 .arg(decline->getLabel())
4244 .arg(decline->getName())
4245 .arg(decline->getClasses().toText());
4284 for (
auto const& opt : decline->options_) {
4285 switch (opt.second->getType()) {
4288 boost::dynamic_pointer_cast<Option6IA>(opt.second),
4293 reply->addOption(answer_opt);
4314 int& general_status, boost::shared_ptr<Option6IA> ia,
4318 .arg(decline->getLabel())
4319 .arg(ia->getIAID());
4334 int total_addrs = 0;
4335 for (
auto const& opt : opts) {
4344 if (!decline_addr) {
4351 decline_addr->getAddress());
4356 .arg(decline->getLabel()).arg(decline_addr->getAddress().toText());
4364 "Server does not know about such an address."));
4372 if (!lease->duid_) {
4378 .arg(decline->getLabel())
4379 .arg(decline_addr->getAddress().toText());
4382 "Database consistency check failed when attempting Decline."));
4388 if (*duid != *(lease->duid_)) {
4392 .arg(decline->getLabel())
4393 .arg(decline_addr->getAddress().toText())
4394 .arg(lease->duid_->toText());
4397 "This address does not belong to you, you can't decline it"));
4403 if (ia->getIAID() != lease->iaid_) {
4406 .arg(decline->getLabel())
4407 .arg(lease->addr_.toText())
4411 "This is your address, but you used wrong IAID"));
4423 new_leases.push_back(lease);
4427 if (total_addrs == 0) {
4429 "No addresses sent in IA_NA"));
4442 container->addOption(status);
4447 boost::shared_ptr<Option6IA> ia_rsp) {
4471 callout_handle->setArgument(
"query6", decline);
4474 callout_handle->setArgument(
"lease6", lease);
4485 .arg(decline->getLabel())
4486 .arg(decline->getIface())
4487 .arg(lease->addr_.toText());
4495 .arg(decline->getLabel())
4496 .arg(decline->getIface())
4497 .arg(lease->addr_.toText());
4502 Lease6Ptr old_values = boost::make_shared<Lease6>(*lease);
4516 .arg(decline->getLabel())
4517 .arg(lease->addr_.toText())
4530 static_cast<int64_t
>(1));
4534 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
4539 static_cast<int64_t
>(1));
4547 .arg(lease->addr_.toText()).arg(lease->valid_lft_);
4549 ia_rsp->addOption(createStatusCode(*decline, *ia_rsp,
STATUS_Success,
4550 "Lease declined. Hopefully the next one will be better."));
4564 .arg(inf_request->getLabel())
4565 .arg(inf_request->getName())
4566 .arg(inf_request->getClasses().toText());
4622 if (allow_address_registration && !allow_address_registration->boolValue()) {
4624 .arg(ctx.
query_->getLabel());
4626 static_cast<int64_t
>(1));
4628 static_cast<int64_t
>(1));
4641 IOAddress addr = addr_reg_inf->getRemoteAddr();
4644 size_t relay_level = addr_reg_inf->relay_info_.size();
4645 if (relay_level > 0) {
4646 addr = addr_reg_inf->getRelay6PeerAddress(relay_level - 1);
4651 const uint32_t no_iaid = 0;
4654 bool invalid =
false;
4657 if (addr_reg_inf->getOption(
D6O_IA_NA)) {
4660 static_cast<int64_t
>(1));
4665 if (addr_reg_inf->getOption(
D6O_IA_TA)) {
4668 static_cast<int64_t
>(1));
4673 if (addr_reg_inf->getOption(
D6O_IA_PD)) {
4676 static_cast<int64_t
>(1));
4683 if (addrs.size() != 1) {
4686 static_cast<int64_t
>(1));
4688 << addrs.size() <<
" received");
4690 iaaddr = boost::dynamic_pointer_cast<Option6IAAddr>(addrs.begin()->second);
4694 static_cast<int64_t
>(1));
4699 if (addr != iaaddr->getAddress()) {
4702 static_cast<int64_t
>(1));
4704 <<
" wants to register " << iaaddr->getAddress());
4708 if (!subnet->inRange(addr)) {
4710 static_cast<int64_t
>(1));
4712 << subnet->
toText() <<
" (id " << subnet->getID() <<
")");
4723 static_cast<int64_t
>(1));
4730 if (!hosts.empty()) {
4733 static_cast<int64_t
>(1));
4736 }
catch (
const std::exception &ex) {
4743 static_cast<int64_t
>(1));
4746 static_cast<int64_t
>(1));
4752 if (old_lease->duid_ && (*ctx.
duid_ != *(old_lease->duid_))) {
4755 .arg(ctx.
duid_->toText())
4756 .arg(old_lease->duid_->toText());
4762 addr_reg_inf->getTransid()));
4763 addr_reg_rep->addOption(iaaddr);
4771 ia->addOption(iaaddr);
4778 no_iaid, iaaddr->getPreferred(),
4779 iaaddr->getValid(), subnet->getID(),
4791 .arg(addr_reg_inf->getLabel())
4792 .arg(addr_reg_inf->getName())
4793 .arg(addr_reg_inf->getClasses().toText());
4811 callout_handle->setArgument(
"query6", addr_reg_inf);
4815 callout_handle->setArgument(
"response6", addr_reg_rep);
4818 callout_handle->setArgument(
"address6", addr);
4821 callout_handle->setArgument(
"old_lease6", old_lease);
4824 callout_handle->setArgument(
"new_lease6", lease);
4834 .arg(addr_reg_inf->getLabel())
4835 .arg(old_lease ?
"update" :
"add")
4844 .arg(addr_reg_inf->getLabel())
4855 }
catch (
const std::exception& ex) {
4865 if (old_lease->subnet_id_ != lease->subnet_id_) {
4869 static_cast<int64_t
>(-1));
4873 static_cast<int64_t
>(1));
4876 "cumulative-registered-nas"),
4877 static_cast<int64_t
>(1));
4890 static_cast<int64_t
>(1));
4893 "cumulative-registered-nas"),
4894 static_cast<int64_t
>(1));
4896 static_cast<int64_t
>(1));
4903 updateReservedFqdn(ctx, addr_reg_rep);
4904 generateFqdn(addr_reg_rep, ctx);
4907 return (addr_reg_rep);
4910void Dhcpv6Srv::classifyByVendor(
const Pkt6Ptr& pkt) {
4913 vclass = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
4914 if (!vclass || vclass->getTuplesNum() == 0) {
4932 pkt->addClass(
"ALL");
4935 classifyByVendor(pkt);
4946 for (
auto const& it : *defs_ptr) {
4954 if (it->getAdditional()) {
4958 if (it->getDependOnKnown() != depend_on_known) {
4961 it->test(pkt, expr_ptr);
4970 for (
auto const& def : *defs_ptr) {
4974 if (def->getMatchExpr()) {
4975 pkt->classes_.erase(def->getName());
4985 for (
auto const& cclass : classes) {
4986 pkt->addClass(cclass);
4996 ctx.
subnet_->getSharedNetwork(shared_network);
4997 if (shared_network) {
4999 if (host && (host->getIPv6SubnetID() != SUBNET_ID_GLOBAL)) {
5018 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
5020 resource.getAddress(),
5023 const ClientClasses& pool_to_add = pool->getAdditionalClasses();
5024 for (
auto const& cclass : pool_to_add) {
5031 const ClientClasses& to_add = subnet->getAdditionalClasses();
5032 for (
auto const& cclass : to_add) {
5038 subnet->getSharedNetwork(network);
5040 const ClientClasses& net_to_add = network->getAdditionalClasses();
5041 for (
auto const& cclass : net_to_add) {
5051 for (
auto const& cclass : classes) {
5066 pkt->addClass(cclass);
5074 .arg(pkt->getLabel())
5076 .arg(status ?
"true" :
"false");
5079 pkt->addClass(cclass);
5083 .arg(pkt->getLabel())
5095 " a message must not be NULL when updating reserved FQDN");
5106 std::string name = fqdn->getDomainName();
5118 if (new_name != name) {
5123 answer->addOption(fqdn);
5129Dhcpv6Srv::generateFqdn(
const Pkt6Ptr& answer,
5130 AllocEngine::ClientContext6& ctx) {
5132 isc_throw(isc::Unexpected,
"an instance of the object encapsulating"
5133 " a message must not be NULL when generating FQDN");
5144 if (!fqdn || !fqdn->getDomainName().empty()) {
5158 if (!iaaddr || iaaddr->getValid() == 0) {
5163 IOAddress addr = iaaddr->getAddress();
5164 std::string generated_name =
5168 .arg(answer->getLabel())
5169 .arg(generated_name);
5186 lease->hostname_ = generated_name;
5187 lease->reuseable_valid_lft_ = 0;
5191 isc_throw(isc::Unexpected,
"there is no lease in the database "
5192 " for address " << addr <<
", so as it is impossible"
5193 " to update FQDN data. This is a programmatic error"
5194 " as the given address is now being handed to the"
5202 answer->addOption(fqdn);
5204 }
catch (
const Exception& ex) {
5206 .arg(answer->getLabel())
5220 this, ph::_1, ph::_2));
5239 .arg((ncr ? ncr->toText() :
" NULL "));
5248 std::stringstream tmp;
5252 tmp <<
" (" << SOURCE_OF_INSTALLATION <<
")" << endl;
5253 tmp <<
"premium: " << PREMIUM_EXTENDED_VERSION << endl;
5254 tmp <<
"linked with:" << endl;
5259 tmp << endl <<
"lease backends:";
5261 tmp << endl <<
"- " <<
version;
5266 tmp << endl <<
"host backends:";
5268 tmp << endl <<
"- " <<
version;
5273 tmp << endl <<
"forensic backends:";
5275 tmp << endl <<
"- " <<
version;
5286 if (query->relay_info_.empty()) {
5297 for (
int i = query->relay_info_.size(); i > 0 ; --i) {
5299 if (rsoo_container) {
5304 for (
auto const& opt : rsoo) {
5308 if (cfg_rsoo->enabled(opt.second->getType()) &&
5309 !rsp->getOption(opt.second->getType())) {
5310 rsp->addOption(opt.second);
5319 if (query->relay_info_.empty()) {
5327 return (query->getRemotePort());
5333void Dhcpv6Srv::processStatsReceived(
const Pkt6Ptr& query) {
5337 string stat_name =
"pkt6-unknown-received";
5338 switch (query->getType()) {
5340 stat_name =
"pkt6-solicit-received";
5344 stat_name =
"pkt6-advertise-received";
5347 stat_name =
"pkt6-request-received";
5350 stat_name =
"pkt6-confirm-received";
5353 stat_name =
"pkt6-renew-received";
5356 stat_name =
"pkt6-rebind-received";
5360 stat_name =
"pkt6-reply-received";
5363 stat_name =
"pkt6-release-received";
5366 stat_name =
"pkt6-decline-received";
5369 stat_name =
"pkt6-reconfigure-received";
5372 stat_name =
"pkt6-infrequest-received";
5375 stat_name =
"pkt6-dhcpv4-query-received";
5379 stat_name =
"pkt6-dhcpv4-response-received";
5382 stat_name =
"pkt6-addr-reg-inform-received";
5386 stat_name =
"pkt6-addr-reg-reply-received";
5401 switch (response->getType()) {
5403 stat_name =
"pkt6-advertise-sent";
5406 stat_name =
"pkt6-reply-sent";
5409 stat_name =
"pkt6-dhcpv4-response-sent";
5412 stat_name =
"pkt6-addr-reg-reply-sent";
5423 return (
Hooks.hook_index_buffer6_send_);
5427Dhcpv6Srv::requestedInORO(
const Pkt6Ptr& query,
const uint16_t code)
const {
5429 boost::dynamic_pointer_cast<OptionUint16Array>(query->getOption(
D6O_ORO));
5432 const std::vector<uint16_t>& codes = oro->getValues();
5433 return (std::find(codes.begin(), codes.end(), code) != codes.end());
5439tuple<bool, uint32_t>
5440Dhcpv6Srv::parkingLimitExceeded(
string const& hook_label) {
5442 uint32_t parked_packet_limit(0);
5446 parked_packet_limit = ppl->intValue();
5449 if (parked_packet_limit) {
5453 if (parking_lot && parked_packet_limit <= parking_lot->size()) {
5454 return make_tuple(
true, parked_packet_limit);
5457 return make_tuple(
false, parked_packet_limit);
5468 char const*
const rotate(getenv(
"KEA_DHCP6_FUZZING_ROTATE_PORT"));
5472 while (!locker.
lock()) {
5473 this_thread::sleep_for(1s);
5476 port_file.open(
"/tmp/port6.txt", ios::in);
5479 getline(port_file, line);
5491 port_file.open(
"/tmp/port6.txt", ios::out | ios::trunc);
5492 port_file << to_string(port) << endl;
5507 uint32_t t2_time = 0;
5510 if (!subnet->getT2().unspecified()) {
5511 t2_time = subnet->getT2();
5512 }
else if (subnet->getCalculateTeeTimes()) {
5514 t2_time =
static_cast<uint32_t
>(round(subnet->getT2Percent() * preferred_lft));
5518 resp->setT2(t2_time);
5521 uint32_t t1_time = 0;
5524 if (!subnet->getT1().unspecified()) {
5525 t1_time = subnet->getT1();
5526 }
else if (subnet->getCalculateTeeTimes()) {
5528 t1_time =
static_cast<uint32_t
>(round(subnet->getT1Percent() * preferred_lft));
5532 if (t1_time < t2_time) {
5533 resp->setT1(t1_time);
5544 bool reprocess_client_name =
false;
5551 if (iaaddr && (iaaddr->getValid() > 0)) {
5553 auto pool = ddns_params->setPoolFromAddress(iaaddr->getAddress());
5556 reprocess_client_name = pool->hasDdnsParameters();
5562 if (ctx.
subnet_ && orig_subnet && (orig_subnet->getID() != ctx.
subnet_->getID())) {
5567 orig_subnet->getSharedNetwork(network);
5569 .arg(question->getLabel())
5570 .arg(orig_subnet->toText())
5572 .arg(network ? network->getName() :
"<no network?>");
5575 reprocess_client_name =
true;
5580 if (reprocess_client_name) {
5582 std::string prev_hostname = ctx.
hostname_;
5603 l->reuseable_valid_lft_ = 0;
5611 static std::list<std::list<std::string>>
const list({
5612 {
"config-control",
"config-databases",
"[]"},
5613 {
"hooks-libraries",
"[]",
"parameters",
"*"},
5615 {
"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.
AllocEngine(isc::util::uint128_t const &attempts)
Constructor.
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.
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.
static constexpr size_t MIN_DUID_LEN
minimum duid size
static constexpr size_t MAX_DUID_LEN
maximum duid size
DUID(const std::vector< uint8_t > &data)
Constructor from vector.
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.
Option6ClientFqdn(const uint8_t flags, const std::string &domain_name, const DomainNameType domain_name_type=FULL)
Constructor, creates option instance using flags and domain name.
Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress &addr, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
Option6IAPrefix(uint16_t type, const isc::asiolink::IOAddress &addr, uint8_t prefix_length, uint32_t preferred, uint32_t valid)
Constructor, used for options constructed (during transmission).
uint32_t getIAID() const
Returns IA identifier.
Option6IA(uint16_t type, uint32_t iaid)
Ctor, used for constructed options, usually during transmission.
Option6StatusCode(const uint16_t status_code, const std::string &status_message)
Constructor, used for options constructed (during transmission).
OptionPtr option_
Option instance.
bool allowedForClientClasses(const ClientClasses &cclasses) const
Validates an OptionDescriptor's client-classes against a list of classes.
OptionVendor(Option::Universe u, const uint32_t vendor_id)
Constructor.
const OptionCollection & getOptions() const
Returns all encapsulated options.
OptionPtr getOption(uint16_t type) const
Returns shared_ptr to suboption of specific type.
Option(Universe u, uint16_t type)
ctor, used for options constructed, usually during transmission
virtual std::string getLabel() const
Returns text representation of the primary packet identifiers.
Pkt6(uint8_t msg_type, uint32_t transid, DHCPv6Proto proto=UDP)
Constructor, used in replying to a message.
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.
NameChangeRequest()
Default Constructor.
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_PROCESS_IA_NA_RELEASE
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS_EARLY
const isc::log::MessageID DHCP6_LEASE_ADVERT
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
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_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 ...
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 ...
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