52namespace ph = std::placeholders;
57struct CtrlDhcp6Hooks {
58 int hooks_index_dhcp6_srv_configured_;
74static const char* SERVER_DUID_FILE =
"kea-dhcp6-serverid";
85void signalHandler(
int signo) {
87 if (signo == SIGHUP) {
89 }
else if ((signo == SIGTERM) || (signo == SIGINT)) {
104 start_ = boost::posix_time::second_clock::universal_time();
112 string reason = comment ? comment->stringValue() :
113 "no details available";
142 if (file_name.empty()) {
145 " Please use -c command line option.");
159 "a map, i.e., start with { and end with } and contain "
160 "at least an entry called 'Dhcp6' that itself is a map. "
162 <<
" is a valid JSON, but its top element is not a map."
163 " Did you forget to add { } around your configuration?");
173 "process command \"config-set\"");
181 string reason = comment ? comment->stringValue() :
182 "no details available";
191 }
catch (
const std::exception& ex) {
197 .arg(file_name).arg(ex.what());
199 << file_name <<
"': " << ex.what());
233 "parameter 'exit-value' is not an integer"));
236 exit_value = param->intValue();
249 "Illegal operation executing 'config-reload' on a different thread than main thread"));
261 if (Daemon::getShutdownOnFailure()) {
265 "Config reload failed: " +
string(ex.
what())));
266 }
catch (
const std::exception& ex) {
273 "Config reload failed: " +
string(ex.
what())));
309 if (filename_param) {
312 "passed parameter 'filename' is not a string"));
314 filename = filename_param->stringValue();
318 if (filename.empty()) {
322 if (filename.empty()) {
324 "Please specify filename explicitly."));
330 std::ostringstream msg;
331 msg <<
"not allowed to write config into " << filename
332 <<
": " << ex.
what();
357 + filename +
" successful", params));
365 "Illegal operation executing 'config-set' on a different thread than main thread"));
374 message =
"Missing mandatory 'arguments' parameter.";
376 dhcp6 = args->get(
"Dhcp6");
378 message =
"Missing mandatory 'Dhcp6' parameter.";
380 message =
"'Dhcp6' parameter expected to be a map.";
385 if (message.empty()) {
386 for (
auto const& obj : args->mapValue()) {
387 const string& obj_name = obj.first;
388 if (obj_name !=
"Dhcp6") {
391 if (message.empty()) {
392 message =
"Unsupported '" + obj_name +
"' parameter";
394 message +=
" (and '" + obj_name +
"')";
398 if (!message.empty()) {
403 if (!message.empty()) {
416 "Can not update configuration while lease file cleanup process is running."));
449 message =
"Reconfiguration triggered a fatal error: shutting down.";
478 }
catch (
const std::exception& ex) {
480 if (Daemon::getShutdownOnFailure()) {
485 std::ostringstream err;
486 err <<
"Error initializing hooks: "
503 "Illegal operation executing 'config-test' on a different thread than main thread"));
512 message =
"Missing mandatory 'arguments' parameter.";
514 dhcp6 = args->get(
"Dhcp6");
516 message =
"Missing mandatory 'Dhcp6' parameter.";
518 message =
"'Dhcp6' parameter expected to be a map.";
523 if (message.empty()) {
524 for (
auto const& obj : args->mapValue()) {
525 const string& obj_name = obj.first;
526 if (obj_name !=
"Dhcp6") {
529 if (message.empty()) {
530 message =
"Unsupported '" + obj_name +
"' parameter";
532 message +=
" (and '" + obj_name +
"')";
536 if (!message.empty()) {
541 if (!message.empty()) {
563 std::ostringstream message;
564 int64_t max_period = 0;
576 message <<
"arguments for the 'dhcp-disable' command must be a map";
581 if (max_period_element) {
584 message <<
"'max-period' argument must be a number";
588 max_period = max_period_element->intValue();
589 if (max_period <= 0) {
590 message <<
"'max-period' must be positive integer";
603 if (origin_id_element) {
605 type = origin_id_element->intValue();
607 message <<
"'origin-id' argument must be a number";
609 }
else if (origin_element) {
610 switch (origin_element->getType()) {
612 origin = origin_element->stringValue();
613 if (origin ==
"ha-partner") {
615 }
else if (origin !=
"user") {
616 if (origin.empty()) {
617 origin =
"(empty string)";
619 message <<
"invalid value used for 'origin' parameter: "
624 type = origin_element->intValue();
628 message <<
"'origin' argument must be a string or a number";
635 if (message.tellp() == 0) {
636 message <<
"DHCPv6 service disabled";
637 if (max_period > 0) {
638 message <<
" for " << max_period <<
" seconds";
643 network_state_->delayedEnableService(
static_cast<unsigned>(max_period),
659 std::ostringstream message;
670 message <<
"arguments for the 'dhcp-enable' command must be a map";
682 if (origin_id_element) {
684 type = origin_id_element->intValue();
686 message <<
"'origin-id' argument must be a number";
688 }
else if (origin_element) {
689 switch (origin_element->getType()) {
691 origin = origin_element->stringValue();
692 if (origin ==
"ha-partner") {
694 }
else if (origin !=
"user") {
695 if (origin.empty()) {
696 origin =
"(empty string)";
698 message <<
"invalid value used for 'origin' parameter: "
703 type = origin_element->intValue();
707 message <<
"'origin' argument must be a string or a number";
714 if (message.tellp() == 0) {
719 "DHCP service successfully enabled"));
734 }
catch (
const std::exception& ex) {
739 message =
"unknown error";
745 <<
" interfaces detected.";
748 msg <<
"Unexpected error while retrieving the list of detected interfaces: " << message;
758 "Illegal operation executing 'interface-redetect' on a different thread than main thread"));
767 }
catch (
const std::exception& ex) {
772 message =
"unknown error";
779 msg <<
"Unexpected error while retrieving the list of detected interfaces: " << message;
789 "Illegal operation executing 'interface-add' on a different thread than main thread"));
794 message =
"Missing mandatory 'arguments' parameter.";
797 message =
"arguments for the 'interface-add' command must be a map";
799 ifaces_config = args->get(
"interfaces");
800 if (!ifaces_config) {
801 message =
"Missing mandatory 'interfaces' map parameter in 'arguments'.";
803 auto map = args->mapValue();
804 for (
auto const& key : map) {
805 if (key.first !=
"interfaces") {
806 message =
"Unsupported '" + key.first +
"' map parameter in 'arguments'.";
813 if (!message.empty()) {
816 if (!ifaces_config->size()) {
823 std::set<std::string> seen;
824 auto running_ifaces = running_cfg->toElement()->get(
"interfaces");
825 if (running_ifaces && (running_ifaces->getType() ==
Element::list)) {
826 for (
auto const& item : running_ifaces->listValue()) {
827 seen.insert(item->stringValue());
831 for (
auto const& item : ifaces_config->listValue()) {
832 auto const&
str = item->stringValue();
833 if (seen.find(
str) != seen.end()) {
842 running_cfg->update(*cfg_iface);
843 running_cfg->triggerOpenSocketsWithRetry(AF_INET6,
getServerPort());
844 }
catch (
const std::exception& ex) {
849 message =
"unknown error";
859 msg <<
"Updating used interfaces failed: " << message;
868 arguments->set(
"extended", extended);
891 message =
"Missing mandatory 'remove' parameter.";
895 message =
"Missing mandatory 'remove' parameter.";
897 message =
"'remove' parameter expected to be a boolean.";
899 bool remove_lease = remove_name->boolValue();
900 server_->alloc_engine_->reclaimExpiredLeases6(0, 0, remove_lease);
902 message =
"Reclamation of expired leases is complete.";
920 for (
auto const& entry : args->mapValue()) {
921 ostringstream errmsg;
922 if (entry.first ==
"interface") {
924 errmsg <<
"'interface' entry must be a string";
927 selector.
iface_name_ = entry.second->stringValue();
929 }
if (entry.first ==
"interface-id") {
931 errmsg <<
"'interface-id' entry must be a string";
935 string str = entry.second->stringValue();
941 errmsg <<
"'interface-id' must be not empty";
949 errmsg <<
"value of 'interface-id' was not recognized";
952 }
else if (entry.first ==
"remote") {
954 errmsg <<
"'remote' entry must be a string";
958 IOAddress addr(entry.second->stringValue());
960 errmsg <<
"bad 'remote' entry: not IPv6";
965 }
catch (
const exception& ex) {
966 errmsg <<
"bad 'remote' entry: " << ex.what();
969 }
else if (entry.first ==
"link") {
971 errmsg <<
"'link' entry must be a string";
975 IOAddress addr(entry.second->stringValue());
977 errmsg <<
"bad 'link' entry: not IPv6";
982 }
catch (
const exception& ex) {
983 errmsg <<
"bad 'link' entry: " << ex.what();
986 }
else if (entry.first ==
"classes") {
989 "'classes' entry must be a list"));
991 for (
auto const& item : entry.second->listValue()) {
993 errmsg <<
"'classes' entry must be a list of strings";
997 if (!item->stringValue().empty()) {
1003 errmsg <<
"unknown entry '" << entry.first <<
"'";
1008 getCfgSubnets6()->selectSubnet(selector);
1013 subnet->getSharedNetwork(network);
1016 msg <<
"selected shared network '" << network->getName()
1017 <<
"' starting with subnet '" << subnet->toText()
1018 <<
"' id " << subnet->getID();
1020 msg <<
"selected subnet '" << subnet->toText()
1021 <<
"' id " << subnet->getID();
1029 const std::string& tag =
1042 "Illegal operation executing 'config-backend-pull' on a different thread than main thread"));
1063 auto mode = CBControlDHCPv6::FetchMode::FETCH_UPDATE;
1064 server_->getCBControl()->databaseConfigFetch(srv_cfg, mode);
1065 }
catch (
const std::exception& ex) {
1069 "On demand configuration update failed: " +
1070 string(ex.what())));
1073 "On demand configuration update successful."));
1082 auto now = boost::posix_time::second_clock::universal_time();
1084 if (!
start_.is_not_a_date_time()) {
1085 auto uptime = now -
start_;
1090 if (!last_commit.is_not_a_date_time()) {
1091 auto reload = now - last_commit;
1096 if (mt_mgr.getMode()) {
1100 status->set(
"packet-queue-size",
Element::create(
static_cast<int32_t
>(
1103 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(10)));
1104 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(100)));
1105 queue_stats->add(
Element::create(mt_mgr.getThreadPool().getQueueStat(1000)));
1106 status->set(
"packet-queue-statistics", queue_stats);
1118 for (
auto const& entry : lm_info->mapValue()) {
1119 status->set(entry.first, entry.second);
1124 CfgMgr::instance().getCurrentCfg()->getCfgDbAccess()->getExtendedInfoTablesEnabled()));
1129 for (std::string
const&
error : interface->getErrors()) {
1136 if (socket_errors->empty()) {
1141 if (reconnect_ctl && reconnect_ctl->retriesLeft()) {
1146 sockets->set(
"errors", socket_errors);
1148 status->set(
"sockets", sockets);
1186 "no lease backend"));
1198 std::ostringstream err;
1201 err <<
"Server object not initialized, can't process config.";
1218 }
catch (
const std::exception& ex) {
1219 err <<
"Failed to process configuration:" << ex.what();
1229 std::bind(&ControlledDhcpv6Srv::dbLostCallback, srv, ph::_1);
1232 std::bind(&ControlledDhcpv6Srv::dbRecoveredCallback, srv, ph::_1);
1235 std::bind(&ControlledDhcpv6Srv::dbFailedCallback, srv, ph::_1);
1238 string params =
"universe=6";
1239 if (cfg_db->getExtendedInfoTablesEnabled()) {
1240 params +=
" extended-info-tables=true";
1242 cfg_db->setAppendedParameters(params);
1243 cfg_db->createManagers();
1248 }
catch (
const std::exception& ex) {
1249 err <<
"Unable to open database: " << ex.what();
1255 const std::string duid_file =
1257 std::string(SERVER_DUID_FILE);
1262 .arg(duid->toText())
1266 }
catch (
const std::exception& ex) {
1267 err <<
"unable to configure server identifier: " << ex.what();
1274 }
catch (
const std::exception& ex) {
1275 err <<
"Error starting DHCP_DDNS client after server reconfiguration: "
1283 }
catch (
const std::exception& ex) {
1284 err <<
"error starting DHCPv4-over-DHCPv6 IPC "
1285 " after server reconfiguration: " << ex.what();
1298 }
catch (
const std::exception& ex) {
1299 err <<
"Error setting packet queue controls after server reconfiguration: "
1307 std::bind(&ControlledDhcpv6Srv::openSocketsFailedCallback, srv, ph::_1);
1322 setupTimers(&ControlledDhcpv6Srv::reclaimExpiredLeases,
1323 &ControlledDhcpv6Srv::deleteExpiredReclaimedLeases,
1326 }
catch (
const std::exception& ex) {
1327 err <<
"unable to setup timers for periodically running the"
1328 " reclamation of the expired leases: "
1329 << ex.what() <<
".";
1336 long fetch_time =
static_cast<long>(ctl_info->getConfigFetchWaitTime());
1339 if (fetch_time > 0) {
1345 if (!server_->inTestMode()) {
1346 fetch_time = 1000 * fetch_time;
1349 boost::shared_ptr<unsigned> failure_count(
new unsigned(0));
1351 registerTimer(
"Dhcp6CBFetchTimer",
1352 std::bind(&ControlledDhcpv6Srv::cbFetchUpdates,
1366 if (notify_libraries) {
1367 return (notify_libraries);
1376 }
catch (
const std::exception& ex) {
1377 err <<
"Error applying multi threading settings: "
1396 callout_handle->setArgument(
"io_context", srv->
getIOService());
1398 callout_handle->setArgument(
"json_config",
config);
1399 callout_handle->setArgument(
"server_config",
CfgMgr::instance().getStagingCfg());
1408 callout_handle->getArgument(
"error",
error);
1410 error =
"unknown error";
1425 "Server object not initialized, can't process config.");
1436 uint16_t client_port )
1440 "There is another Dhcpv6Srv instance already.");
1581 timer_mgr_->unregisterTimers();
1634ControlledDhcpv6Srv::reclaimExpiredLeases(
const size_t max_leases,
1635 const uint16_t timeout,
1636 const bool remove_lease,
1637 const uint16_t max_unwarned_cycles) {
1640 server_->
alloc_engine_->reclaimExpiredLeases6(max_leases, timeout,
1642 max_unwarned_cycles);
1646 getCfgExpiration()->getReclaimTimerWaitTime());
1648 }
catch (
const std::exception& ex) {
1657ControlledDhcpv6Srv::deleteExpiredReclaimedLeases(
const uint32_t secs) {
1659 server_->alloc_engine_->deleteExpiredReclaimedLeases6(secs);
1667ControlledDhcpv6Srv::dbLostCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1668 if (!db_reconnect_ctl) {
1675 if (db_reconnect_ctl->retriesLeft() == db_reconnect_ctl->maxRetries() &&
1676 db_reconnect_ctl->alterServiceState()) {
1681 .arg(db_reconnect_ctl->id())
1682 .arg(db_reconnect_ctl->timerName());
1686 if (!db_reconnect_ctl->retriesLeft() ||
1687 !db_reconnect_ctl->retryInterval()) {
1688 if (db_reconnect_ctl->exitOnFailure()) {
1690 .arg(db_reconnect_ctl->retriesLeft())
1691 .arg(db_reconnect_ctl->retryInterval())
1692 .arg(db_reconnect_ctl->id())
1693 .arg(db_reconnect_ctl->timerName());
1697 .arg(db_reconnect_ctl->retriesLeft())
1698 .arg(db_reconnect_ctl->retryInterval())
1699 .arg(db_reconnect_ctl->id())
1700 .arg(db_reconnect_ctl->timerName());
1709ControlledDhcpv6Srv::dbRecoveredCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1710 if (!db_reconnect_ctl) {
1717 if (db_reconnect_ctl->retriesLeft() != db_reconnect_ctl->maxRetries() &&
1718 db_reconnect_ctl->alterServiceState()) {
1723 .arg(db_reconnect_ctl->id())
1724 .arg(db_reconnect_ctl->timerName());
1726 db_reconnect_ctl->resetRetries();
1732ControlledDhcpv6Srv::dbFailedCallback(
ReconnectCtlPtr db_reconnect_ctl) {
1733 if (!db_reconnect_ctl) {
1739 if (db_reconnect_ctl->exitOnFailure()) {
1741 .arg(db_reconnect_ctl->maxRetries())
1742 .arg(db_reconnect_ctl->id())
1743 .arg(db_reconnect_ctl->timerName());
1747 .arg(db_reconnect_ctl->maxRetries())
1748 .arg(db_reconnect_ctl->id())
1749 .arg(db_reconnect_ctl->timerName());
1756ControlledDhcpv6Srv::openSocketsFailedCallback(
ReconnectCtlPtr reconnect_ctl) {
1757 if (!reconnect_ctl) {
1763 if (reconnect_ctl->exitOnFailure()) {
1765 .arg(reconnect_ctl->maxRetries());
1769 .arg(reconnect_ctl->maxRetries());
1774ControlledDhcpv6Srv::cbFetchUpdates(
const SrvConfigPtr& srv_cfg,
1775 boost::shared_ptr<unsigned> failure_count) {
1777 MultiThreadingCriticalSection cs;
1781 server_->getCBControl()->databaseConfigFetch(srv_cfg,
1782 CBControlDHCPv6::FetchMode::FETCH_UPDATE);
1783 (*failure_count) = 0;
1785 }
catch (
const std::exception& ex) {
1792 if (++(*failure_count) > 10) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
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 if an unrecoverable error occurs.
A generic exception that is thrown if a function is called in a prohibited way.
The IOAddress class represents an IP addresses (version agnostic).
bool isV6() const
Convenience function to check for an IPv6 address.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
static IOServiceMgr & instance()
Access the IOServiceMgr singleton instance.
size_t pollIOServices()
Poll IOService objects.
Implements an asynchronous "signal" for IOService driven processing.
static void setIOService(isc::asiolink::IOServicePtr io_service)
Set the I/O service.
virtual isc::data::ConstElementPtr processCommand(const isc::data::ConstElementPtr &cmd)
Triggers command processing.
void registerCommand(const std::string &cmd, CommandHandler handler)
Registers specified command handler for a given command.
static std::string getHash(const isc::data::ConstElementPtr &config)
returns a hash of a given Element structure
void deregisterCommand(const std::string &cmd)
Deregisters specified command handler.
static CommandMgr & instance()
CommandMgr is a singleton class.
static std::string DEFAULT_AUTHENTICATION_REALM
Default HTTP authentication realm.
static isc::asiolink::IOAddress DEFAULT_SOCKET_ADDRESS
Default socket address (127.0.0.1).
static std::string SUPPORTED_SERVICE
Supported service.
void closeCommandSockets()
Close http control sockets.
static HttpCommandMgr & instance()
HttpCommandMgr is a singleton class.
void setIOService(const asiolink::IOServicePtr &io_service)
Sets IO service to be used by the http command manager.
static UnixCommandMgr & instance()
UnixCommandMgr is a singleton class.
void setIOService(const asiolink::IOServicePtr &io_service)
Sets IO service to be used by the unix command manager.
void closeCommandSockets()
Shuts down any open unix control sockets.
static ElementPtr create(const Position &pos=ZERO_POSITION())
Create a NullElement.
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
static void setIOService(const isc::asiolink::IOServicePtr &io_service)
Sets IO service to be used by the database backends.
static DbCallback db_recovered_callback_
Optional callback function to invoke if an opened connection recovery succeeded.
static DbCallback db_failed_callback_
Optional callback function to invoke if an opened connection recovery failed.
static DbCallback db_lost_callback_
Optional callback function to invoke if an opened connection is lost.
RAII class to enable DB reconnect retries on server startup.
static const std::string FLUSH_RECLAIMED_TIMER_NAME
Name of the timer for flushing reclaimed leases.
static const std::string RECLAIM_EXPIRED_TIMER_NAME
Name of the timer for reclaiming expired leases.
Represents selection of interfaces for DHCP server.
static OpenSocketsFailedCallback open_sockets_failed_callback_
Optional callback function to invoke if all retries of the opening sockets fail.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
void commit()
Commits the staging configuration.
void clearStagingConfiguration()
Remove staging configuration.
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
static void apply(data::ConstElementPtr value)
apply multi threading configuration
void insert(const ClientClass &class_name)
Insert an element.
Controlled version of the DHCPv6 server.
bool getShutdown() const
Return the server shutdown flag value.
isc::data::ConstElementPtr commandVersionGetHandler(const std::string &command, isc::data::ConstElementPtr args)
@Brief handler for processing 'version-get' command
void init(const std::string &config_file)
Initializes the server.
void cleanup()
Performs cleanup, immediately before termination.
isc::data::ConstElementPtr commandConfigSetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-set' command
isc::data::ConstElementPtr commandInterfaceAddHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-add' command.
isc::data::ConstElementPtr commandInterfaceRedetectHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-redetect' command.
isc::data::ConstElementPtr commandShutdownHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'shutdown' command.
isc::data::ConstElementPtr commandConfigBackendPullHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for config-backend-pull command
isc::data::ConstElementPtr commandLfcStartHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'kea-lfc-start' command
isc::data::ConstElementPtr commandConfigHashGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-hash-get' command
isc::data::ConstElementPtr commandServerTagGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for server-tag-get command
isc::data::ConstElementPtr commandStatisticSetMaxSampleCountAllHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'statistic-sample-count-set-all' command
isc::data::ConstElementPtr commandStatisticSetMaxSampleAgeAllHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'statistic-sample-age-set-all' command
isc::data::ConstElementPtr commandStatusGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'status-get' command
isc::data::ConstElementPtr commandDhcpEnableHandler(const std::string &command, isc::data::ConstElementPtr args)
A handler for processing 'dhcp-enable' command.
isc::data::ConstElementPtr commandConfigReloadHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'config-reload' command.
isc::data::ConstElementPtr commandLeasesReclaimHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'leases-reclaim' command.
isc::data::ConstElementPtr commandConfigWriteHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-write' command
isc::data::ConstElementPtr commandBuildReportHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'build-report' command
static isc::data::ConstElementPtr finishConfigHookLibraries(isc::data::ConstElementPtr config)
Configuration checker for hook libraries.
virtual ~ControlledDhcpv6Srv()
Destructor.
static isc::data::ConstElementPtr processConfig(isc::data::ConstElementPtr config)
Configuration processor.
isc::data::ConstElementPtr commandConfigGetHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-get' command
virtual void shutdownServer(int exit_value)
Initiates shutdown procedure for the whole DHCPv6 server.
static ControlledDhcpv6Srv * getInstance()
Returns pointer to the sole instance of Dhcpv6Srv.
isc::data::ConstElementPtr loadConfigFile(const std::string &file_name)
Configure DHCPv6 server using the configuration file specified.
static isc::data::ConstElementPtr checkConfig(isc::data::ConstElementPtr config)
Configuration checker.
isc::data::ConstElementPtr commandInterfaceListHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'interface-list' command.
isc::data::ConstElementPtr commandSubnet6SelectTestHandler(const std::string &command, isc::data::ConstElementPtr args)
Handler for processing 'subnet6-select-test' command.
ControlledDhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Constructor.
isc::data::ConstElementPtr commandDhcpDisableHandler(const std::string &command, isc::data::ConstElementPtr args)
A handler for processing 'dhcp-disable' command.
isc::data::ConstElementPtr commandConfigTestHandler(const std::string &command, isc::data::ConstElementPtr args)
handler for processing 'config-test' command
virtual void open()
Open communication socket.
static Dhcp6to4Ipc & instance()
Returns pointer to the sole instance of Dhcp6to4Ipc.
void shutdown() override
Instructs the server to shut down.
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
uint16_t getServerPort() const
Get UDP port on which server should listen.
NetworkStatePtr & getNetworkState()
Returns pointer to the network state used by the server.
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
Dhcpv6Srv(uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
Default constructor.
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
volatile bool shutdown_
Indicates if shutdown is in progress.
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
static void create()
Creates new instance of the HostMgr.
size_t size() const
Return the number of interfaces.
const IfaceCollection & getIfaces()
Returns container with all interfaces.
void detectIfaces(bool update_only=false)
Detects network interfaces.
static IfaceMgr & instance()
IfaceMgr is a singleton class.
Parser for the configuration of interfaces.
void parseInterfacesList(const CfgIfacePtr &cfg_iface, isc::data::ConstElementPtr ifaces_list)
parses interfaces-list structure
static TrackingLeaseMgr & instance()
Return current lease manager.
static bool init_allocators_
Flag which indicates if allocators must be initialized.
static void destroy()
Destroy lease manager.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
virtual data::ElementPtr getStatus() const
Return status information.
static void commitRuntimeOptionDefs()
Commits runtime option definitions.
Concrete implementation of a lease database backend using flat file.
static bool isLFCProcessRunning(const std::string file_name, Universe u)
Check if LFC is running.
static const unsigned int DB_CONNECTION
The network state is being altered by the DB connection recovery mechanics.
static const unsigned int USER_COMMAND
Origin of the network state transition.
static const unsigned int HA_REMOTE_COMMAND
The network state is being altered by a "dhcp-disable" or "dhcp-enable" command sent by a HA partner.
Evaluation context, an interface to the expression evaluation.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
@ PARSER_DHCP6
This parser will parse the content as Dhcp6 config wrapped in a map (that's the regular config file).
RAII class creating a critical section for the receiver thread.
Manages a pool of asynchronous interval timers.
static const TimerMgrPtr & instance()
Returns pointer to the sole instance of the TimerMgr.
@ NEXT_STEP_DROP
drop the packet
static int registerHook(const std::string &name)
Register Hook.
static bool calloutsPresent(int index)
Are callouts present?
static boost::shared_ptr< CalloutHandle > createCalloutHandle()
Return callout handle.
static void callCallouts(int index, CalloutHandle &handle)
Calls the callouts for a given hook.
std::string getConfigFile() const
Returns config file name.
virtual size_t writeConfigFile(const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const
Writes current configuration to specified file.
isc::asiolink::IOSignalSetPtr signal_set_
A pointer to the object installing custom signal handlers.
boost::posix_time::ptime start_
Timestamp of the start of the daemon.
void checkWriteConfigFile(std::string &file)
Checks the to-be-written configuration file name.
void setExitValue(int value)
Sets the exit value.
isc::data::ConstElementPtr redactConfig(isc::data::ConstElementPtr const &config)
Redact a configuration.
Statistics Manager class.
static StatsMgr & instance()
Statistics Manager accessor method.
RAII class creating a critical section.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
void apply(bool enabled, uint32_t thread_count, uint32_t queue_size)
Apply the multi-threading related settings.
This file contains several functions and constants that are used for handling commands and responses ...
Defines the Dhcp6to4Ipc class.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
isc::data::ConstElementPtr statisticSetMaxSampleCountAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set-all command.
static isc::data::ConstElementPtr statisticResetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset command.
static isc::data::ConstElementPtr statisticGetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get-all command.
static isc::data::ConstElementPtr statisticRemoveHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove command.
static isc::data::ConstElementPtr statisticGetHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-get command.
static isc::data::ConstElementPtr statisticGlobalGetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-global-get-all command.
isc::data::ConstElementPtr statisticSetMaxSampleAgeAllHandler(const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set-all command.
static isc::data::ConstElementPtr statisticResetAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-reset-all command.
static isc::data::ConstElementPtr statisticSetMaxSampleAgeHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-age-set command.
static isc::data::ConstElementPtr statisticRemoveAllHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-remove-all command.
static isc::data::ConstElementPtr statisticSetMaxSampleCountHandler(const std::string &name, const isc::data::ConstElementPtr ¶ms)
Handles statistic-sample-count-set command.
uint32_t getMaxSampleCountDefault() const
Get default count limit.
const StatsDuration & getMaxSampleAgeDefault() const
Get default duration limit.
#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_FATAL(LOGGER, MESSAGE)
Macro to conveniently test fatal output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns arguments or text status code.
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" }...
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
Creates a standard config/command level answer message.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_COMMAND_UNSUPPORTED
Status code indicating that the specified command is not supported.
const int CONTROL_RESULT_FATAL_ERROR
Status code indicating that the command was unsuccessful and the configuration could not be reverted ...
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
std::string getConfigReport()
const isc::log::MessageID DHCP6_DB_RECONNECT_NO_DB_CTL
const isc::log::MessageID DHCP6_OPEN_SOCKETS_NO_RECONNECT_CTL
const isc::log::MessageID DHCP6_USING_SERVERID
const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
const isc::log::MessageID DHCP6_DB_RECONNECT_SUCCEEDED
isc::data::ConstElementPtr configureDhcp6Server(Dhcpv6Srv &server, isc::data::ConstElementPtr config_set, bool check_only, bool extra_checks)
Configure DHCPv6 server (Dhcpv6Srv) with a set of configuration values.
const isc::log::MessageID DHCP6_RECLAIM_EXPIRED_LEASES_SKIPPED
boost::shared_ptr< CfgDbAccess > CfgDbAccessPtr
A pointer to the CfgDbAccess.
boost::shared_ptr< Iface > IfacePtr
Type definition for the pointer to an Iface object.
boost::shared_ptr< DUID > DuidPtr
const int DBG_DHCP6_COMMAND
Debug level used to log receiving commands.
const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_FAIL
const isc::log::MessageID DHCP6_RECLAIM_EXPIRED_LEASES_FAIL
boost::shared_ptr< CfgIface > CfgIfacePtr
A pointer to the CfgIface .
const isc::log::MessageID DHCP6_OPEN_SOCKETS_FAILED
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS
const isc::log::MessageID DHCP6_CB_ON_DEMAND_FETCH_UPDATES_FAIL
const isc::log::MessageID DHCP6_CB_PERIODIC_FETCH_UPDATES_RETRIES_EXHAUSTED
const isc::log::MessageID DHCP6_NOT_RUNNING
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
const isc::log::MessageID DHCP6_FATAL_OPEN_SOCKETS_FAILED
const isc::log::MessageID DHCP6_FATAL_DB_RECONNECT_DISABLED
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_FAIL
const isc::log::MessageID DHCP6_CONFIG_UNSUPPORTED_OBJECT
const isc::log::MessageID DHCP6_CONFIG_UNRECOVERABLE_ERROR
const isc::log::MessageID DHCP6_FATAL_DB_RECONNECT_FAILED
const isc::log::MessageID DHCP6_CONFIG_RECEIVED
const isc::log::MessageID DHCP6_DB_RECONNECT_DISABLED
const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION
const isc::log::MessageID DHCP6_DB_RECONNECT_LOST_CONNECTION
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_MULTI_THREADING_INFO
const isc::log::MessageID DHCP6_DB_RECONNECT_FAILED
boost::shared_ptr< Option > OptionPtr
const isc::log::MessageID DHCP6_FATAL_DYNAMIC_RECONFIGURATION_FAIL
const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
long toSeconds(const StatsDuration &dur)
Returns the number of seconds in a duration.
void decodeFormattedHexString(const string &hex_string, vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
vector< uint8_t > quotedStringToBinary(const string "ed_string)
Converts a string in quotes into vector.
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.
Subnet selector used to specify parameters used to select a subnet.
std::string iface_name_
Name of the interface on which the message was received.
ClientClasses client_classes_
Classes that the client belongs to.
asiolink::IOAddress remote_address_
Source address of the message.
OptionPtr interface_id_
Interface id option.
asiolink::IOAddress first_relay_linkaddr_
First relay link address.