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

[#35,!517] Rework kea-dhcp4 parsing and server

src/bin/dhcp4/ctrl_dhcp4_srv.cc
    Removed setting D2ClientCfg fetch function

src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
    ddns-send-updates
    ddns-override-no-update
    ddns-override-client-update
    ddns-replace-client-name
    ddns-generated-prefix
    ddns-qualifying-suffix
        - added to DHCP4,SHARED_NETWORK,SUBNET4

    hostname-char-set
    hostname-char-replacement
        - added to SHARED_NETWORK,SUBNET4

src/bin/dhcp4/dhcp4_srv.cc

    Dhcpv4Srv::processClientFqdnOption()
    Dhcpv4Srv::processHostnameOption()
    Dhcpv4Srv::assignLease()
        Use scoped DdnsParams from context to make decisions, pass
        into D2ClientMgr functions, and supply hostname sanitizer

src/bin/dhcp4/json_config_parser.cc
    configureDhcp4Server()
    - use SrvConfig::moveDdnsParams() to move dhcp-ddns parameters
    - handle new "ddns-" globals

src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/d2_unittest.cc
src/bin/dhcp4/tests/dhcp4_test_utils.cc
src/bin/dhcp4/tests/fqdn_unittest.cc
src/bin/dhcp4/tests/get_config_unittest.cc
    Updated and new tests
This commit is contained in:
Thomas Markwalder
2019-10-03 15:11:07 -04:00
parent 77cfe4bc79
commit 256feda606
16 changed files with 7586 additions and 7298 deletions

View File

@@ -350,6 +350,12 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// default values and will insert derived values as well.
mutable_cfg = boost::const_pointer_cast<Element>(config_set);
// Relocate dhcp-ddns parameters that have moved to global scope.
// Rule is that a global value overrides the dhcp-ddns value, so
// we need to do this before we apply global defaults.
// Note this is done for backward compatibilty.
srv_cfg->moveDdnsParams(mutable_cfg);
// Set all default values if not specified by the user.
SimpleParser4::setAllDefaults(mutable_cfg);
@@ -563,8 +569,13 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
(config_pair.first == "t2-percent") ||
(config_pair.first == "loggers") ||
(config_pair.first == "hostname-char-set") ||
(config_pair.first == "hostname-char-replacement")) {
(config_pair.first == "hostname-char-replacement") ||
(config_pair.first == "ddns-send-updates") ||
(config_pair.first == "ddns-override-no-update") ||
(config_pair.first == "ddns-override-client-update") ||
(config_pair.first == "ddns-replace-client-name") ||
(config_pair.first == "ddns-generated-prefix") ||
(config_pair.first == "ddns-qualifying-suffix")) {
CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
config_pair.second);
continue;
@@ -593,9 +604,6 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
// 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);