8 #include <kea_version.h>
69 #include <boost/foreach.hpp>
70 #include <boost/tokenizer.hpp>
71 #include <boost/algorithm/string/erase.hpp>
72 #include <boost/algorithm/string/join.hpp>
73 #include <boost/algorithm/string/split.hpp>
94 namespace ph = std::placeholders;
100 int hook_index_buffer6_receive_;
101 int hook_index_pkt6_receive_;
102 int hook_index_subnet6_select_;
103 int hook_index_leases6_committed_;
104 int hook_index_lease6_release_;
105 int hook_index_pkt6_send_;
106 int hook_index_buffer6_send_;
107 int hook_index_lease6_decline_;
108 int hook_index_host6_identifier_;
112 hook_index_buffer6_receive_ = HooksManager::registerHook(
"buffer6_receive");
113 hook_index_pkt6_receive_ = HooksManager::registerHook(
"pkt6_receive");
114 hook_index_subnet6_select_ = HooksManager::registerHook(
"subnet6_select");
115 hook_index_leases6_committed_ = HooksManager::registerHook(
"leases6_committed");
116 hook_index_lease6_release_ = HooksManager::registerHook(
"lease6_release");
117 hook_index_pkt6_send_ = HooksManager::registerHook(
"pkt6_send");
118 hook_index_buffer6_send_ = HooksManager::registerHook(
"buffer6_send");
119 hook_index_lease6_decline_ = HooksManager::registerHook(
"lease6_decline");
120 hook_index_host6_identifier_ = HooksManager::registerHook(
"host6_identifier");
142 createStatusCode(
const Pkt6& pkt,
const uint16_t status_code,
143 const std::string& status_message) {
148 .arg(option_status->dataToText());
149 return (option_status);
167 createStatusCode(
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);
180 std::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",
207 const std::string Dhcpv6Srv::VENDOR_CLASS_PREFIX(
"VENDOR_CLASS_");
209 Dhcpv6Srv::Dhcpv6Srv(uint16_t server_port, uint16_t client_port)
210 : io_service_(new
IOService()), server_port_(server_port),
211 client_port_(client_port), serverid_(), shutdown_(true),
212 alloc_engine_(), name_change_reqs_(),
242 }
catch (
const std::exception &e) {
257 for (
auto it = dhcp6_statistics.begin(); it != dhcp6_statistics.end(); ++it) {
259 stats_mgr.
setValue((*it), static_cast<int64_t>(0));
269 }
catch (
const std::exception& ex) {
276 }
catch (
const std::exception& ex) {
286 HooksManager::prepareUnloadLibraries();
287 if (!HooksManager::unloadLibraries()) {
288 auto names = HooksManager::getLibraryNames();
290 if (!names.empty()) {
292 for (
size_t i = 1; i < names.size(); ++i) {
293 msg += std::string(
", ") + names[i];
323 if (
getServerID()->getData() != server_id->getData()){
326 .arg(pkt->getLabel())
338 switch (pkt->getType()) {
343 if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
345 .arg(pkt->getLabel())
346 .arg(pkt->getName());
362 ctx.
duid_ = pkt->getClientId(),
383 cfg->getIdentifierTypes()) {
400 if (HooksManager::calloutsPresent(Hooks.hook_index_host6_identifier_)) {
404 std::vector<uint8_t> id;
413 callout_handle->setArgument(
"query6", pkt);
414 callout_handle->setArgument(
"id_type", type);
415 callout_handle->setArgument(
"id_value",
id);
418 HooksManager::callCallouts(Hooks.hook_index_host6_identifier_,
421 callout_handle->getArgument(
"id_type", type);
422 callout_handle->getArgument(
"id_value",
id);
424 if ((callout_handle->getStatus() == CalloutHandle::NEXT_STEP_CONTINUE) &&
443 ctx.
subnet_->getSharedNetwork(sn);
454 if ((global_host && !global_host->getClientClasses6().empty()) ||
455 (!sn && current_host && !current_host->getClientClasses6().empty())) {
473 for (
auto def : *defs_ptr) {
477 if (def->getMatchExpr()) {
478 ctx.
query_->classes_.erase(def->getName());
486 if (!ctx.
hosts_.empty()) {
487 pkt->addClass(
"KNOWN");
489 .arg(pkt->getLabel())
492 pkt->addClass(
"UNKNOWN");
494 .arg(pkt->getLabel())
502 if (pkt->inClass(
"DROP")) {
506 StatsMgr::instance().addValue(
"pkt6-receive-drop",
507 static_cast<int64_t>(1));
519 while (__AFL_LOOP(fuzzer.maxLoopCount())) {
529 }
catch (
const std::exception& e) {
546 MultiThreadingMgr::instance().apply(
false, 0, 0);
559 uint32_t timeout = 1;
570 .arg(query->getRemoteAddr().toText())
571 .arg(query->getRemotePort())
572 .arg(query->getLocalAddr().toText())
573 .arg(query->getLocalPort())
574 .arg(query->getIface());
580 StatsMgr::instance().addValue(
"pkt6-received", static_cast<int64_t>(1));
596 }
catch (
const std::exception& e) {
610 .arg(query->getLabel());
613 if (MultiThreadingMgr::instance().getMode()) {
614 typedef function<void()> CallBack;
615 boost::shared_ptr<CallBack> call_back =
618 if (!MultiThreadingMgr::instance().getThreadPool().add(call_back)) {
631 }
catch (
const std::exception& e) {
653 bool skip_unpack =
false;
657 if (HooksManager::calloutsPresent(Hooks.hook_index_buffer6_receive_)) {
670 callout_handle->setArgument(
"query6", query);
673 HooksManager::callCallouts(Hooks.hook_index_buffer6_receive_, *callout_handle);
679 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
681 .arg(query->getRemoteAddr().toText())
682 .arg(query->getLocalAddr().toText())
683 .arg(query->getIface());
690 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
692 .arg(query->getRemoteAddr().toText())
693 .arg(query->getLocalAddr().toText())
694 .arg(query->getIface());
697 StatsMgr::instance().addValue(
"pkt6-receive-drop",
698 static_cast<int64_t>(1));
702 callout_handle->getArgument(
"query6", query);
710 .arg(query->getRemoteAddr().toText())
711 .arg(query->getLocalAddr().toText())
712 .arg(query->getIface());
720 }
catch (
const std::exception &e) {
724 .arg(query->getRemoteAddr().toText())
725 .arg(query->getLocalAddr().toText())
726 .arg(query->getIface())
730 StatsMgr::instance().addValue(
"pkt6-parse-failed",
731 static_cast<int64_t>(1));
732 StatsMgr::instance().addValue(
"pkt6-receive-drop",
733 static_cast<int64_t>(1));
739 processStatsReceived(query);
746 StatsMgr::instance().addValue(
"pkt6-receive-drop", static_cast<int64_t>(1));
756 StatsMgr::instance().addValue(
"pkt6-receive-drop", static_cast<int64_t>(1));
764 .arg(query->getLabel())
765 .arg(query->getName())
766 .arg(static_cast<int>(query->getType()))
767 .arg(query->getRemoteAddr())
768 .arg(query->getLocalAddr())
769 .arg(query->getIface());
771 .arg(query->getLabel())
772 .arg(query->toText());
777 if (HooksManager::calloutsPresent(Hooks.hook_index_pkt6_receive_)) {
790 callout_handle->setArgument(
"query6", query);
793 HooksManager::callCallouts(Hooks.hook_index_pkt6_receive_, *callout_handle);
798 if ((callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) ||
799 (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP)) {
801 .arg(query->getLabel());
803 StatsMgr::instance().addValue(
"pkt6-receive-drop",
804 static_cast<int64_t>(1));
808 callout_handle->getArgument(
"query6", query);
817 if (query->inClass(
"DROP")) {
819 .arg(query->toText());
820 StatsMgr::instance().addValue(
"pkt6-receive-drop",
821 static_cast<int64_t>(1));
845 }
catch (
const std::exception& e) {
859 if (MultiThreadingMgr::instance().getMode() &&
869 if (!client_handler.
tryLock(query, cont)) {
887 switch (query->getType()) {
924 }
catch (
const std::exception& e) {
934 .arg(query->getName())
935 .arg(query->getRemoteAddr().toText())
939 StatsMgr::instance().addValue(
"pkt6-receive-drop", static_cast<int64_t>(1));
958 rsp->setRemoteAddr(query->getRemoteAddr());
959 rsp->setLocalAddr(query->getLocalAddr());
964 }
else if (rsp->relay_info_.empty()) {
966 rsp->setRemotePort(DHCP6_CLIENT_PORT);
970 rsp->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT);
976 rsp->setLocalPort(DHCP6_SERVER_PORT);
978 rsp->setIndex(query->getIndex());
979 rsp->setIface(query->getIface());
984 HooksManager::calloutsPresent(Hooks.hook_index_leases6_committed_)) {
995 callout_handle->setArgument(
"query6", query);
1001 if (new_lease->reuseable_valid_lft_ == 0) {
1002 new_leases->push_back(new_lease);
1006 callout_handle->setArgument(
"leases6", new_leases);
1011 for (
auto const& iac : ctx.
ias_) {
1012 if (!iac.old_leases_.empty()) {
1013 for (
auto old_lease : iac.old_leases_) {
1015 deleted_leases->push_back(old_lease);
1018 bool in_new =
false;
1020 if ((new_lease->addr_ == old_lease->addr_) &&
1021 (new_lease->prefixlen_ == old_lease->prefixlen_)) {
1027 deleted_leases->push_back(old_lease);
1032 callout_handle->setArgument(
"deleted_leases6", deleted_leases);
1038 HooksManager::park(
"leases6_committed", query,
1039 [
this, callout_handle, query, rsp]()
mutable {
1040 if (MultiThreadingMgr::instance().getMode()) {
1041 typedef function<void()> CallBack;
1042 boost::shared_ptr<CallBack> call_back =
1044 this, callout_handle, query, rsp));
1045 MultiThreadingMgr::instance().getThreadPool().add(call_back);
1054 HooksManager::callCallouts(Hooks.hook_index_leases6_committed_,
1058 HooksManager::drop(
"leases4_committed", query);
1062 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_PARK) {
1064 .arg(query->getLabel());
1072 HooksManager::drop(
"leases6_committed", query);
1073 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
1075 .arg(query->getLabel());
1093 }
catch (
const std::exception& e) {
1109 bool skip_pack =
false;
1115 if (HooksManager::calloutsPresent(Hooks.hook_index_pkt6_send_)) {
1127 callout_handle->setArgument(
"query6", query);
1130 callout_handle->setArgument(
"response6", rsp);
1133 HooksManager::callCallouts(Hooks.hook_index_pkt6_send_, *callout_handle);
1140 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
1142 .arg(rsp->getLabel());
1147 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
1149 .arg(rsp->getLabel());
1158 }
catch (
const std::exception& e) {
1178 if (HooksManager::calloutsPresent(Hooks.hook_index_buffer6_send_)) {
1190 callout_handle->setArgument(
"response6", rsp);
1193 HooksManager::callCallouts(Hooks.hook_index_buffer6_send_,
1199 if ((callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) ||
1200 (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP)) {
1203 .arg(rsp->getLabel());
1207 callout_handle->getArgument(
"response6", rsp);
1211 .arg(rsp->getLabel())
1212 .arg(rsp->getName())
1213 .arg(static_cast<int>(rsp->getType()))
1214 .arg(rsp->getLocalAddr().isV6Zero() ?
"*" : rsp->getLocalAddr().toText())
1215 .arg(rsp->getLocalPort())
1216 .arg(rsp->getRemoteAddr())
1217 .arg(rsp->getRemotePort())
1218 .arg(rsp->getIface());
1221 .arg(static_cast<int>(rsp->getType())).arg(rsp->toText());
1228 }
catch (
const std::exception& e) {
1244 tmp << hex << setw(2) << setfill('0') << static_cast<uint16_t>(*it);
1258 answer->addOption(clientid);
1263 if (!question->relay_info_.empty()) {
1264 answer->copyRelayInfo(question);
1282 co_list.push_back(ctx.
currentHost()->getCfgOption6());
1290 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
1292 resource.getAddress(),
1294 if (pool && !pool->getCfgOption()->empty()) {
1295 co_list.push_back(pool->getCfgOption());
1302 if (!ctx.
subnet_->getCfgOption()->empty()) {
1303 co_list.push_back(ctx.
subnet_->getCfgOption());
1308 ctx.
subnet_->getSharedNetwork(network);
1309 if (network && !network->getCfgOption()->empty()) {
1310 co_list.push_back(network->getCfgOption());
1317 cclass != classes.
cend(); ++cclass) {
1320 getClientClassDictionary()->findClass(*cclass);
1325 .arg(question->getLabel())
1332 if (ccdef->getCfgOption()->empty()) {
1337 co_list.push_back(ccdef->getCfgOption());
1351 if (co_list.empty()) {
1355 std::vector<uint16_t> requested_opts;
1359 boost::shared_ptr<OptionIntArray<uint16_t> > option_oro =
1361 (question->getOption(
D6O_ORO));
1365 requested_opts = option_oro->getValues();
1368 for (CfgOptionList::const_iterator copts = co_list.begin();
1369 copts != co_list.end(); ++copts) {
1377 for (OptionContainerPersistIndex::const_iterator desc = range.first;
1378 desc != range.second; ++desc) {
1380 if (desc->option_) {
1381 requested_opts.push_back(desc->option_->getType());
1386 for (uint16_t opt : requested_opts) {
1388 if (!answer->getOption(opt)) {
1390 for (CfgOptionList::const_iterator copts = co_list.begin();
1391 copts != co_list.end(); ++copts) {
1395 answer->addOption(desc.
option_);
1416 if (!ctx.
subnet_ || co_list.empty()) {
1420 uint32_t vendor_id = 0;
1427 vendor_id = vendor_rsp->getVendorId();
1433 if (vendor_id == 0) {
1434 vendor_req = boost::dynamic_pointer_cast<
OptionVendor>(
1443 if (vendor_id == 0) {
1445 boost::dynamic_pointer_cast<OptionVendorClass>(
1448 vendor_id = vendor_class->getVendorId();
1454 if (vendor_id == 0) {
1458 std::vector<uint16_t> requested_opts;
1463 boost::shared_ptr<OptionUint16Array> oro;
1469 requested_opts = oro->getValues();
1475 for (CfgOptionList::const_iterator copts = co_list.begin();
1476 copts != co_list.end(); ++copts) {
1484 for (OptionContainerPersistIndex::const_iterator desc = range.first;
1485 desc != range.second; ++desc) {
1487 if (desc->option_) {
1488 requested_opts.push_back(desc->option_->getType());
1494 if (requested_opts.empty()) {
1507 for (uint16_t opt : requested_opts) {
1508 if (!vendor_rsp->getOption(opt)) {
1509 for (CfgOptionList::const_iterator copts = co_list.begin();
1510 copts != co_list.end(); ++copts) {
1513 vendor_rsp->addOption(desc.
option_);
1524 answer->addOption(vendor_rsp);
1531 switch (pkt->getType()) {
1553 .arg(static_cast<int>(pkt->getType()))
1554 .arg(pkt->getIface());
1559 .arg(pkt->getName())
1560 .arg(pkt->getRemoteAddr().toText())
1566 StatsMgr::instance().addValue(
"pkt6-receive-drop", static_cast<int64_t>(1));
1576 if (client_ids.size() != 1) {
1578 << pkt->getName() <<
", but " << client_ids.size()
1585 if (client_ids.size() > 1) {
1587 <<
") client-id options received in " << pkt->getName());
1589 if (!client_ids.empty()) {
1602 if (!server_ids.empty()) {
1604 << server_ids.size() <<
" received in " << pkt->getName());
1609 if (server_ids.size() != 1) {
1611 << server_ids.size() <<
"), exactly 1 expected in message "
1618 if (server_ids.size() > 1) {
1620 <<
") server-id options received in " << pkt->getName());
1622 if (!server_ids.empty()) {
1635 uint16_t len = opt->len() - opt->getHeaderLen();
1638 << len <<
" byte(s). It must be at least 3 and no more than "
1648 getCfgSubnets6()->selectSubnet(selector);
1651 if (HooksManager::calloutsPresent(Hooks.hook_index_subnet6_select_)) {
1664 callout_handle->setArgument(
"query6", question);
1665 callout_handle->setArgument(
"subnet6", subnet);
1670 callout_handle->setArgument(
"subnet6collection",
1672 getCfgSubnets6()->getAll());
1675 HooksManager::callCallouts(Hooks.hook_index_subnet6_select_, *callout_handle);
1681 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
1683 .arg(question->getLabel());
1689 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
1691 .arg(question->getLabel());
1697 callout_handle->getArgument(
"subnet6", subnet);
1703 .arg(question->getLabel())
1704 .arg(subnet->getID());
1708 .arg(question->getLabel())
1709 .arg(subnet->toText());
1713 .arg(question->getLabel());
1738 for (OptionCollection::iterator opt = question->options_.begin();
1739 opt != question->options_.end(); ++opt) {
1740 switch (opt->second->getType()) {
1743 boost::dynamic_pointer_cast<
1746 answer->addOption(answer_opt);
1752 boost::dynamic_pointer_cast<
1755 answer->addOption(answer_opt);
1780 if (ddns_params->getEnableUpdates() &&
1790 .arg(question->getLabel());
1803 .arg(question->getLabel())
1804 .arg(fqdn->toText());
1819 *ddns_params,
true),
1836 .arg(question->getLabel())
1837 .arg(fqdn_resp->
toText());
1838 answer->addOption(fqdn_resp);
1854 <<
" encapsulating server's message must not be"
1855 <<
" NULL when creating DNS NameChangeRequest");
1868 bool do_fwd =
false;
1869 bool do_rev =
false;
1879 "client identifier is required when creating a new"
1880 " DNS NameChangeRequest");
1887 opt_fqdn->packDomainName(name_buf);
1888 const uint8_t* name_data =
static_cast<const uint8_t*
>(name_buf.
getData());
1891 std::vector<uint8_t> buf_vec(name_data, name_data + name_buf.
getLength());
1897 for (
auto answer_ia : answer->getOptions(
D6O_IA_NA)) {
1912 bool extended_only =
false;
1916 if ((*l)->addr_ == iaaddr->getAddress()) {
1921 ((*l)->hostname_ == opt_fqdn->getDomainName() &&
1922 (*l)->fqdn_fwd_ == do_fwd && (*l)->fqdn_rev_ == do_rev)) {
1923 extended_only =
true;
1935 if (!(do_fwd || do_rev) || (extended_only)) {
1950 opt_fqdn->getDomainName(),
1951 iaaddr->getAddress().toText(),
1971 getMACSources().get();
1973 for (CfgMACSources::const_iterator it = mac_sources.begin();
1974 it != mac_sources.end(); ++it) {
1975 hwaddr = pkt->getMAC(*it);
1986 boost::shared_ptr<Option6IA> ia) {
1995 hint = hint_opt->getAddress();
1999 .arg(query->getLabel())
2001 .arg(hint_opt ? hint.toText() :
"(no hint)");
2020 "Server could not select subnet for"
2026 bool do_fwd =
false;
2027 bool do_rev =
false;
2057 if (!leases.empty()) {
2058 lease = *leases.begin();
2071 .arg(query->getLabel())
2072 .arg(lease->addr_.toText())
2073 .arg(ia->getIAID());
2074 }
else if (lease->reuseable_valid_lft_ == 0) {
2076 .arg(query->getLabel())
2077 .arg(lease->addr_.toText())
2081 lease->valid_lft_ = lease->reuseable_valid_lft_;
2082 lease->preferred_lft_ = lease->reuseable_preferred_lft_;
2084 .arg(query->getLabel())
2085 .arg(lease->addr_.toText())
2090 .arg(query->getLabel())
2092 .arg(lease->toText());
2095 setTeeTimes(lease->preferred_lft_, subnet, ia_rsp);
2098 lease->preferred_lft_,
2099 lease->valid_lft_));
2100 ia_rsp->addOption(addr);
2113 .arg(query->getLabel())
2114 .arg(ia->getIAID());
2116 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2118 "Sorry, no address could be"
2127 boost::shared_ptr<Option6IA> ia) {
2137 hint = hint_opt->getAddress();
2141 .arg(query->getLabel())
2143 .arg(hint_opt ? hint.toText() :
"(no hint)");
2160 "Sorry, no subnet available."));
2180 if (!leases.empty()) {
2184 uint32_t min_preferred_lft = (*leases.begin())->preferred_lft_;
2186 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2187 for (Lease6Collection::iterator l = leases.begin();
2188 l != leases.end(); ++l) {
2194 .arg(query->getLabel())
2195 .arg((*l)->addr_.toText())
2196 .arg(static_cast<int>((*l)->prefixlen_))
2197 .arg(ia->getIAID());
2198 }
else if ((*l)->reuseable_valid_lft_ == 0) {
2200 .arg(query->getLabel())
2201 .arg((*l)->addr_.toText())
2202 .arg(static_cast<int>((*l)->prefixlen_))
2206 (*l)->valid_lft_ = (*l)->reuseable_valid_lft_;
2207 (*l)->preferred_lft_ = (*l)->reuseable_preferred_lft_;
2209 .arg(query->getLabel())
2210 .arg((*l)->addr_.toText())
2211 .arg(static_cast<int>((*l)->prefixlen_))
2217 if (((*l)->preferred_lft_ > 0) && (min_preferred_lft > (*l)->preferred_lft_)) {
2218 min_preferred_lft = (*l)->preferred_lft_;
2221 boost::shared_ptr<Option6IAPrefix>
2223 (*l)->prefixlen_, (*l)->preferred_lft_,
2225 ia_rsp->addOption(addr);
2227 if (pd_exclude_requested) {
2230 Pool6Ptr pool = boost::dynamic_pointer_cast<
2234 if (pd_exclude_option) {
2235 addr->addOption(pd_exclude_option);
2255 .arg(query->getLabel())
2256 .arg(ia->getIAID());
2258 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2260 "Sorry, no prefixes could"
2269 boost::shared_ptr<Option6IA> ia) {
2272 .arg(query->getLabel())
2273 .arg(ia->getIAID());
2292 "Sorry, no known leases for this duid/iaid."));
2297 bool do_fwd =
false;
2298 bool do_rev =
false;
2318 for (OptionCollection::const_iterator it = addrs.begin();
2319 it != addrs.end(); ++it) {
2350 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
2353 for (Lease6Collection::iterator l = leases.begin(); l != leases.end(); ++l) {
2354 if ((*l)->reuseable_valid_lft_ == 0) {
2356 .arg(query->getLabel())
2357 .arg((*l)->addr_.toText())
2358 .arg(ia->getIAID());
2360 (*l)->valid_lft_ = (*l)->reuseable_valid_lft_;
2361 (*l)->preferred_lft_ = (*l)->reuseable_preferred_lft_;
2363 .arg(query->getLabel())
2364 .arg((*l)->addr_.toText())
2370 (*l)->addr_, (*l)->preferred_lft_, (*l)->valid_lft_));
2371 ia_rsp->addOption(iaaddr);
2374 if (((*l)->preferred_lft_ > 0) && (min_preferred_lft > (*l)->preferred_lft_)) {
2375 min_preferred_lft = (*l)->preferred_lft_;
2380 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
2391 if (
equalValues(query->getClientId(), (*l)->duid_)) {
2393 (*l)->addr_, 0, 0));
2394 ia_rsp->addOption(iaaddr);
2399 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
2403 if (((*l)->hostname_ != ctx.
hostname_) || ((*l)->fqdn_fwd_ != do_fwd) ||
2404 ((*l)->fqdn_rev_ != do_rev)) {
2407 .arg(query->getLabel())
2408 .arg((*l)->toText())
2410 .arg(do_rev ?
"true" :
"false")
2411 .arg(do_fwd ?
"true" :
"false");
2419 for (AllocEngine::HintContainer::const_iterator hint = hints.begin();
2420 hint != hints.end(); ++hint) {
2422 hint->getAddress(), 0, 0));
2423 ia_rsp->addOption(iaaddr);
2426 if (!leases.empty()) {
2432 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2434 "Sorry, no addresses could be"
2435 " assigned at this time."));
2444 boost::shared_ptr<Option6IA> ia) {
2447 .arg(query->getLabel())
2448 .arg(ia->getIAID());
2465 "Sorry, no known PD leases"
2466 " for this duid/iaid."));
2486 " client sending Rebind to extend lifetime of the"
2487 " prefix (DUID=" << duid->toText() <<
", IAID="
2488 << ia->getIAID() <<
")");
2500 for (OptionCollection::const_iterator it = addrs.begin();
2501 it != addrs.end(); ++it) {
2535 const bool pd_exclude_requested = requestedInORO(query,
D6O_PD_EXCLUDE);
2539 uint32_t min_preferred_lft = std::numeric_limits<uint32_t>::max();
2541 for (Lease6Collection::iterator l = leases.begin(); l != leases.end(); ++l) {
2542 if ((*l)->reuseable_valid_lft_ == 0) {
2544 .arg(query->getLabel())
2545 .arg((*l)->addr_.toText())
2546 .arg(static_cast<int>((*l)->prefixlen_))
2547 .arg(ia->getIAID());
2549 (*l)->valid_lft_ = (*l)->reuseable_valid_lft_;
2550 (*l)->preferred_lft_ = (*l)->reuseable_preferred_lft_;
2552 .arg(query->getLabel())
2553 .arg((*l)->addr_.toText())
2554 .arg(static_cast<int>((*l)->prefixlen_))
2560 (*l)->addr_, (*l)->prefixlen_,
2561 (*l)->preferred_lft_, (*l)->valid_lft_));
2562 ia_rsp->addOption(prf);
2564 if (pd_exclude_requested) {
2567 Pool6Ptr pool = boost::dynamic_pointer_cast<
2572 if (pd_exclude_option) {
2573 prf->addOption(pd_exclude_option);
2579 if (((*l)->preferred_lft_ > 0) && ((*l)->preferred_lft_ < min_preferred_lft)) {
2580 min_preferred_lft = (*l)->preferred_lft_;
2585 hints.erase(std::remove(hints.begin(), hints.end(), hint_type),
2596 if (
equalValues(query->getClientId(), (*l)->duid_)) {
2598 (*l)->prefixlen_, 0, 0));
2599 ia_rsp->addOption(prefix);
2604 hints.erase(std::remove(hints.begin(), hints.end(), hint_type), hints.end());
2609 for (AllocEngine::HintContainer::const_iterator prefix = hints.begin();
2610 prefix != hints.end(); ++prefix) {
2615 if (!prefix->getAddress().isV6Zero()) {
2617 prefix->getAddress(),
2618 prefix->getPrefixLength(),
2620 ia_rsp->addOption(prefix_opt);
2624 if (!leases.empty()) {
2631 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
2633 "Sorry, no prefixes could be"
2634 " assigned at this time."));
2655 for (OptionCollection::iterator opt = query->options_.begin();
2656 opt != query->options_.end(); ++opt) {
2657 switch (opt->second->getType()) {
2660 boost::dynamic_pointer_cast<
2663 reply->addOption(answer_opt);
2670 boost::dynamic_pointer_cast<
2673 reply->addOption(answer_opt);
2708 for (OptionCollection::iterator opt = release->options_.begin();
2709 opt != release->options_.end(); ++opt) {
2711 switch (opt->second->getType()) {
2714 boost::dynamic_pointer_cast<Option6IA>(opt->second),
2717 reply->addOption(answer_opt);
2723 boost::dynamic_pointer_cast<Option6IA>(opt->second),
2726 reply->addOption(answer_opt);
2743 reply->addOption(createStatusCode(*release, general_status,
2744 "Summary status for all processed IA_NAs"));
2749 int& general_status, boost::shared_ptr<Option6IA> ia,
2753 .arg(query->getLabel())
2754 .arg(ia->getIAID());
2770 if (!release_addr) {
2772 "You did not include an address in your RELEASE"));
2778 release_addr->getAddress());
2785 "Sorry, no known leases for this duid/iaid, can't release."));
2791 if (!lease->duid_) {
2797 .arg(query->getLabel())
2798 .arg(release_addr->getAddress().toText());
2802 "Database consistency check failed when trying to RELEASE"));
2806 if (*duid != *(lease->duid_)) {
2810 .arg(query->getLabel())
2811 .arg(release_addr->getAddress().toText())
2812 .arg(lease->duid_->toText());
2816 "This address does not belong to you, you can't release it"));
2820 if (ia->getIAID() != lease->iaid_) {
2823 .arg(query->getLabel())
2824 .arg(release_addr->getAddress().toText())
2826 .arg(ia->getIAID());
2828 "This is your address, but you used wrong IAID"));
2838 if (HooksManager::calloutsPresent(Hooks.hook_index_lease6_release_)) {
2851 callout_handle->deleteAllArguments();
2854 callout_handle->setArgument(
"query6", query);
2857 callout_handle->setArgument(
"lease6", lease);
2860 HooksManager::callCallouts(Hooks.hook_index_lease6_release_, *callout_handle);
2865 if ((callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) ||
2866 (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP)) {
2869 .arg(query->getLabel());
2874 bool success =
false;
2885 "Server failed to release a lease"));
2888 .arg(query->getLabel())
2889 .arg(lease->addr_.toText())
2898 .arg(query->getLabel())
2899 .arg(lease->addr_.toText())
2902 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
2903 "Lease released. Thank you, please come again."));
2906 StatsMgr::instance().addValue(
2907 StatsMgr::generateName(
"subnet", lease->subnet_id_,
"assigned-nas"),
2908 static_cast<int64_t>(-1));
2921 int& general_status, boost::shared_ptr<Option6IA> ia,
2936 boost::shared_ptr<Option6IAPrefix> release_prefix =
2938 if (!release_prefix) {
2940 "You did not include a prefix in your RELEASE"));
2946 release_prefix->getAddress());
2953 "Sorry, no known leases for this duid/iaid, can't release."));
2959 if (!lease->duid_) {
2964 .arg(query->getLabel())
2965 .arg(release_prefix->getAddress().toText())
2966 .arg(static_cast<int>(release_prefix->getLength()));
2970 "Database consistency check failed when trying to RELEASE"));
2974 if (*duid != *(lease->duid_)) {
2977 .arg(query->getLabel())
2978 .arg(release_prefix->getAddress().toText())
2979 .arg(static_cast<int>(release_prefix->getLength()))
2980 .arg(lease->duid_->toText());
2984 "This address does not belong to you, you can't release it"));
2988 if (ia->getIAID() != lease->iaid_) {
2991 .arg(query->getLabel())
2992 .arg(release_prefix->getAddress().toText())
2993 .arg(static_cast<int>(release_prefix->getLength()))
2995 .arg(ia->getIAID());
2997 "This is your address, but you used wrong IAID"));
3007 if (HooksManager::calloutsPresent(Hooks.hook_index_lease6_release_)) {
3020 callout_handle->setArgument(
"query6", query);
3023 callout_handle->setArgument(
"lease6", lease);
3026 HooksManager::callCallouts(Hooks.hook_index_lease6_release_, *callout_handle);
3028 skip = callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP;
3032 bool success =
false;
3041 .arg(query->getLabel());
3049 "Server failed to release a lease"));
3052 .arg(query->getLabel())
3053 .arg(lease->addr_.toText())
3054 .arg(static_cast<int>(lease->prefixlen_))
3062 .arg(query->getLabel())
3063 .arg(lease->addr_.toText())
3064 .arg(static_cast<int>(lease->prefixlen_))
3067 ia_rsp->addOption(createStatusCode(*query, *ia_rsp,
STATUS_Success,
3068 "Lease released. Thank you, please come again."));
3071 StatsMgr::instance().addValue(
3072 StatsMgr::generateName(
"subnet", lease->subnet_id_,
"assigned-pds"),
3073 static_cast<int64_t>(-1));
3088 if (opt_rapid_commit) {
3091 .arg(solicit->getLabel());
3096 response->addOption(opt_rapid_commit);
3115 if (MultiThreadingMgr::instance().getMode()) {
3134 updateReservedFqdn(ctx, response);
3153 if (MultiThreadingMgr::instance().getMode()) {
3172 updateReservedFqdn(ctx, reply);
3173 generateFqdn(reply, ctx);
3187 if (MultiThreadingMgr::instance().getMode()) {
3206 updateReservedFqdn(ctx, reply);
3207 generateFqdn(reply, ctx);
3221 if (MultiThreadingMgr::instance().getMode()) {
3240 updateReservedFqdn(ctx, reply);
3241 generateFqdn(reply, ctx);
3273 bool verified =
false;
3282 for (OptionCollection::const_iterator ia = ias.begin();
3283 ia != ias.end(); ++ia) {
3285 for (OptionCollection::const_iterator opt = opts.begin();
3286 opt != opts.end(); ++opt) {
3298 if (subnet && !subnet->inRange(iaaddr->getAddress())) {
3299 std::ostringstream status_msg;
3300 status_msg <<
"Address " << iaaddr->
getAddress()
3301 <<
" is not on link.";
3302 reply->addOption(createStatusCode(*confirm,
3310 " to the Option6IAAddrPtr. This is programming"
3311 " error and should be reported");
3328 "All addresses are on-link"));
3331 "No subnet selected"));
3407 for (OptionCollection::iterator opt = decline->options_.begin();
3408 opt != decline->options_.end(); ++opt) {
3409 switch (opt->second->getType()) {
3412 boost::dynamic_pointer_cast<Option6IA>(opt->second),
3417 reply->addOption(answer_opt);
3438 int& general_status, boost::shared_ptr<Option6IA> ia,
3442 .arg(decline->getLabel())
3443 .arg(ia->getIAID());
3458 int total_addrs = 0;
3459 for (OptionCollection::const_iterator opt = opts.begin(); opt != opts.end();
3469 if (!decline_addr) {
3476 decline_addr->getAddress());
3481 .arg(decline->getLabel()).arg(decline_addr->getAddress().toText());
3489 "Server does not know about such an address."));
3497 if (!lease->duid_) {
3503 .arg(decline->getLabel())
3504 .arg(decline_addr->getAddress().toText());
3507 "Database consistency check failed when attempting Decline."));
3513 if (*duid != *(lease->duid_)) {
3517 .arg(decline->getLabel())
3518 .arg(decline_addr->getAddress().toText())
3519 .arg(lease->duid_->toText());
3522 "This address does not belong to you, you can't decline it"));
3528 if (ia->getIAID() != lease->iaid_) {
3531 .arg(decline->getLabel())
3532 .arg(lease->addr_.toText())
3536 "This is your address, but you used wrong IAID"));
3548 new_leases.push_back(lease);
3552 if (total_addrs == 0) {
3554 "No addresses sent in IA_NA"));
3567 container->addOption(status);
3572 boost::shared_ptr<Option6IA> ia_rsp) {
3583 if (HooksManager::calloutsPresent(Hooks.hook_index_lease6_decline_)) {
3596 callout_handle->setArgument(
"query6", decline);
3599 callout_handle->setArgument(
"lease6", lease);
3602 HooksManager::callCallouts(Hooks.hook_index_lease6_decline_,
3608 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_SKIP) {
3610 .arg(decline->getLabel())
3611 .arg(decline->getIface())
3612 .arg(lease->addr_.toText());
3618 if (callout_handle->getStatus() == CalloutHandle::NEXT_STEP_DROP) {
3620 .arg(decline->getLabel())
3621 .arg(decline->getIface())
3622 .arg(lease->addr_.toText());
3627 Lease6Ptr old_values = boost::make_shared<Lease6>(*lease);
3641 .arg(decline->getLabel())
3642 .arg(lease->addr_.toText())
3653 StatsMgr::instance().addValue(
3654 StatsMgr::generateName(
"subnet", lease->subnet_id_,
"declined-addresses"),
3655 static_cast<int64_t>(1));
3658 StatsMgr::instance().addValue(
"declined-addresses", static_cast<int64_t>(1));
3661 .arg(lease->addr_.toText()).arg(lease->valid_lft_);
3663 ia_rsp->addOption(createStatusCode(*decline, *ia_rsp,
STATUS_Success,
3664 "Lease declined. Hopefully the next one will be better."));
3727 if (!vclass || vclass->getTuplesNum() == 0) {
3747 pkt->addClass(
"ALL");
3748 string classes =
"ALL ";
3762 for (ClientClassDefList::const_iterator it = defs_ptr->cbegin();
3763 it != defs_ptr->cend(); ++it) {
3771 if ((*it)->getRequired()) {
3775 if ((*it)->getDependOnKnown() != depend_on_known) {
3784 .arg((*it)->getName())
3787 pkt->addClass((*it)->getName());
3790 .arg((*it)->getName())
3795 .arg((*it)->getName())
3799 .arg((*it)->getName())
3800 .arg(
"get exception?");
3811 cclass != classes.
cend(); ++cclass) {
3812 pkt->addClass(*cclass);
3817 if (!classes.
empty()) {
3819 .arg(pkt->getLabel())
3829 ctx.
subnet_->getSharedNetwork(shared_network);
3830 if (shared_network) {
3832 if (host && (host->getIPv6SubnetID() != SUBNET_ID_GLOBAL)) {
3848 subnet->getSharedNetwork(network);
3850 const ClientClasses& to_add = network->getRequiredClasses();
3852 cclass != to_add.
cend(); ++cclass) {
3860 cclass != to_add.
cend(); ++cclass) {
3867 ctx.
subnet_->getPool(resource.getPrefixLength() == 128 ?
3869 resource.getAddress(),
3874 cclass != to_add.
cend(); ++cclass) {
3888 cclass != classes.
cend(); ++cclass) {
3911 pkt->addClass(*cclass);
3924 .arg(
"get exception?");
3934 " a message must not be NULL when updating reserved FQDN");
3957 if (new_name != name) {
3962 answer->addOption(fqdn);
3968 Dhcpv6Srv::generateFqdn(
const Pkt6Ptr& answer,
3972 " a message must not be NULL when generating FQDN");
3983 if (!fqdn || !fqdn->getDomainName().empty()) {
4001 std::string generated_name =
4005 .arg(answer->getLabel())
4006 .arg(generated_name);
4023 lease->hostname_ = generated_name;
4024 lease->reuseable_valid_lft_ = 0;
4029 " for address " << addr <<
", so as it is impossible"
4030 " to update FQDN data. This is a programmatic error"
4031 " as the given address is now being handed to the"
4039 answer->addOption(fqdn);
4043 .arg(answer->getLabel())
4057 this, ph::_1, ph::_2));
4075 arg(result).arg((ncr ? ncr->toText() :
" NULL "));
4087 std::stringstream tmp;
4091 tmp << endl << EXTENDED_VERSION << endl;
4092 tmp <<
"linked with:" << endl;
4093 tmp << Logger::getVersion() << endl;
4094 tmp << CryptoLink::getVersion() << endl;
4095 tmp <<
"database:" << endl;
4115 if (query->relay_info_.empty()) {
4126 for (
int i = query->relay_info_.size(); i > 0 ; --i) {
4128 if (rsoo_container) {
4133 for (OptionCollection::const_iterator opt = rsoo.begin();
4134 opt != rsoo.end(); ++opt) {
4138 if (cfg_rsoo->enabled(opt->second->getType()) &&
4139 !rsp->getOption(opt->second->getType())) {
4140 rsp->addOption(opt->second);
4149 if (query->relay_info_.empty()) {
4157 return (query->getRemotePort());
4163 void Dhcpv6Srv::processStatsReceived(
const Pkt6Ptr& query) {
4167 string stat_name =
"pkt6-unknown-received";
4168 switch (query->getType()) {
4170 stat_name =
"pkt6-solicit-received";
4174 stat_name =
"pkt6-advertise-received";
4177 stat_name =
"pkt6-request-received";
4180 stat_name =
"pkt6-confirm-received";
4183 stat_name =
"pkt6-renew-received";
4186 stat_name =
"pkt6-rebind-received";
4190 stat_name =
"pkt6-reply-received";
4193 stat_name =
"pkt6-release-received";
4196 stat_name =
"pkt6-decline-received";
4199 stat_name =
"pkt6-reconfigure-received";
4202 stat_name =
"pkt6-infrequest-received";
4205 stat_name =
"pkt6-dhcpv4-query-received";
4209 stat_name =
"pkt6-dhcpv4-response-received";
4215 StatsMgr::instance().addValue(stat_name, static_cast<int64_t>(1));
4220 StatsMgr::instance().addValue(
"pkt6-sent", static_cast<int64_t>(1));
4224 switch (response->getType()) {
4226 stat_name =
"pkt6-advertise-sent";
4229 stat_name =
"pkt6-reply-sent";
4232 stat_name =
"pkt6-dhcpv4-response-sent";
4239 StatsMgr::instance().addValue(stat_name, static_cast<int64_t>(1));
4243 return (Hooks.hook_index_buffer6_send_);
4247 Dhcpv6Srv::requestedInORO(
const Pkt6Ptr& query,
const uint16_t code)
const {
4252 const std::vector<uint16_t>& codes = oro->
getValues();
4253 return (std::find(codes.begin(), codes.end(), code) != codes.end());
4261 HooksManager::clearParkingLots();
4268 uint32_t t2_time = 0;
4271 if (!subnet->getT2().unspecified()) {
4272 t2_time = subnet->getT2();
4273 }
else if (subnet->getCalculateTeeTimes()) {
4275 t2_time =
static_cast<uint32_t
>(round(subnet->getT2Percent() * preferred_lft));
4279 resp->setT2(t2_time);
4282 uint32_t t1_time = 0;
4285 if (!subnet->getT1().unspecified()) {
4286 t1_time = subnet->getT1();
4287 }
else if (subnet->getCalculateTeeTimes()) {
4289 t1_time =
static_cast<uint32_t
>(round(subnet->getT1Percent() * preferred_lft));
4293 if (t1_time < t2_time) {
4294 resp->setT1(t1_time);
4306 if ((!ctx.
subnet_) || (!orig_subnet) || (orig_subnet->getID() == ctx.
subnet_->getID())) {
4314 orig_subnet->getSharedNetwork(network);
4316 .arg(question->getLabel())
4317 .arg(orig_subnet->toText())
4319 .arg(network ? network->getName() :
"<no network?>");
4325 std::string prev_hostname = ctx.
hostname_;
4342 for (Lease6Collection::const_iterator l = ctx.
new_leases_.begin();
4347 (*l)->reuseable_valid_lft_ = 0;
4354 static std::list<std::list<std::string>>
const list({
4355 {
"config-control",
"config-databases",
"[]"},
4356 {
"hooks-libraries",
"[]",
"parameters",
"*"},
4358 {
"hosts-databases",
"[]"},
Implementation of the mechanisms to control the use of the Configuration Backends by the DHCPv6 serve...
boost::shared_ptr< OptionVendorClass > OptionVendorClassPtr
Defines a pointer to the OptionVendorClass.
RAII class creating a critical section.
static std::string lifetimeToText(uint32_t lifetime)
Print lifetime.
virtual Pkt6Ptr receivePacket(int timeout)
dummy wrapper around IfaceMgr::receive6
std::string getIdentifierAsText() const
Returns host identifier in a textual form.
const isc::log::MessageID DHCP6_PROCESS_IA_NA_EXTEND
const OptionCollection & getOptions() const
Returns all encapsulated options.
ConstHostPtr globalHost() const
Returns global host reservation if there is one.
uint32_t calculateDdnsTtl(uint32_t lease_lft)
Calculates TTL for a DNS resource record based on lease life time.
const int DBG_DHCP6_BASIC_DATA
Debug level used to log the traces with some basic data.
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
const isc::log::MessageID DHCP6_DDNS_CREATE_ADD_NAME_CHANGE_REQUEST
uint16_t server_port_
UDP port number on which server listens.
boost::shared_ptr< DUID > DuidPtr
const isc::log::MessageID DHCP6_DECLINE_PROCESS_IA
Pkt6Ptr processInfRequest(AllocEngine::ClientContext6 &ctx)
Processes incoming Information-request message.
const isc::log::MessageID DHCP6_HOOK_SUBNET6_SELECT_SKIP
static uint16_t client_port
uint32_t getIAID() const
Returns IA identifier.
int run()
Main server processing loop.
volatile bool shutdown_
Indicates if shutdown is in progress.
const isc::log::MessageID DHCP6_SUBNET_DYNAMICALLY_CHANGED
const isc::log::MessageID DHCP6_RAPID_COMMIT
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID
void classifyPacket(const Pkt6Ptr &pkt)
Assigns incoming packet to zero or more classes.
HWAddrPtr hwaddr_
Hardware/MAC address (if available, may be NULL)
isc::log::Logger packet6_logger(DHCP6_PACKET_LOGGER_NAME)
Logger for processed packets.
Represents DHCPv6 Client FQDN Option (code 39).
const void * getData() const
Return a pointer to the head of the data stored in the buffer.
void sanityCheckDUID(const OptionPtr &opt, const std::string &opt_name)
verifies if received DUID option (client-id or server-id) is sane
isc::log::Logger ddns6_logger(DHCP6_DDNS_LOGGER_NAME)
Logger for Hostname or FQDN processing.
const isc::log::MessageID DHCP6_SRV_CONSTRUCT_ERROR
const isc::log::MessageID DHCP6_CLASS_UNTESTABLE
Lease6Collection changed_leases_
A pointer to any leases that have changed FQDN information.
void appendDefaultOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
Appends default options to server's answer.
static std::string getDBVersion()
Local version of getDBVersion() class method.
isc::log::Logger options6_logger(DHCP6_OPTIONS_LOGGER_NAME)
Logger for options parser.
const int DBGLVL_TRACE_BASIC
Trace basic operations.
const isc::log::MessageID DHCP6_LEASE_ALLOC
const isc::log::MessageID DHCP6_CLASS_ASSIGNED
const isc::log::MessageID DHCP6_PD_LEASE_ADVERT
HintContainer hints_
Client's hints.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
ConstHostPtr currentHost() const
Returns host from the most preferred subnet.
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
void shutdown() override
Instructs the server to shut down.
virtual void sendPacket(const Pkt6Ptr &pkt)
dummy wrapper around IfaceMgr::send()
const isc::log::MessageID DHCP6_SUBNET_SELECTED
const isc::log::MessageID DHCP6_OPEN_SOCKET
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
std::string getDomainName() const
Returns the domain-name in the text format.
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID
boost::shared_ptr< Pool6 > Pool6Ptr
a pointer an IPv6 Pool
const isc::log::MessageID DHCP6_LEASE_ADVERT_FAIL
Exception thrown during option unpacking This exception is thrown when an error has occurred...
void releaseLeases(const Pkt6Ptr &release, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to release received addresses.
void adjustDomainName(const T &fqdn, T &fqdn_resp, const DdnsParams &ddns_params)
Set server FQDN name based on configuration and a given FQDN.
OptionPtr getOption(uint16_t type) const
Returns shared_ptr to suboption of specific type.
static void destroy()
Destroy lease manager.
Lease6Collection old_leases_
A pointer to any old leases that the client had before update but are no longer valid after the updat...
const isc::log::MessageID DHCP6_LEASE_RENEW
const isc::log::MessageID DHCP6_LEASE_DATA
static Dhcp6to4Ipc & instance()
Returns pointer to the sole instance of Dhcp6to4Ipc.
An abstract API for lease database.
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL
static CfgMgr & instance()
returns a single instance of Configuration Manager
void extendLeases(const Pkt6Ptr &query, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to extend the lifetime of IAs.
isc::log::Logger lease6_logger(DHCP6_LEASE_LOGGER_NAME)
Logger for lease allocation logic.
void startSender(D2ClientErrorHandler error_handler, isc::asiolink::IOService &io_service)
Enables sending NameChangeRequests to kea-dhcp-ddns.
Result
Defines the outcome of an asynchronous NCR send.
void processRSOO(const Pkt6Ptr &query, const Pkt6Ptr &rsp)
Processes Relay-supplied options, if present.
std::list< std::list< std::string > > jsonPathsToRedact() const finaloverride
Return a list of all paths that contain passwords or secrets for kea-dhcp6.
boost::shared_ptr< Option > OptionPtr
const int DBG_DHCP6_HOOKS
Debug level used to trace hook related operations.
boost::shared_ptr< const CfgRSOO > ConstCfgRSOOPtr
Pointer to the const object.
const isc::log::MessageID DHCP6_DECLINE_FAIL_NO_LEASE
const int DBG_DHCP6_BASIC
Debug level used to trace basic operations within the code.
Represents a DHCPv6 packet.
static void processStatsSent(const Pkt6Ptr &response)
Updates statistics for transmitted packets.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
the lease contains IPv6 prefix (for prefix delegation)
isc::asiolink::IOAddress getAddress() const
Returns address contained within this option.
const isc::log::MessageID DHCP6_FLEX_ID
void appendRequestedOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
Appends requested options to server's answer.
const isc::log::MessageID DHCP6_LEASE_PD_WITHOUT_DUID
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
Holds information about DHCP service enabling status.
bool fwd_dns_update_
A boolean value which indicates that server takes responsibility for the forward DNS Update for this ...
DuidPtr duid_
Client identifier.
virtual std::string getLabel() const
Returns text representation of the primary packet identifiers.
const isc::log::MessageID DHCP6_DDNS_GENERATE_FQDN
OptionPtr extendIA_PD(const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Extends lifetime of the prefix.
const isc::log::MessageID DHCP6_PACKET_PROCESS_STD_EXCEPTION
const isc::log::MessageID DHCP6_SUBNET_DATA
static SubnetSelector initSelector(const Pkt6Ptr &query)
Build selector from a client's message.
void evaluateClasses(const Pkt6Ptr &pkt, bool depend_on_known)
Evaluate classes.
const isc::log::MessageID DHCP6_HOOK_PACKET_SEND_DROP
static std::string duidToString(const OptionPtr &opt)
converts DUID to text Converts content of DUID option to a text representation, e.g.
boost::shared_ptr< Pool > PoolPtr
a pointer to either IPv4 or IPv6 Pool
const isc::log::MessageID DHCP6_ADD_GLOBAL_STATUS_CODE
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
const isc::log::MessageID DHCP6_DECLINE_FAIL_LEASE_WITHOUT_DUID
const isc::log::MessageID DHCP6_PACKET_RECEIVED
void processPacketBufferSend(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &rsp)
Executes buffer6_send callout and sends the response.
int getExitValue()
Fetches the exit value.
DuidPtr get()
Returns current DUID.
const isc::log::MessageID DHCP6_HOOK_LEASE6_RELEASE_PD_SKIP
const isc::log::MessageID DHCP6_DDNS_GENERATED_FQDN_UPDATE_FAIL
const isc::log::MessageID DHCP6_PACKET_QUEUE_FULL
RAII object enabling copying options retrieved from the packet.
void sendRequest(dhcp_ddns::NameChangeRequestPtr &ncr)
Send the given NameChangeRequests to kea-dhcp-ddns.
const isc::log::MessageID DHCP6_LEASE_REUSE
static std::string getDBVersion()
Local version of getDBVersion() class method.
const isc::log::MessageID DHCP6_PACKET_PROCESS_EXCEPTION
static StatsMgr & instance()
Statistics Manager accessor method.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Holds DUID (DHCPv6 Unique Identifier)
const char *const * dhcp6_config_report
const isc::log::MessageID DHCP6_PACKET_DROP_DHCP_DISABLED
Statistics Manager class.
The IOService class is a wrapper for the ASIO io_service class.
boost::shared_ptr< DdnsParams > DdnsParamsPtr
Defines a pointer for DdnsParams instances.
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.
const isc::log::MessageID DHCP6_PACKET_OPTIONS_SKIPPED
void setReservedClientClasses(const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
Assigns classes retrieved from host reservation database.
bool send(const Pkt6Ptr &pkt)
Sends an IPv6 packet.
void setDomainName(const std::string &domain_name, const DomainNameType domain_name_type)
Set new domain-name.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
const isc::log::MessageID DHCP6_HOOK_LEASE6_RELEASE_NA_SKIP
Subnet selector used to specify parameters used to select a subnet.
virtual std::string toText(int indent=0) const
Returns string representation of the option.
boost::shared_ptr< Option6IA > Option6IAPtr
A pointer to the Option6IA object.
This class represents Status Code option (13) from RFC 8415.
const isc::log::MessageID DHCP6_RELEASE_PD
void conditionallySetReservedClientClasses(const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
Assigns classes retrieved from host reservation database if they haven't been yet set...
void assignLeases(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Assigns leases.
const isc::log::MessageID DHCP6_PD_LEASE_REUSE
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
const isc::log::MessageID DHCP6_PACKET_DROP_UNICAST
const isc::log::MessageID DHCP6_PROCESS_IA_NA_RELEASE
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
const isc::log::MessageID DHCP6_SRV_UNLOAD_LIBRARIES_ERROR
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
bool testUnicast(const Pkt6Ptr &pkt) const
Check if the message can be sent to unicast.
const isc::log::MessageID DHCP6_NO_INTERFACES
Subnet6Ptr subnet_
Subnet selected for the client by the server.
Pkt6Ptr processRebind(AllocEngine::ClientContext6 &ctx)
Processes incoming Rebind message.
ResourceContainer allocated_resources_
Holds addresses and prefixes allocated for all IAs.
const isc::log::MessageID DHCP6_SHUTDOWN_REQUEST
const isc::log::MessageID DHCP6_PACKET_DROP_PARSE_FAIL
Pool information for IPv6 addresses and prefixes.
std::list< ClientClass >::const_iterator const_iterator
Type of iterators.
const char *const config_report[]
void classifyByVendor(const Pkt6Ptr &pkt, std::string &classes)
Assign class using vendor-class-identifier option.
Forward declaration to OptionIntArray.
const int DBG_DHCP6_START
Debug level used to log information during server startup.
OptionPtr getServerID()
Returns server-identifier option.
std::list< ConstCfgOptionPtr > CfgOptionList
Const pointer list.
const isc::log::MessageID DHCP6_RELEASE_NA
const isc::log::MessageID DHCP6_RELEASE_PD_FAIL
boost::shared_ptr< Option6IAPrefix > Option6IAPrefixPtr
Pointer to the Option6IAPrefix object.
const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED
const isc::log::MessageID DHCP6_LEASE_NA_WITHOUT_DUID
const_iterator cend() const
Iterator to the past the end element.
Pkt6Ptr processSolicit(AllocEngine::ClientContext6 &ctx)
Processes incoming Solicit and returns response.
const char * DOCSIS3_CLASS_MODEM
DOCSIS3.0 compatible cable modem.
boost::shared_ptr< Option6ClientFqdn > Option6ClientFqdnPtr
A pointer to the Option6ClientFqdn object.
static HWAddrPtr getMAC(const Pkt6Ptr &pkt)
Attempts to get a MAC/hardware address using configured sources.
void processPacketPktSend(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp)
Executes pkt6_send callout.
const isc::log::MessageID DHCP6_CLASS_UNDEFINED
const isc::log::MessageID DHCP6_DDNS_RECEIVE_FQDN
std::map< SubnetID, ConstHostPtr > hosts_
Holds a map of hosts belonging to the client within different subnets.
const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_DROP
RequirementLevel
defines if certain option may, must or must not appear
std::vector< IAContext > ias_
Container holding IA specific contexts.
Context information for the DHCPv6 leases allocation.
bool testServerID(const Pkt6Ptr &pkt)
Compare received server id with our server id.
void setStatusCode(boost::shared_ptr< Option6IA > &container, const OptionPtr &status)
A simple utility method that sets the status code.
void processPacketAndSendResponseNoThrow(Pkt6Ptr &query)
Process a single incoming DHCPv6 packet and sends the response.
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS
static std::string getDBVersion()
Local version of getDBVersion() class method.
std::pair< OptionContainerPersistIndex::const_iterator, OptionContainerPersistIndex::const_iterator > OptionContainerPersistRange
Pair of iterators to represent the range of options having the same persistency flag.
const isc::log::MessageID DHCP6_HOOK_DECLINE_SKIP
A generic exception that is thrown when an unexpected error condition occurs.
boost::shared_ptr< ClientClassDictionary > ClientClassDictionaryPtr
Defines a pointer to a ClientClassDictionary.
void requiredClassify(const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx)
Assigns incoming packet to zero or more classes (required pass).
const isc::log::MessageID DHCP6_HOOK_BUFFER_SEND_SKIP
void appendRequestedVendorOptions(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const CfgOptionList &co_list)
Appends requested vendor options to server's answer.
static std::string getDBVersion()
Local version of getDBVersion() class method.
bool equalValues(const T &ptr1, const T &ptr2)
This function checks if two pointers are non-null and values are equal.
Wrapper class around callout handle which automatically resets handle's state.
const isc::log::MessageID DHCP6_QUERY_DATA
static int getHookIndexBuffer6Send()
Returns the index of the buffer6_send hook.
const isc::log::MessageID DHCP6_SUBNET_SELECTION_FAILED
void buildCfgOptionList(const Pkt6Ptr &question, AllocEngine::ClientContext6 &ctx, CfgOptionList &co_list)
Build the configured option list.
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.
bool sanityCheck(const Pkt6Ptr &pkt)
Verifies if specified packet meets RFC requirements.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS is enabled.
Option6IAPtr ia_rsp_
A pointer to the IA_NA/IA_PD option to be sent in response.
const isc::log::MessageID DHCP6_PACKET_DROP_SERVERID_MISMATCH
const isc::log::MessageID DHCP6_ADD_STATUS_CODE_FOR_IA
Flexible host identifier.
const char * DOCSIS3_CLASS_EROUTER
The class as specified in vendor-class option by the devices.
virtual ~Dhcpv6Srv()
Destructor. Used during DHCPv6 service shutdown.
boost::shared_ptr< const Host > ConstHostPtr
Const pointer to the Host object.
void addHostIdentifier(const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
Convenience function adding host identifier into host_identifiers_ list.
std::vector< uint32_t > CfgMACSources
Container for defined MAC/hardware address sources.
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_WRONG_IAID
Option6PDExcludePtr getPrefixExcludeOption() const
Returns instance of the pool specific Prefix Exclude option.
Defines the Dhcp6to4Ipc class.
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
const isc::log::MessageID DHCP6_HOOK_SUBNET6_SELECT_DROP
const isc::log::MessageID DHCP6_DECLINE_LEASE
std::vector< Resource > HintContainer
Container for client's hints.
const isc::log::MessageID DHCP6_BUFFER_RECEIVED
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.
const int DBG_DHCP6_DETAIL
Debug level used to trace detailed errors.
const isc::log::MessageID DHCP6_PACKET_RECEIVE_FAIL
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const =0
Returns existing IPv6 lease for a given IPv6 address.
void addOption(OptionPtr opt)
Adds a sub-option.
void processClientFqdn(const Pkt6Ptr &question, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Processes Client FQDN Option.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
OptionPtr assignIA_NA(const isc::dhcp::Pkt6Ptr &query, const isc::dhcp::Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Processes IA_NA option (and assigns addresses if necessary).
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Pkt6Ptr processRequest(AllocEngine::ClientContext6 &ctx)
Processes incoming Request and returns Reply response.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
void discardPackets()
Discards parked packets Clears the packet parking lots of all packets.
Pkt6Ptr processRelease(AllocEngine::ClientContext6 &ctx)
Process incoming Release message.
boost::shared_ptr< ClientClassDef > ClientClassDefPtr
a pointer to an ClientClassDef
the lease contains non-temporary IPv6 address
OptionPtr option_
Option instance.
const isc::log::MessageID DHCP6_PACKET_SEND_FAIL
virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
Implements the error handler for DHCP_DDNS IO errors.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
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_PROCESS_IA_PD_REQUEST
const isc::log::MessageID DHCP6_DDNS_FQDN_GENERATED
const isc::log::MessageID DHCP6_PACKET_SEND
boost::shared_ptr< Option6PDExclude > Option6PDExcludePtr
Pointer to the Option6PDExclude object.
Client race avoidance RAII handler.
bool fake_allocation_
Indicates if this is a real or fake allocation.
uint16_t client_port_
UDP port number to which server sends all responses.
const isc::log::MessageID DHCP6_PROCESS_IA_PD_EXTEND
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< Option6StatusCode > Option6StatusCodePtr
Pointer to the isc::dhcp::Option6StatusCode.
const isc::log::MessageID DHCP6_RELEASE_NA_FAIL_WRONG_DUID
Lease6Collection new_leases_
A collection of newly allocated leases.
void initContext(const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx, bool &drop)
Initializes client context for specified packet.
const isc::log::MessageID DHCP6_RESPONSE_DATA
const isc::log::MessageID DHCP6_PACKET_DROP_DROP_CLASS2
const isc::log::MessageID DHCP6_HOOK_PACKET_RCVD_SKIP
const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_SKIP
uint32_t iaid_
The IAID field from IA_NA or IA_PD that is being processed.
const isc::log::MessageID DHCP6_PACKET_PROCESS_FAIL
void checkDynamicSubnetChange(const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const Subnet6Ptr orig_subnet)
Iterates over new leases, update stale DNS entries.
const int DBG_DHCP6_DETAIL_DATA
This level is used to log the contents of packets received and sent.
D2ClientMgr isolates Kea from the details of being a D2 client.
void run_one()
Main server processing step.
Lease::Type type_
Lease type (IA or PD)
const isc::log::MessageID DHCP6_DDNS_REMOVE_OLD_LEASE_FQDN
void getUpdateDirections(const T &fqdn_resp, bool &forward, bool &reverse)
Get directional update flags based on server FQDN flags.
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.
static const size_t MAX_DUID_LEN
maximum duid size As defined in RFC 8415, section 11.1
const isc::log::MessageID DHCP6_HOOK_LEASES6_COMMITTED_DROP
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
This exception is thrown when DHCP server hits the error which should result in discarding the messag...
Pkt6Ptr query_
A pointer to the client's message.
boost::shared_ptr< ClientClassDefList > ClientClassDefListPtr
Defines a pointer to a ClientClassDefList.
const isc::log::MessageID DHCP6_PD_LEASE_RENEW
Exception thrown when a call to select is interrupted by a signal.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
static const uint8_t FLAG_S
S bit.
isc::log::Logger hooks_logger("hooks")
Hooks Logger.
void processDhcp6QueryAndSendResponse(Pkt6Ptr &query, Pkt6Ptr &rsp)
Process a single incoming DHCPv6 query.
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
Pkt6Ptr processRenew(AllocEngine::ClientContext6 &ctx)
Processes incoming Renew message.
const isc::log::MessageID DHCP6_PD_LEASE_ADVERT_FAIL
void stopD2()
Stops DHCP_DDNS client IO if DDNS updates are enabled.
#define DHCP6_OPTION_SPACE
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 closeSockets()
Closes all open sockets.
bool rev_dns_update_
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this ...
const isc::log::MessageID DHCP6_DECLINE_FAIL
static IfaceMgr & instance()
IfaceMgr is a singleton class.
An exception that is thrown if a DHCPv6 protocol violation occurs while processing a message (e...
Container class for handling the DHCID value within a NameChangeRequest.
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
boost::shared_ptr< OptionContainer > OptionContainerPtr
Pointer to the OptionContainer object.
isc::dhcp::Subnet6Ptr selectSubnet(const Pkt6Ptr &question, bool &drop)
Selects a subnet for a given client's packet.
const isc::log::MessageID DHCP6_PROCESS_IA_NA_REQUEST
bool tryLock(Pkt4Ptr query, ContinuationPtr cont=ContinuationPtr())
Tries to acquires a client.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
OptionPtr serverid_
Server DUID (to be sent in server-identifier option)
std::string toText() const
Convert the address to a string.
const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL
void processDhcp6Query(Pkt6Ptr &query, Pkt6Ptr &rsp)
Process a single incoming DHCPv6 query.
void createIAContext()
Creates new IA context.
void setPacketStatisticsDefaults()
This function sets statistics related to DHCPv6 packets processing to their initial values...
IAContext & currentIA()
Returns IA specific context for the currently processed IA.
boost::shared_ptr< const CfgHostOperations > ConstCfgHostOperationsPtr
Pointer to the const object.
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
void close()
Close communication socket.
const isc::log::MessageID DHCP6_DECLINE_FAIL_IAID_MISMATCH
const isc::log::MessageID DHCP6_DDNS_RESPONSE_FQDN_DATA
const isc::log::MessageID DHCP6_HOOK_LEASES6_COMMITTED_PARK
Pkt6Ptr processDecline(AllocEngine::ClientContext6 &ctx)
Process incoming Decline message.
void suspendUpdates()
Suspends sending requests.
const isc::log::MessageID DHCP6_LEASE_ADVERT
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
virtual bool deleteLease(const Lease4Ptr &lease)=0
Deletes an IPv4 lease.
void send(const Pkt6Ptr &pkt)
Send message over IPC.
const isc::log::MessageID DHCP6_BUFFER_WAIT_SIGNAL
void processDhcp4Query(const Pkt6Ptr &dhcp4_query)
Processes incoming DHCPv4-query message.
const isc::log::MessageID DHCP6_DECLINE_FAIL_DUID_MISMATCH
bool isClientClassBuiltIn(const ClientClass &client_class)
Check if a client class name is builtin.
Factory for generating DUIDs (DHCP Unique Identifiers).
void processPacketAndSendResponse(Pkt6Ptr &query)
Process a single incoming DHCPv6 packet and sends the response.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
void insert(const ClientClass &class_name)
Insert an element.
OptionPtr assignIA_PD(const Pkt6Ptr &query, const isc::dhcp::Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, boost::shared_ptr< Option6IA > ia)
Processes IA_PD option (and assigns prefixes if necessary).
void setTeeTimes(uint32_t preferred_lft, const Subnet6Ptr &subnet, Option6IAPtr &resp)
Sets the T1 and T2 timers in the outbound IA.
void sendResponseNoThrow(hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp)
Process an unparked DHCPv6 packet and sends the response.
IdentifierType
Type of the host identifier.
const isc::log::MessageID DHCP6_LEASE_ALLOC_FAIL
bool empty() const
Check if classes is empty.
hooks::CalloutHandlePtr callout_handle_
Callout handle associated with the client's message.
bool declineLeases(const Pkt6Ptr &decline, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
Attempts to decline all leases in specified Decline message.
The IOAddress class represents an IP addresses (version agnostic)
static LeaseMgr & instance()
Return current lease manager.
Class that represents IAPREFIX option in DHCPv6.
isc::hooks::CalloutHandlePtr getCalloutHandle(const T &pktptr)
CalloutHandle Store.
const isc::log::MessageID EVAL_RESULT
const isc::log::MessageID DHCP6_PACK_FAIL
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
std::string hostname_
Hostname.
const isc::log::MessageID DHCP6_BUFFER_UNPACK
size_t getLength() const
Return the length of data written in the buffer.
DHCPv4 and DHCPv6 allocation engine.
const_iterator cbegin() const
Iterator to the first element.
OptionContainer::nth_index< 2 >::type OptionContainerPersistIndex
Type of the index #2 - option persistency flag.
isc::log::Logger bad_packet6_logger(DHCP6_BAD_PACKET_LOGGER_NAME)
Logger for rejected packets.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< Continuation > ContinuationPtr
Define the type of shared pointers to continuations.
Represents a DHCP-DDNS client request.
const isc::log::MessageID DHCP6_UNKNOWN_MSG_RECEIVED
boost::shared_ptr< OptionUint16Array > OptionUint16ArrayPtr
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
Container for storing client class names.
static const std::string VENDOR_CLASS_PREFIX
this is a prefix added to the content of vendor-class option
const isc::log::MessageID DHCP6_HOOK_PACKET_SEND_SKIP
const isc::log::MessageID DHCP6_HOOK_DECLINE_DROP
boost::shared_ptr< Expression > ExpressionPtr
OptionPtr extendIA_NA(const Pkt6Ptr &query, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
Extends lifetime of the specific IA_NA option.
const isc::log::MessageID DHCP6_PD_LEASE_ALLOC
This class represents vendor-specific information option.
bool declineLease(const Pkt6Ptr &decline, const Lease6Ptr lease, boost::shared_ptr< Option6IA > ia_rsp)
Declines specific IPv6 lease.
boost::shared_ptr< Option6IAAddr > Option6IAAddrPtr
A pointer to the isc::dhcp::Option6IAAddr object.
void setValue(const std::string &name, const int64_t value)
Records absolute integer observation.
static uint16_t checkRelaySourcePort(const Pkt6Ptr &query)
Used for DHCPv4-over-DHCPv6 too.
void copyClientOptions(const Pkt6Ptr &question, Pkt6Ptr &answer)
Copies required options from client message to server answer.
void adjustFqdnFlags(const T &fqdn, T &fqdn_resp, const DdnsParams &ddns_params)
Set server FQDN flags based on configuration and a given FQDN.
Pkt6Ptr processConfirm(AllocEngine::ClientContext6 &ctx)
Processes incoming Confirm message and returns Reply.
isc::log::Logger dhcp6_logger(DHCP6_APP_LOGGER_NAME)
Base logger for DHCPv6 server.
const isc::log::MessageID DHCP6_DDNS_REQUEST_SEND_FAILED
const isc::log::MessageID DHCP6_SRV_D2STOP_ERROR
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
This class encapsulates DHCPv6 Vendor Class and DHCPv4 V-I Vendor Class options.
virtual void updateLease6(const Lease6Ptr &lease6)=0
Updates IPv6 lease.
DdnsParamsPtr getDdnsParams()
Returns the set of DDNS behavioral parameters based on the selected subnet.
void createNameChangeRequests(const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
Creates a number of isc::dhcp_ddns::NameChangeRequest objects based on the DHCPv6 Client FQDN Option...
const std::vector< T > & getValues() const
Return collection of option values.
uint32_t getVendorId() const
Returns enterprise identifier.
const isc::log::MessageID DHCP6_PD_LEASE_ALLOC_FAIL
void processPacket(Pkt6Ptr &query, Pkt6Ptr &rsp)
Process a single incoming DHCPv6 packet.
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.
std::string toText(const std::string &separator=", ") const
Returns all class names as text.
void stopSender()
Disables sending NameChangeRequests to kea-dhcp-ddns.
ContinuationPtr makeContinuation(Continuation &&cont)
Continuation factory.