2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[540-recommend-moving-hostname-char-set-and-hostname-char-replacement-out-of-dhcp-ddns] Checkpoint between DHCPv6 regen

This commit is contained in:
Francis Dupont
2019-06-11 02:10:18 +02:00
parent f0229ae38d
commit 772569640a
16 changed files with 885 additions and 266 deletions

View File

@@ -368,6 +368,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// early.
Dhcp4ConfigParser global_parser;
// D2 client configuration.
D2ClientConfigPtr d2_client_cfg;
// Make parsers grouping.
const std::map<std::string, ConstElementPtr>& values_map =
mutable_cfg->mapValue();
@@ -445,8 +448,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// Apply defaults
D2ClientConfigParser::setAllDefaults(config_pair.second);
D2ClientConfigParser parser;
D2ClientConfigPtr cfg = parser.parse(config_pair.second);
srv_cfg->setD2ClientConfig(cfg);
d2_client_cfg = parser.parse(config_pair.second);
continue;
}
@@ -557,7 +559,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
(config_pair.first == "calculate-tee-times") ||
(config_pair.first == "t1-percent") ||
(config_pair.first == "t2-percent") ||
(config_pair.first == "loggers")) {
(config_pair.first == "loggers") ||
(config_pair.first == "hostname-char-set") ||
(config_pair.first == "hostname-char-replacement")) {
CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
config_pair.second);
@@ -584,6 +588,16 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// defined as part of shared networks.
global_parser.sanityChecks(srv_cfg, mutable_cfg);
// Validate D2 client confuguration.
if (!d2_client_cfg) {
d2_client_cfg.reset(new D2ClientConfig());
d2_client_cfg->setFetchGlobalsFn([]() -> ConstElementPtr {
return (CfgMgr::instance().getStagingCfg()->getConfiguredGlobals());
});
}
d2_client_cfg->validateContents();
srv_cfg->setD2ClientConfig(d2_client_cfg);
} catch (const isc::Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_PARSER_FAIL)
.arg(config_pair.first).arg(ex.what());