8#include <kea_version.h>
65#include <boost/tokenizer.hpp>
66#include <boost/foreach.hpp>
67#include <boost/algorithm/string/erase.hpp>
68#include <boost/algorithm/string/join.hpp>
69#include <boost/algorithm/string/split.hpp>
92namespace ph = std::placeholders;
98 int hook_index_buffer6_receive_;
99 int hook_index_pkt6_receive_;
100 int hook_index_subnet6_select_;
101 int hook_index_leases6_committed_;
102 int hook_index_lease6_release_;
103 int hook_index_pkt6_send_;
104 int hook_index_buffer6_send_;
105 int hook_index_lease6_decline_;
106 int hook_index_host6_identifier_;
107 int hook_index_ddns6_update_;
142createStatusCode(
const Pkt6& pkt,
const uint16_t status_code,
143 const std::string& status_message) {
148 .arg(option_status->dataToText());
149 return (option_status);
167createStatusCode(
const Pkt6& pkt,
const Option6IA& ia,
const uint16_t status_code,
168 const std::string& status_message) {
174 .arg(option_status->dataToText());
175 return (option_status);
180std::set<std::string> dhcp6_statistics = {
182 "pkt6-solicit-received",
183 "pkt6-advertise-received",
184 "pkt6-request-received",
185 "pkt6-reply-received",
186 "pkt6-renew-received",
187 "pkt6-rebind-received",
188 "pkt6-decline-received",
189 "pkt6-release-received",
190 "pkt6-infrequest-received",
191 "pkt6-dhcpv4-query-received",
192 "pkt6-dhcpv4-response-received",
193 "pkt6-unknown-received",
195 "pkt6-advertise-sent",
197 "pkt6-dhcpv4-response-sent",
200 "v6-allocation-fail",
201 "v6-allocation-fail-shared-network",
202 "v6-allocation-fail-subnet",
203 "v6-allocation-fail-no-pools",
204 "v6-allocation-fail-classes",
205 "v6-ia-na-lease-reuses",
206 "v6-ia-pd-lease-reuses",
217 : io_service_(new
IOService()), server_port_(server_port),
218 client_port_(client_port), serverid_(), shutdown_(true),
219 alloc_engine_(), name_change_reqs_(),
249 }
catch (
const std::exception &e) {
264 for (
auto const& it : dhcp6_statistics) {
266 stats_mgr.
setValue(it,
static_cast<int64_t
>(0));
276 }
catch (
const std::exception& ex) {
283 }
catch (
const std::exception& ex) {
297 if (!names.empty()) {
299 for (
size_t i = 1; i < names.size(); ++i) {
300 msg += std::string(
", ") + names[i];
306 io_service_->restart();
336 if (
getServerID()->getData() != server_id->getData()){
338 .arg(pkt->getLabel())
350 switch (pkt->getType()) {
355 if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
357 .arg(pkt->getLabel())
358 .arg(pkt->getName());
373 for (
auto const& id_type : cfg->getIdentifierTypes()) {
394 std::vector<uint8_t> id;
403 callout_handle->setArgument(
"query6", ctx.
query_);
404 callout_handle->setArgument(
"id_type", type);
405 callout_handle->setArgument(
"id_value",
id);
411 callout_handle->getArgument(
"id_type", type);
412 callout_handle->getArgument(
"id_value",
id);
437 ctx.
duid_ = query->getClientId();
464 if (global_host && !global_host->getClientClasses6().empty()) {
469 const ClientClasses& classes = global_host->getClientClasses6();
470 for (
auto const& cclass : classes) {
471 query->addClass(cclass);
480 query->addClass(
"KNOWN");
482 .arg(query->getLabel())
489 if (query->inClass(
"DROP")) {
492 .arg(query->makeLabel(query->getClientId(),
nullptr))
493 .arg(query->toText());
495 static_cast<int64_t
>(1));
500 ctx.
hosts_[SUBNET_ID_GLOBAL] = global_host;
534 ctx.
subnet_->getSharedNetwork(sn);
546 global_host && !global_host->getClientClasses6().empty()) ||
547 (!sn && current_host && !current_host->getClientClasses6().empty())) {
568 if (!ctx.
hosts_.empty()) {
569 ctx.
query_->addClass(
"KNOWN");
571 .arg(ctx.
query_->getLabel())
574 ctx.
query_->addClass(
"UNKNOWN");
576 .arg(ctx.
query_->getLabel())
585 .arg(ctx.
query_->getLabel())
589 if (ctx.
query_->inClass(
"DROP")) {
591 .arg(ctx.
query_->makeLabel(ctx.
query_->getClientId(), 0))
592 .arg(ctx.
query_->toText());
594 static_cast<int64_t
>(1));
607 while (__AFL_LOOP(fuzzer.maxLoopCount())) {
617 }
catch (
const std::exception& e) {
648 uint32_t timeout = 1;
659 .arg(query->getRemoteAddr().toText())
660 .arg(query->getRemotePort())
661 .arg(query->getLocalAddr().toText())
662 .arg(query->getLocalPort())
663 .arg(query->getIface());
685 }
catch (
const std::exception& e) {
698 .arg(query->getLabel());
702 query->addPktEvent(
"mt_queued");
703 typedef function<void()> CallBack;
704 boost::shared_ptr<CallBack> call_back =
720 }
catch (
const std::exception& e) {
741 query->addPktEvent(
"process_started");
744 query->addClass(
"ALL");
746 bool skip_unpack =
false;
763 callout_handle->setArgument(
"query6", query);
774 .arg(query->getRemoteAddr().toText())
775 .arg(query->getLocalAddr().toText())
776 .arg(query->getIface());
785 .arg(query->getRemoteAddr().toText())
786 .arg(query->getLocalAddr().toText())
787 .arg(query->getIface());
791 static_cast<int64_t
>(1));
795 callout_handle->getArgument(
"query6", query);
807 .arg(query->getRemoteAddr().toText())
808 .arg(query->getLocalAddr().toText())
809 .arg(query->getIface());
817 }
catch (
const std::exception &e) {
820 .arg(query->getRemoteAddr().toText())
821 .arg(query->getLocalAddr().toText())
822 .arg(query->getIface())
824 .arg(query->makeLabel(query->getClientId(),
nullptr));
828 static_cast<int64_t
>(1));
830 static_cast<int64_t
>(1));
837 .arg(query->getLabel());
840 processStatsReceived(query);
865 .arg(query->getLabel())
866 .arg(query->getName())
867 .arg(
static_cast<int>(query->getType()))
868 .arg(query->getRemoteAddr())
869 .arg(query->getLocalAddr())
870 .arg(query->getIface());
872 .arg(query->getLabel())
873 .arg(query->toText());
891 callout_handle->setArgument(
"query6", query);
902 .arg(query->getLabel());
905 static_cast<int64_t
>(1));
909 callout_handle->getArgument(
"query6", query);
922 if (query->inClass(
"DROP")) {
924 .arg(query->makeLabel(query->getClientId(),
nullptr))
925 .arg(query->toText());
927 static_cast<int64_t
>(1));
944 }
catch (
const std::exception& e) {
968 if (!client_handler.
tryLock(query, cont)) {
1009 }
catch (
const std::exception& e) {
1026 callout_handle->getContext(
"subnet6", ctx.
subnet_);
1046 switch (query->getType()) {
1083 }
catch (
const std::exception& e) {
1093 .arg(query->getName())
1094 .arg(query->getRemoteAddr().toText())
1117 rsp->setRemoteAddr(query->getRemoteAddr());
1118 rsp->setLocalAddr(query->getLocalAddr());
1123 }
else if (rsp->relay_info_.empty()) {
1125 rsp->setRemotePort(DHCP6_CLIENT_PORT);
1129 rsp->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT);
1135 rsp->setLocalPort(DHCP6_SERVER_PORT);
1137 rsp->setIndex(query->getIndex());
1138 rsp->setIface(query->getIface());
1167 std::shared_ptr<ScopedCalloutHandleState> callout_handle_state =
1168 std::make_shared<ScopedCalloutHandleState>(callout_handle);
1173 callout_handle->setArgument(
"query6", query);
1179 if (new_lease->reuseable_valid_lft_ == 0) {
1180 new_leases->push_back(new_lease);
1184 callout_handle->setArgument(
"leases6", new_leases);
1189 for (
auto const& iac : ctx.
ias_) {
1190 if (!iac.old_leases_.empty()) {
1191 for (
auto const& old_lease : iac.old_leases_) {
1193 deleted_leases->push_back(old_lease);
1196 bool in_new =
false;
1198 if ((new_lease->addr_ == old_lease->addr_) &&
1200 (new_lease->prefixlen_ == old_lease->prefixlen_))) {
1206 deleted_leases->push_back(old_lease);
1211 callout_handle->setArgument(
"deleted_leases6", deleted_leases);
1214 uint32_t parked_packet_limit = 0;
1218 parked_packet_limit = ppl->intValue();
1221 if (parked_packet_limit) {
1223 getParkingLotPtr(
"leases6_committed");
1224 if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
1228 .arg(parked_packet_limit)
1229 .arg(query->getLabel());
1231 static_cast<int64_t
>(1));
1243 [
this, callout_handle, query, rsp, callout_handle_state, subnet]()
mutable {
1245 typedef function<void()> CallBack;
1246 boost::shared_ptr<CallBack> call_back =
1248 this, callout_handle, query, rsp, subnet));
1249 callout_handle_state->on_completion_ = [call_back]() {
1270 .arg(query->getLabel());
1281 .arg(query->getLabel());
1301 }
catch (
const std::exception& e) {
1312 query->addPktEvent(
"process_completed");
1318 bool skip_pack =
false;
1336 callout_handle->setArgument(
"query6", query);
1339 callout_handle->setArgument(
"response6", rsp);
1342 callout_handle->setArgument(
"subnet6", subnet);
1354 .arg(rsp->getLabel());
1361 .arg(rsp->getLabel());
1370 }
catch (
const std::exception& e) {
1402 callout_handle->setArgument(
"response6", rsp);
1415 .arg(rsp->getLabel());
1419 callout_handle->getArgument(
"response6", rsp);
1423 .arg(rsp->getLabel())
1424 .arg(rsp->getName())
1425 .arg(
static_cast<int>(rsp->getType()))
1426 .arg(rsp->getLocalAddr().isV6Zero() ?
"*" : rsp->getLocalAddr().toText())
1427 .arg(rsp->getLocalPort())
1428 .arg(rsp->getRemoteAddr())
1429 .arg(rsp->getRemotePort())
1430 .arg(rsp->getIface());
1433 .arg(rsp->getLabel())
1434 .arg(rsp->getName())
1435 .arg(
static_cast<int>(rsp->getType()))
1436 .arg(rsp->toText());
1442 }
catch (
const std::exception& e) {
1454 for (
auto const& it : data) {
1458 tmp << hex << setw(2) << setfill('0') << static_cast<uint16_t>(it);
1472 answer->addOption(clientid);
1477 if (!question->relay_info_.empty()) {
1478 answer->copyRelayInfo(question);
1496 co_list.push_back(ctx.
currentHost()->getCfgOption6());
1504 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
1506 resource.getAddress(),
1508 if (pool && !pool->getCfgOption()->empty()) {
1509 co_list.push_back(pool->getCfgOption());
1514 if (!ctx.
subnet_->getCfgOption()->empty()) {
1515 co_list.push_back(ctx.
subnet_->getCfgOption());
1520 ctx.
subnet_->getSharedNetwork(network);
1521 if (network && !network->getCfgOption()->empty()) {
1522 co_list.push_back(network->getCfgOption());
1528 for (
auto const& cclass : classes) {
1531 getClientClassDictionary()->findClass(cclass);
1536 .arg(question->getLabel())
1543 if (ccdef->getCfgOption()->empty()) {
1548 co_list.push_back(ccdef->getCfgOption());
1561 if (co_list.empty()) {
1565 set<uint16_t> requested_opts;
1574 for (uint16_t code : option_oro->getValues()) {
1575 static_cast<void>(requested_opts.insert(code));
1579 set<uint16_t> cancelled_opts;
1583 for (
auto const& copts : co_list) {
1591 BOOST_FOREACH(
auto const& desc, prange) {
1594 uint16_t code = desc.option_->
getType();
1595 static_cast<void>(requested_opts.insert(code));
1601 BOOST_FOREACH(
auto const& desc, crange) {
1604 uint16_t code = desc.option_->getType();
1605 static_cast<void>(cancelled_opts.insert(code));
1612 for (uint16_t opt : requested_opts) {
1614 if (cancelled_opts.count(opt) > 0) {
1622 if (!answer->getOption(opt)) {
1624 for (
auto const& copts : co_list) {
1628 answer->addOption(desc.
option_);
1641 set<uint32_t> vendor_ids;
1645 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1647 uint32_t vendor_id = vendor_class->getVendorId();
1648 static_cast<void>(vendor_ids.insert(vendor_id));
1652 for (
auto const& copts : co_list) {
1654 if (!desc.option_) {
1658 boost::dynamic_pointer_cast<OptionVendorClass>(desc.option_);
1659 if (!vendor_class) {
1663 uint32_t vendor_id = vendor_class->getVendorId();
1664 if (vendor_ids.count(vendor_id) > 0) {
1668 answer->addOption(desc.option_);
1669 static_cast<void>(vendor_ids.insert(vendor_id));
1678 set<uint32_t> vendor_ids;
1682 vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1684 uint32_t vendor_id = vendor_opts->getVendorId();
1685 static_cast<void>(vendor_ids.insert(vendor_id));
1689 for (
auto const& copts : co_list) {
1691 if (!desc.option_) {
1695 boost::dynamic_pointer_cast<OptionVendor>(desc.option_);
1700 uint32_t vendor_id = vendor_opts->getVendorId();
1701 if (vendor_ids.count(vendor_id) > 0) {
1707 answer->addOption(vendor_opts);
1708 static_cast<void>(vendor_ids.insert(vendor_id));
1727 if (!ctx.
subnet_ || co_list.empty()) {
1731 set<uint32_t> vendor_ids;
1735 map<uint32_t, OptionVendorPtr> vendor_rsps;
1738 vendor_rsp = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1740 uint32_t vendor_id = vendor_rsp->getVendorId();
1741 vendor_rsps[vendor_id] = vendor_rsp;
1742 static_cast<void>(vendor_ids.insert(vendor_id));
1748 map<uint32_t, OptionVendorPtr> vendor_reqs;
1751 vendor_req = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
1753 uint32_t vendor_id = vendor_req->getVendorId();
1754 vendor_reqs[vendor_id] = vendor_req;
1755 static_cast<void>(vendor_ids.insert(vendor_id));
1763 vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
1765 uint32_t vendor_id = vendor_class->getVendorId();
1766 static_cast<void>(vendor_ids.insert(vendor_id));
1772 if (vendor_ids.empty()) {
1776 map<uint32_t, set<uint16_t> > requested_opts;
1790 oro = boost::dynamic_pointer_cast<OptionUint16Array>(oro_generic);
1793 set<uint16_t> oro_req_opts;
1794 for (uint16_t code : oro->getValues()) {
1795 static_cast<void>(oro_req_opts.insert(code));
1801 map<uint32_t, set<uint16_t> > cancelled_opts;
1805 for (uint32_t vendor_id : vendor_ids) {
1806 for (
auto const& copts : co_list) {
1814 BOOST_FOREACH(
auto const& desc, prange) {
1815 if (!desc.option_) {
1819 uint16_t code = desc.option_->getType();
1820 static_cast<void>(requested_opts[vendor_id].insert(code));
1825 BOOST_FOREACH(
auto const& desc, crange) {
1826 if (!desc.option_) {
1830 uint16_t code = desc.option_->getType();
1831 static_cast<void>(cancelled_opts[vendor_id].insert(code));
1840 if (requested_opts[vendor_id].empty()) {
1847 if (vendor_rsps.count(vendor_id) > 0) {
1848 vendor_rsp = vendor_rsps[vendor_id];
1856 for (uint16_t opt : requested_opts[vendor_id]) {
1857 if (cancelled_opts[vendor_id].count(opt) > 0) {
1860 if (!vendor_rsp->getOption(opt)) {
1861 for (
auto const& copts : co_list) {
1864 vendor_rsp->addOption(desc.
option_);
1874 if (added && (vendor_rsps.count(vendor_id) == 0)) {
1875 answer->addOption(vendor_rsp);
1883 switch (pkt->getType()) {
1905 .arg(
static_cast<int>(pkt->getType()))
1906 .arg(pkt->getIface());
1911 .arg(pkt->getName())
1912 .arg(pkt->getRemoteAddr().toText())
1928 if (client_ids.size() != 1) {
1930 << pkt->getName() <<
", but " << client_ids.size()
1937 if (client_ids.size() > 1) {
1939 <<
") client-id options received in " << pkt->getName());
1941 if (!client_ids.empty()) {
1954 if (!server_ids.empty()) {
1956 << server_ids.size() <<
" received in " << pkt->getName());
1961 if (server_ids.size() != 1) {
1963 << server_ids.size() <<
"), exactly 1 expected in message "
1970 if (server_ids.size() > 1) {
1972 <<
") server-id options received in " << pkt->getName());
1974 if (!server_ids.empty()) {
1987 uint16_t len = opt->len() - opt->getHeaderLen();
2000 getCfgSubnets6()->selectSubnet(selector);
2010 shared_ptr<ScopedCalloutHandleState> callout_handle_state(
2011 std::make_shared<ScopedCalloutHandleState>(callout_handle));
2017 callout_handle->setArgument(
"query6", question);
2018 callout_handle->setArgument(
"subnet6", subnet);
2023 callout_handle->setArgument(
"subnet6collection",
2025 getCfgSubnets6()->getAll());
2027 auto const tpl(parkingLimitExceeded(
"subnet6_select"));
2028 bool const exceeded(get<0>(tpl));
2030 uint32_t
const limit(get<1>(tpl));
2035 .arg(question->getLabel());
2042 HooksManager::park(
"subnet6_select", question, [
this, question, callout_handle_state]() {
2044 boost::shared_ptr<function<void()>> callback(
2045 boost::make_shared<function<
void()>>([
this, question]()
mutable {
2048 callout_handle_state->on_completion_ = [callback]() {
2070 .arg(question->getLabel());
2083 .arg(question->getLabel());
2091 .arg(question->getLabel());
2097 callout_handle->getArgument(
"subnet6", subnet);
2103 .arg(question->getLabel())
2104 .arg(subnet->getID());
2108 .arg(question->getLabel())
2109 .arg(subnet->toText());
2113 .arg(question->getLabel());
2138 for (
auto const& opt : question->options_) {
2139 switch (opt.second->getType()) {
2142 boost::dynamic_pointer_cast<
2145 answer->addOption(answer_opt);
2151 boost::dynamic_pointer_cast<
2154 answer->addOption(answer_opt);
2179 if (ddns_params->getEnableUpdates() &&
2189 .arg(question->getLabel());
2202 .arg(question->getLabel())
2203 .arg(fqdn->toText());
2222 *ddns_params,
true),
2232 ctx.
hostname_ = fqdn_resp->getDomainName();
2239 .arg(question->getLabel())
2240 .arg(fqdn_resp->toText());
2241 answer->addOption(fqdn_resp);
2256 callout_handle->setArgument(
"query6", question);
2257 callout_handle->setArgument(
"response6", answer);
2258 callout_handle->setArgument(
"subnet6", subnet);
2259 callout_handle->setArgument(
"hostname", ctx.
hostname_);
2262 callout_handle->setArgument(
"ddns-params", ddns_params);
2268 string hook_hostname;
2269 bool hook_fwd_dns_update;
2270 bool hook_rev_dns_update;
2271 callout_handle->getArgument(
"hostname", hook_hostname);
2272 callout_handle->getArgument(
"fwd-update", hook_fwd_dns_update);
2273 callout_handle->getArgument(
"rev-update", hook_rev_dns_update);
2284 fqdn_resp = boost::dynamic_pointer_cast<Option6ClientFqdn>(answer->getOption(
D6O_CLIENT_FQDN));
2287 if (!(hook_fwd_dns_update || hook_rev_dns_update)) {
2314 <<
" encapsulating server's message must not be"
2315 <<
" NULL when creating DNS NameChangeRequest");
2328 bool do_fwd =
false;
2329 bool do_rev =
false;
2339 "client identifier is required when creating a new"
2340 " DNS NameChangeRequest");
2347 opt_fqdn->packDomainName(name_buf);
2348 const std::vector<uint8_t>& buf_vec = name_buf.
getVector();
2354 for (
auto const& answer_ia : answer->getOptions(
D6O_IA_NA)) {
2369 bool extended_only =
false;
2372 if (l->addr_ == iaaddr->getAddress()) {
2377 (l->hostname_ == opt_fqdn->getDomainName() &&
2378 l->fqdn_fwd_ == do_fwd && l->fqdn_rev_ == do_rev)) {
2379 extended_only =
true;
2391 if (!(do_fwd || do_rev) || (extended_only)) {
2407 opt_fqdn->getDomainName(),
2408 iaaddr->getAddress().toText(),
2430 getMACSources().get();
2432 for (
auto const& it : mac_sources) {
2433 hwaddr = pkt->getMAC(it);
2444 boost::shared_ptr<Option6IA> ia) {
2450 boost::dynamic_pointer_cast<Option6IAAddr>(ia->getOption(
D6O_IAADDR));
2453 hint = hint_opt->getAddress();
2458 .arg(query->getLabel())
2460 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2463 .arg(query->getLabel())
2465 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2485 "Server could not select subnet for"
2508 if (!leases.empty()) {
2509 lease = *leases.begin();
2522 .arg(query->getLabel())
2523 .arg(lease->addr_.toText())
2524 .arg(ia->getIAID());
2525 }
else if (lease->reuseable_valid_lft_ == 0) {
2527 .arg(query->getLabel())
2528 .arg(lease->addr_.toText())
2532 lease->valid_lft_ = lease->reuseable_valid_lft_;
2533 lease->preferred_lft_ = lease->reuseable_preferred_lft_;
2535 .arg(query->getLabel())
2536 .arg(lease->addr_.toText())
2543 "v6-ia-na-lease-reuses"),
2547 .arg(query->getLabel())
2549 .arg(lease->toText());
2552 setTeeTimes(lease->preferred_lft_, subnet, ia_rsp);
2555 lease->preferred_lft_,
2556 lease->valid_lft_));
2557 ia_rsp->addOption(addr);
2570 .arg(query->getLabel())
2571 .arg(ia->getIAID());
2573 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2575 "Sorry, no address could be"
2584 boost::shared_ptr<Option6IA> ia) {
2591 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
2594 hint = hint_opt->getAddress();
2599 .arg(query->getLabel())
2601 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2604 .arg(query->getLabel())
2606 .arg(hint_opt ? hint.
toText() :
"(no hint)");
2624 "Sorry, no subnet available."));
2644 if (!leases.empty()) {
2648 uint32_t min_preferred_lft = (*leases.begin())->preferred_lft_;
2650 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2651 for (
auto const& l : leases) {
2657 .arg(query->getLabel())
2658 .arg(l->addr_.toText())
2659 .arg(
static_cast<int>(l->prefixlen_))
2660 .arg(ia->getIAID());
2661 }
else if (l->reuseable_valid_lft_ == 0) {
2663 .arg(query->getLabel())
2664 .arg(l->addr_.toText())
2665 .arg(
static_cast<int>(l->prefixlen_))
2669 l->valid_lft_ = l->reuseable_valid_lft_;
2670 l->preferred_lft_ = l->reuseable_preferred_lft_;
2672 .arg(query->getLabel())
2673 .arg(l->addr_.toText())
2674 .arg(
static_cast<int>(l->prefixlen_))
2681 "v6-ia-pd-lease-reuses"),
2686 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
2687 min_preferred_lft = l->preferred_lft_;
2690 boost::shared_ptr<Option6IAPrefix>
2692 l->prefixlen_, l->preferred_lft_,
2694 ia_rsp->addOption(addr);
2696 if (pd_exclude_requested) {
2699 Pool6Ptr pool = boost::dynamic_pointer_cast<
2703 if (pd_exclude_option) {
2704 addr->addOption(pd_exclude_option);
2724 .arg(query->getLabel())
2725 .arg(ia->getIAID());
2727 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2729 "Sorry, no prefixes could"
2738 boost::shared_ptr<Option6IA> ia) {
2741 .arg(query->getLabel())
2742 .arg(ia->getIAID());
2761 "Sorry, no known leases for this duid/iaid."));
2773 for (
auto const& it : addrs) {
2777 Option6IAAddrPtr iaaddr = boost::dynamic_pointer_cast<Option6IAAddr>(it.second);
2804 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
2807 for (
auto const& l : leases) {
2808 if (l->reuseable_valid_lft_ == 0) {
2810 .arg(query->getLabel())
2811 .arg(l->addr_.toText())
2812 .arg(ia->getIAID());
2814 l->valid_lft_ = l->reuseable_valid_lft_;
2815 l->preferred_lft_ = l->reuseable_preferred_lft_;
2817 .arg(query->getLabel())
2818 .arg(l->addr_.toText())
2825 "v6-ia-na-lease-reuses"),
2830 l->addr_, l->preferred_lft_, l->valid_lft_));
2831 ia_rsp->addOption(iaaddr);
2834 if ((l->preferred_lft_ > 0) && (min_preferred_lft > l->preferred_lft_)) {
2835 min_preferred_lft = l->preferred_lft_;
2840 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
2850 if (
equalValues(query->getClientId(), l->duid_)) {
2853 ia_rsp->addOption(iaaddr);
2858 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
2866 .arg(query->getLabel())
2878 for (
auto const& hint : hints) {
2880 hint.getAddress(), 0, 0));
2881 ia_rsp->addOption(iaaddr);
2884 if (!leases.empty()) {
2890 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2892 "Sorry, no addresses could be"
2893 " assigned at this time."));
2902 boost::shared_ptr<Option6IA> ia) {
2905 .arg(query->getLabel())
2906 .arg(ia->getIAID());
2923 "Sorry, no known PD leases"
2924 " for this duid/iaid."));
2944 " client sending Rebind to extend lifetime of the"
2945 " prefix (DUID=" << duid->toText() <<
", IAID="
2946 << ia->getIAID() <<
")");
2958 for (
auto const& it : addrs) {
2992 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2996 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
2998 for (
auto const& l : leases) {
2999 if (l->reuseable_valid_lft_ == 0) {
3001 .arg(query->getLabel())
3002 .arg(l->addr_.toText())
3003 .arg(
static_cast<int>(l->prefixlen_))
3004 .arg(ia->getIAID());
3006 l->valid_lft_ = l->reuseable_valid_lft_;
3007 l->preferred_lft_ = l->reuseable_preferred_lft_;
3009 .arg(query->getLabel())
3010 .arg(l->addr_.toText())
3011 .arg(
static_cast<int>(l->prefixlen_))
3018 "v6-ia-pd-lease-reuses"),
3023 l->addr_, l->prefixlen_,
3024 l->preferred_lft_, l->valid_lft_));
3025 ia_rsp->addOption(prf);
3027 if (pd_exclude_requested) {
3030 Pool6Ptr pool = boost::dynamic_pointer_cast<
3035 if (pd_exclude_option) {
3036 prf->addOption(pd_exclude_option);
3042 if ((l->preferred_lft_ > 0) && (l->preferred_lft_ < min_preferred_lft)) {
3043 min_preferred_lft = l->preferred_lft_;
3048 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
3058 if (
equalValues(query->getClientId(), l->duid_)) {
3060 l->prefixlen_, 0, 0));
3061 ia_rsp->addOption(prefix);
3066 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
3071 for (
auto const& prefix : hints) {
3076 if (!prefix.getAddress().isV6Zero()) {
3078 prefix.getAddress(),
3079 prefix.getPrefixLength(),
3081 ia_rsp->addOption(prefix_opt);
3085 if (!leases.empty()) {
3092 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
3094 "Sorry, no prefixes could be"
3095 " assigned at this time."));
3116 for (
auto const& opt : query->options_) {
3117 switch (opt.second->getType()) {
3120 boost::dynamic_pointer_cast<
3123 reply->addOption(answer_opt);
3130 boost::dynamic_pointer_cast<
3133 reply->addOption(answer_opt);
3168 for (
auto const& opt : release->options_) {
3170 switch (opt.second->getType()) {
3173 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3176 reply->addOption(answer_opt);
3182 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3185 reply->addOption(answer_opt);
3202 reply->addOption(createStatusCode(*release, general_status,
3203 "Summary status for all processed IA_NAs"));
3208 int& general_status, boost::shared_ptr<Option6IA> ia,
3212 .arg(query->getLabel())
3213 .arg(ia->getIAID());
3229 if (!release_addr) {
3231 "You did not include an address in your RELEASE"));
3237 release_addr->getAddress());
3244 "Sorry, no known leases for this duid/iaid, can't release."));
3250 if (!lease->duid_) {
3256 .arg(query->getLabel())
3257 .arg(release_addr->getAddress().toText());
3261 "Database consistency check failed when trying to RELEASE"));
3265 if (*duid != *(lease->duid_)) {
3269 .arg(query->getLabel())
3270 .arg(release_addr->getAddress().toText())
3271 .arg(lease->duid_->toText());
3275 "This address does not belong to you, you can't release it"));
3279 if (ia->getIAID() != lease->iaid_) {
3282 .arg(query->getLabel())
3283 .arg(release_addr->getAddress().toText())
3285 .arg(ia->getIAID());
3287 "This is your address, but you used wrong IAID"));
3310 callout_handle->deleteAllArguments();
3313 callout_handle->setArgument(
"query6", query);
3316 callout_handle->setArgument(
"lease6", lease);
3328 .arg(query->getLabel());
3333 bool success =
false;
3334 bool expired =
false;
3341 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3342 expiration_cfg->getHoldReclaimedTime() &&
3345 lease->valid_lft_ = 0;
3346 lease->preferred_lft_ = 0;
3360 "Server failed to release a lease"));
3363 .arg(query->getLabel())
3364 .arg(lease->addr_.toText())
3373 .arg(query->getLabel())
3374 .arg(lease->addr_.toText())
3377 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3378 "Lease released. Thank you, please come again."));
3382 .arg(query->getLabel())
3383 .arg(lease->addr_.toText())
3387 .arg(query->getLabel())
3388 .arg(lease->addr_.toText())
3394 static_cast<int64_t
>(-1));
3398 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
3403 static_cast<int64_t
>(-1));
3419 int& general_status, boost::shared_ptr<Option6IA> ia,
3434 boost::shared_ptr<Option6IAPrefix> release_prefix =
3435 boost::dynamic_pointer_cast<Option6IAPrefix>(ia->getOption(
D6O_IAPREFIX));
3436 if (!release_prefix) {
3438 "You did not include a prefix in your RELEASE"));
3444 release_prefix->getAddress());
3451 "Sorry, no known leases for this duid/iaid, can't release."));
3457 if (!lease->duid_) {
3462 .arg(query->getLabel())
3463 .arg(release_prefix->getAddress().toText())
3464 .arg(
static_cast<int>(release_prefix->getLength()));
3468 "Database consistency check failed when trying to RELEASE"));
3472 if (*duid != *(lease->duid_)) {
3475 .arg(query->getLabel())
3476 .arg(release_prefix->getAddress().toText())
3477 .arg(
static_cast<int>(release_prefix->getLength()))
3478 .arg(lease->duid_->toText());
3482 "This address does not belong to you, you can't release it"));
3486 if (ia->getIAID() != lease->iaid_) {
3489 .arg(query->getLabel())
3490 .arg(release_prefix->getAddress().toText())
3491 .arg(
static_cast<int>(release_prefix->getLength()))
3493 .arg(ia->getIAID());
3495 "This is your address, but you used wrong IAID"));
3518 callout_handle->setArgument(
"query6", query);
3521 callout_handle->setArgument(
"lease6", lease);
3533 .arg(query->getLabel());
3538 bool success =
false;
3539 bool expired =
false;
3546 if (expiration_cfg->getFlushReclaimedTimerWaitTime() &&
3547 expiration_cfg->getHoldReclaimedTime() &&
3550 lease->valid_lft_ = 0;
3551 lease->preferred_lft_ = 0;
3565 "Server failed to release a lease"));
3568 .arg(query->getLabel())
3569 .arg(lease->addr_.toText())
3570 .arg(
static_cast<int>(lease->prefixlen_))
3578 .arg(query->getLabel())
3579 .arg(lease->addr_.toText())
3580 .arg(
static_cast<int>(lease->prefixlen_))
3583 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3584 "Lease released. Thank you, please come again."));
3588 .arg(query->getLabel())
3589 .arg(lease->addr_.toText())
3590 .arg(
static_cast<int>(lease->prefixlen_))
3594 .arg(query->getLabel())
3595 .arg(lease->addr_.toText())
3596 .arg(
static_cast<int>(lease->prefixlen_))
3602 static_cast<int64_t
>(-1));
3606 auto const& pool = subnet->getPool(
Lease::TYPE_PD, lease->addr_,
false);
3611 static_cast<int64_t
>(-1));
3629 if (opt_rapid_commit) {
3632 .arg(solicit->getLabel());
3637 response->addOption(opt_rapid_commit);
3669 .arg(solicit->getLabel())
3670 .arg(solicit->getName())
3671 .arg(solicit->getClasses().toText());
3680 updateReservedFqdn(ctx, response);
3712 .arg(request->getLabel())
3713 .arg(request->getName())
3714 .arg(request->getClasses().toText());
3723 updateReservedFqdn(ctx, reply);
3724 generateFqdn(reply, ctx);
3751 .arg(renew->getLabel())
3752 .arg(renew->getName())
3753 .arg(renew->getClasses().toText());
3762 updateReservedFqdn(ctx, reply);
3763 generateFqdn(reply, ctx);
3790 .arg(rebind->getLabel())
3791 .arg(rebind->getName())
3792 .arg(rebind->getClasses().toText());
3801 updateReservedFqdn(ctx, reply);
3802 generateFqdn(reply, ctx);
3816 .arg(confirm->getLabel())
3817 .arg(confirm->getName())
3818 .arg(confirm->getClasses().toText());
3839 bool verified =
false;
3848 for (
auto const& ia : ias) {
3850 for (
auto const& opt : opts) {
3862 if (subnet && !subnet->inRange(iaaddr->getAddress())) {
3863 std::ostringstream status_msg;
3864 status_msg <<
"Address " << iaaddr->
getAddress()
3865 <<
" is not on link.";
3866 reply->addOption(createStatusCode(*confirm,
3874 " to the Option6IAAddrPtr. This is programming"
3875 " error and should be reported");
3892 "All addresses are on-link"));
3895 "No subnet selected"));
3909 .arg(release->getLabel())
3910 .arg(release->getName())
3911 .arg(release->getClasses().toText());
3940 .arg(decline->getLabel())
3941 .arg(decline->getName())
3942 .arg(decline->getClasses().toText());
3981 for (
auto const& opt : decline->options_) {
3982 switch (opt.second->getType()) {
3985 boost::dynamic_pointer_cast<Option6IA>(opt.second),
3990 reply->addOption(answer_opt);
4011 int& general_status, boost::shared_ptr<Option6IA> ia,
4015 .arg(decline->getLabel())
4016 .arg(ia->getIAID());
4031 int total_addrs = 0;
4032 for (
auto const& opt : opts) {
4041 if (!decline_addr) {
4048 decline_addr->getAddress());
4053 .arg(decline->getLabel()).arg(decline_addr->getAddress().toText());
4061 "Server does not know about such an address."));
4069 if (!lease->duid_) {
4075 .arg(decline->getLabel())
4076 .arg(decline_addr->getAddress().toText());
4079 "Database consistency check failed when attempting Decline."));
4085 if (*duid != *(lease->duid_)) {
4089 .arg(decline->getLabel())
4090 .arg(decline_addr->getAddress().toText())
4091 .arg(lease->duid_->toText());
4094 "This address does not belong to you, you can't decline it"));
4100 if (ia->getIAID() != lease->iaid_) {
4103 .arg(decline->getLabel())
4104 .arg(lease->addr_.toText())
4108 "This is your address, but you used wrong IAID"));
4120 new_leases.push_back(lease);
4124 if (total_addrs == 0) {
4126 "No addresses sent in IA_NA"));
4139 container->addOption(status);
4144 boost::shared_ptr<Option6IA> ia_rsp) {
4168 callout_handle->setArgument(
"query6", decline);
4171 callout_handle->setArgument(
"lease6", lease);
4182 .arg(decline->getLabel())
4183 .arg(decline->getIface())
4184 .arg(lease->addr_.toText());
4192 .arg(decline->getLabel())
4193 .arg(decline->getIface())
4194 .arg(lease->addr_.toText());
4199 Lease6Ptr old_values = boost::make_shared<Lease6>(*lease);
4213 .arg(decline->getLabel())
4214 .arg(lease->addr_.toText())
4227 static_cast<int64_t
>(1));
4231 auto const& pool = subnet->getPool(
Lease::TYPE_NA, lease->addr_,
false);
4236 static_cast<int64_t
>(1));
4244 .arg(lease->addr_.toText()).arg(lease->valid_lft_);
4246 ia_rsp->addOption(createStatusCode(*decline, *ia_rsp,
STATUS_Success,
4247 "Lease declined. Hopefully the next one will be better."));
4260 .arg(inf_request->getLabel())
4261 .arg(inf_request->getName())
4262 .arg(inf_request->getClasses().toText());
4311void Dhcpv6Srv::classifyByVendor(
const Pkt6Ptr& pkt) {
4314 vclass = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
4315 if (!vclass || vclass->getTuplesNum() == 0) {
4333 pkt->addClass(
"ALL");
4336 classifyByVendor(pkt);
4347 for (
auto const& it : *defs_ptr) {
4355 if (it->getRequired()) {
4359 if (it->getDependOnKnown() != depend_on_known) {
4362 it->test(pkt, expr_ptr);
4371 for (
auto const& def : *defs_ptr) {
4375 if (def->getMatchExpr()) {
4376 pkt->classes_.erase(def->getName());
4386 for (
auto const& cclass : classes) {
4387 pkt->addClass(cclass);
4397 ctx.
subnet_->getSharedNetwork(shared_network);
4398 if (shared_network) {
4400 if (host && (host->getIPv6SubnetID() != SUBNET_ID_GLOBAL)) {
4416 subnet->getSharedNetwork(network);
4418 const ClientClasses& to_add = network->getRequiredClasses();
4419 for (
auto const& cclass : to_add) {
4426 for (
auto const& cclass : to_add) {
4433 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
4435 resource.getAddress(),
4438 const ClientClasses& pool_to_add = pool->getRequiredClasses();
4439 for (
auto const& cclass : pool_to_add) {
4452 for (
auto const& cclass : classes) {
4475 pkt->addClass(cclass);
4488 .arg(
"get exception?");
4498 " a message must not be NULL when updating reserved FQDN");
4509 std::string name = fqdn->getDomainName();
4521 if (new_name != name) {
4526 answer->addOption(fqdn);
4532Dhcpv6Srv::generateFqdn(
const Pkt6Ptr& answer,
4536 " a message must not be NULL when generating FQDN");
4547 if (!fqdn || !fqdn->getDomainName().empty()) {
4565 std::string generated_name =
4569 .arg(answer->getLabel())
4570 .arg(generated_name);
4587 lease->hostname_ = generated_name;
4588 lease->reuseable_valid_lft_ = 0;
4593 " for address " << addr <<
", so as it is impossible"
4594 " to update FQDN data. This is a programmatic error"
4595 " as the given address is now being handed to the"
4603 answer->addOption(fqdn);
4607 .arg(answer->getLabel())
4621 this, ph::_1, ph::_2));
4640 arg(result).arg((ncr ? ncr->toText() :
" NULL "));
4649 std::stringstream tmp;
4653 tmp << endl << EXTENDED_VERSION << endl;
4654 tmp <<
"linked with:" << endl;
4657 tmp <<
"database:" << endl;
4674 if (query->relay_info_.empty()) {
4685 for (
int i = query->relay_info_.size(); i > 0 ; --i) {
4687 if (rsoo_container) {
4692 for (
auto const& opt : rsoo) {
4696 if (cfg_rsoo->enabled(opt.second->getType()) &&
4697 !rsp->getOption(opt.second->getType())) {
4698 rsp->addOption(opt.second);
4707 if (query->relay_info_.empty()) {
4715 return (query->getRemotePort());
4721void Dhcpv6Srv::processStatsReceived(
const Pkt6Ptr& query) {
4725 string stat_name =
"pkt6-unknown-received";
4726 switch (query->getType()) {
4728 stat_name =
"pkt6-solicit-received";
4732 stat_name =
"pkt6-advertise-received";
4735 stat_name =
"pkt6-request-received";
4738 stat_name =
"pkt6-confirm-received";
4741 stat_name =
"pkt6-renew-received";
4744 stat_name =
"pkt6-rebind-received";
4748 stat_name =
"pkt6-reply-received";
4751 stat_name =
"pkt6-release-received";
4754 stat_name =
"pkt6-decline-received";
4757 stat_name =
"pkt6-reconfigure-received";
4760 stat_name =
"pkt6-infrequest-received";
4763 stat_name =
"pkt6-dhcpv4-query-received";
4767 stat_name =
"pkt6-dhcpv4-response-received";
4782 switch (response->getType()) {
4784 stat_name =
"pkt6-advertise-sent";
4787 stat_name =
"pkt6-reply-sent";
4790 stat_name =
"pkt6-dhcpv4-response-sent";
4801 return (
Hooks.hook_index_buffer6_send_);
4805Dhcpv6Srv::requestedInORO(
const Pkt6Ptr& query,
const uint16_t code)
const {
4807 boost::dynamic_pointer_cast<OptionUint16Array>(query->getOption(
D6O_ORO));
4810 const std::vector<uint16_t>& codes = oro->getValues();
4811 return (std::find(codes.begin(), codes.end(), code) != codes.end());
4817tuple<bool, uint32_t>
4818Dhcpv6Srv::parkingLimitExceeded(
string const& hook_label) {
4820 uint32_t parked_packet_limit(0);
4824 parked_packet_limit = ppl->intValue();
4827 if (parked_packet_limit) {
4831 if (parking_lot && parked_packet_limit <= parking_lot->size()) {
4832 return make_tuple(
true, parked_packet_limit);
4835 return make_tuple(
false, parked_packet_limit);
4848 uint32_t t2_time = 0;
4851 if (!subnet->getT2().unspecified()) {
4852 t2_time = subnet->getT2();
4853 }
else if (subnet->getCalculateTeeTimes()) {
4855 t2_time =
static_cast<uint32_t
>(round(subnet->getT2Percent() * preferred_lft));
4859 resp->setT2(t2_time);
4862 uint32_t t1_time = 0;
4865 if (!subnet->getT1().unspecified()) {
4866 t1_time = subnet->getT1();
4867 }
else if (subnet->getCalculateTeeTimes()) {
4869 t1_time =
static_cast<uint32_t
>(round(subnet->getT1Percent() * preferred_lft));
4873 if (t1_time < t2_time) {
4874 resp->setT1(t1_time);
4886 if ((!ctx.
subnet_) || (!orig_subnet) || (orig_subnet->getID() == ctx.
subnet_->getID())) {
4894 orig_subnet->getSharedNetwork(network);
4896 .arg(question->getLabel())
4897 .arg(orig_subnet->toText())
4899 .arg(network ? network->getName() :
"<no network?>");
4905 std::string prev_hostname = ctx.
hostname_;
4926 l->reuseable_valid_lft_ = 0;
4933 static std::list<std::list<std::string>>
const list({
4934 {
"config-control",
"config-databases",
"[]"},
4935 {
"hooks-libraries",
"[]",
"parameters",
"*"},
4937 {
"hosts-databases",
"[]"},
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.
The IOService class is a wrapper for the ASIO io_service 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...
@ 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.
Holds DUID (DHCPv6 Unique Identifier)
static constexpr size_t MIN_DUID_LEN
minimum duid size
static constexpr size_t MAX_DUID_LEN
maximum duid size
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
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.
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 sendResponseNoThrow(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr query, Pkt6Ptr &rsp, Subnet6Ptr &subnet)
Process an unparked DHCPv6 packet and sends the response.
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 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.
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.
void requiredClassify(const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx)
Assigns incoming packet to zero or more classes (required pass).
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 checkDynamicSubnetChange(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const Subnet6Ptr orig_subnet)
Iterates over new leases, update stale DNS entries.
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 setTeeTimes(uint32_t preferred_lft, const Subnet6Ptr &subnet, Option6IAPtr &resp)
Sets the T1 and T2 timers in the outbound IA.
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.
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 processPacketPktSend(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp, Subnet6Ptr &subnet)
Executes pkt6_send callout.
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.
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.
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.
volatile bool shutdown_
Indicates if shutdown is in progress.
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....
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.
isc::dhcp::Subnet6Ptr selectSubnet(const Pkt6Ptr &question, bool &drop)
Selects a subnet for a given client's packet.
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.
IdentifierType
Type of the host identifier.
@ IDENT_FLEX
Flexible host identifier.
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
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 void destroy()
Destroy lease manager.
virtual bool deleteLease(const Lease4Ptr &lease)=0
Deletes an IPv4 lease.
static std::string getDBVersion()
Class method to return extended version info This class method must be redeclared and redefined in de...
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::string getDBVersion()
Local version of getDBVersion() class method.
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.
isc::asiolink::IOAddress getAddress() const
Returns address contained within this option.
Class that represents IAPREFIX option in DHCPv6.
uint32_t getIAID() const
Returns IA identifier.
This class represents Status Code option (13) from RFC 8415.
OptionPtr option_
Option instance.
Forward declaration to OptionIntArray.
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.
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
static std::string getDBVersion()
Local version of getDBVersion() class method.
Represents a DHCPv6 packet.
virtual std::string getLabel() const
Returns text representation of the primary packet identifiers.
Pool information for IPv6 addresses and prefixes.
Option6PDExcludePtr getPrefixExcludeOption() const
Returns instance of the pool specific Prefix Exclude option.
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.
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.
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.
@ 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
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.
An abstract API for lease database.
#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_RELEASE_PD_DELETED
const isc::log::MessageID DHCP6_LEASE_ALLOC
const isc::log::MessageID DHCP6_FLEX_ID
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
const isc::log::MessageID DHCP6_HOOK_PACKET_SEND_SKIP
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional< double > &ddns_ttl_percent)
Calculates TTL for a DNS resource record based on lease life time.
const isc::log::MessageID DHCP6_SUBNET_SELECTION_FAILED
const isc::log::MessageID DHCP6_CLASS_UNDEFINED
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_PACKET_SEND_FAIL
const isc::log::MessageID DHCP6_PACKET_PROCESS_EXCEPTION
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
const isc::log::MessageID DHCP6_QUERY_LABEL
boost::shared_ptr< Option6PDExclude > Option6PDExcludePtr
Pointer to the Option6PDExclude object.
const isc::log::MessageID EVAL_RESULT
const isc::log::MessageID DHCP6_BUFFER_UNPACK
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_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
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.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 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
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_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.
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
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< 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 int DBG_DHCP6_BASIC
Debug level used to trace basic operations within the code.
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_CLASS_UNTESTABLE
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_WRONG_IAID
const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_DROP
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 provides the classes needed to embody, compose, and decompose DNS update requests that are ...
#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.
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.
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
Subnet6Ptr subnet_
Subnet selected for the client by the server.
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.
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 std::string lifetimeToText(uint32_t lifetime)
Print lifetime.
@ 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