LOG_DEBUG(dhcp4_logger, DBG_DHCP4_COMMAND, DHCP4_CONFIG_RECEIVED)
.arg(srv->redactConfig(config)->str());
+ // Destroy lease manager before hooks unload.
+ LeaseMgrFactory::destroy();
+
+ // Destroy host manager before hooks unload.
+ HostMgr::create();
+
ConstElementPtr answer = configureDhcp4Server(*srv, config);
// Check that configuration was successful. If not, do not reopen sockets
#include <dhcpsrv/dhcpsrv_exceptions.h>
#include <dhcpsrv/fuzz.h>
#include <dhcpsrv/host_data_source_factory.h>
+#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/lease_mgr.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/ncr_generator.h>
} catch (const std::exception &e) {
LOG_ERROR(dhcp4_logger, DHCP4_SRV_CONSTRUCT_ERROR).arg(e.what());
- shutdown_ = true;
return;
}
// Initializing all observations with default value
setPacketStatisticsDefaults();
+
+ // All done, so can proceed
shutdown_ = false;
}
// so we should clean up after ourselves.
LeaseMgrFactory::destroy();
+ // Destroy the host manager before hooks unload.
+ HostMgr::create();
+
// Explicitly unload hooks
HooksManager::prepareUnloadLibraries();
if (!HooksManager::unloadLibraries()) {
#include <dhcpsrv/parsers/shared_networks_list_parser.h>
#include <dhcpsrv/parsers/sanity_checks_parser.h>
#include <dhcpsrv/host_data_source_factory.h>
+#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/timer_mgr.h>
#include <hooks/hooks_manager.h>
#include <hooks/hooks_parser.h>
if (status_code == CONTROL_RESULT_SUCCESS) {
if (check_only) {
if (extra_checks) {
- // Re-open lease and host database with new parameters.
+ std::ostringstream err;
+ // Configure DHCP packet queueing
try {
- // Get the staging configuration.
- srv_config = CfgMgr::instance().getStagingCfg();
+ data::ConstElementPtr qc;
+ qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl();
+ if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET, qc)) {
+ LOG_INFO(dhcp4_logger, DHCP4_CONFIG_PACKET_QUEUE)
+ .arg(IfaceMgr::instance().getPacketQueue4()->getInfoStr());
+ }
- CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
- string params = "universe=4 persist=false";
- cfg_db->setAppendedParameters(params);
- cfg_db->createManagers();
} catch (const std::exception& ex) {
- answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
+ err << "Error setting packet queue controls after server reconfiguration: "
+ << ex.what();
+ answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str());
status_code = CONTROL_RESULT_ERROR;
}
-
- if (status_code == CONTROL_RESULT_SUCCESS) {
- std::ostringstream err;
- // Configure DHCP packet queueing
- try {
- data::ConstElementPtr qc;
- qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl();
- if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET, qc)) {
- LOG_INFO(dhcp4_logger, DHCP4_CONFIG_PACKET_QUEUE)
- .arg(IfaceMgr::instance().getPacketQueue4()->getInfoStr());
- }
-
- } catch (const std::exception& ex) {
- err << "Error setting packet queue controls after server reconfiguration: "
- << ex.what();
- answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str());
- status_code = CONTROL_RESULT_ERROR;
- }
- }
}
} else {
// disable multi-threading (it will be applied by new configuration)
" parsing error");
status_code = CONTROL_RESULT_ERROR;
}
+
+ if (extra_checks && status_code == CONTROL_RESULT_SUCCESS) {
+ // Re-open lease and host database with new parameters.
+ try {
+ // Get the staging configuration.
+ srv_config = CfgMgr::instance().getStagingCfg();
+
+ CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
+ string params = "universe=4 persist=false";
+ cfg_db->setAppendedParameters(params);
+ cfg_db->createManagers();
+ } catch (const std::exception& ex) {
+ answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
+ status_code = CONTROL_RESULT_ERROR;
+ }
+ }
}
// Log the list of known backends.
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_COMMAND, DHCP6_CONFIG_RECEIVED)
.arg(srv->redactConfig(config)->str());
+ // Destroy lease manager before hooks unload.
+ LeaseMgrFactory::destroy();
+
+ // Destroy host manager before hooks unload.
+ HostMgr::create();
+
ConstElementPtr answer = configureDhcp6Server(*srv, config);
// Check that configuration was successful. If not, do not reopen sockets
#include <dhcpsrv/cfg_host_operations.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/host_data_source_factory.h>
+#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/lease_mgr.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/ncr_generator.h>
LOG_ERROR(dhcp6_logger, DHCP6_SRV_CONSTRUCT_ERROR).arg(e.what());
return;
}
+
// Initializing all observations with default value
setPacketStatisticsDefaults();
IfaceMgr::instance().closeSockets();
+ // The lease manager was instantiated during DHCPv6Srv configuration,
+ // so we should clean up after ourselves.
LeaseMgrFactory::destroy();
+ // Destroy the host manager before hooks unload.
+ HostMgr::create();
+
// Explicitly unload hooks
HooksManager::prepareUnloadLibraries();
if (!HooksManager::unloadLibraries()) {
#include <dhcpsrv/parsers/shared_networks_list_parser.h>
#include <dhcpsrv/parsers/sanity_checks_parser.h>
#include <dhcpsrv/host_data_source_factory.h>
+#include <dhcpsrv/host_mgr.h>
#include <dhcpsrv/pool.h>
#include <dhcpsrv/subnet.h>
#include <dhcpsrv/timer_mgr.h>
if (status_code == CONTROL_RESULT_SUCCESS) {
if (check_only) {
if (extra_checks) {
- // Re-open lease and host database with new parameters.
+ std::ostringstream err;
+ // Configure DHCP packet queueing
try {
- // Get the staging configuration.
- srv_config = CfgMgr::instance().getStagingCfg();
-
- CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
- string params = "universe=6 persist=false";
- // The "extended-info-tables" has no effect on -T command
- // line parameter so it is omitted on purpose.
- // Note that in this case, the current code creates managers
- // before hooks are loaded, so it can not be activated by
- // the BLQ hook.
- cfg_db->setAppendedParameters(params);
- cfg_db->createManagers();
+ data::ConstElementPtr qc;
+ qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl();
+ if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET6, qc)) {
+ LOG_INFO(dhcp6_logger, DHCP6_CONFIG_PACKET_QUEUE)
+ .arg(IfaceMgr::instance().getPacketQueue6()->getInfoStr());
+ }
+
} catch (const std::exception& ex) {
- answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
+ err << "Error setting packet queue controls after server reconfiguration: "
+ << ex.what();
+ answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str());
status_code = CONTROL_RESULT_ERROR;
}
-
- if (status_code == CONTROL_RESULT_SUCCESS) {
- std::ostringstream err;
- // Configure DHCP packet queueing
- try {
- data::ConstElementPtr qc;
- qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl();
- if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET6, qc)) {
- LOG_INFO(dhcp6_logger, DHCP6_CONFIG_PACKET_QUEUE)
- .arg(IfaceMgr::instance().getPacketQueue6()->getInfoStr());
- }
-
- } catch (const std::exception& ex) {
- err << "Error setting packet queue controls after server reconfiguration: "
- << ex.what();
- answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str());
- status_code = CONTROL_RESULT_ERROR;
- }
- }
}
} else {
// disable multi-threading (it will be applied by new configuration)
" parsing error");
status_code = CONTROL_RESULT_ERROR;
}
+
+ if (extra_checks && status_code == CONTROL_RESULT_SUCCESS) {
+ // Re-open lease and host database with new parameters.
+ try {
+ // Get the staging configuration.
+ srv_config = CfgMgr::instance().getStagingCfg();
+
+ CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess();
+ string params = "universe=6 persist=false";
+ if (cfg_db->getExtendedInfoTablesEnabled()) {
+ params += " extended-info-tables=true";
+ }
+ cfg_db->setAppendedParameters(params);
+ cfg_db->createManagers();
+ } catch (const std::exception& ex) {
+ answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
+ status_code = CONTROL_RESULT_ERROR;
+ }
+ }
}
// Log the list of known backends.