From: Thomas Markwalder Date: Wed, 9 Oct 2019 19:08:19 +0000 (-0400) Subject: [#35,!517] Addressed review comments X-Git-Tag: tmark-post-35-refactor~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cfc5d3fd38067b2fa03f4c6182d5646d5a39f34;p=thirdparty%2Fkea.git [#35,!517] Addressed review comments Addressed a myriad of minor typos and wording issues. modified: ChangeLog doc/examples/kea4/all-keys.json doc/examples/kea6/all-keys.json doc/sphinx/arm/dhcp4-srv.rst doc/sphinx/arm/dhcp6-srv.rst src/bin/dhcp4/dhcp4_srv.cc src/bin/dhcp4/tests/config_parser_unittest.cc src/bin/dhcp4/tests/fqdn_unittest.cc src/bin/dhcp6/tests/config_parser_unittest.cc src/bin/dhcp6/tests/d2_unittest.cc src/bin/dhcp6/tests/fqdn_unittest.cc src/lib/dhcpsrv/alloc_engine.cc src/lib/dhcpsrv/alloc_engine.h src/lib/dhcpsrv/d2_client_cfg.h src/lib/dhcpsrv/parsers/base_network_parser.cc src/lib/dhcpsrv/srv_config.h --- diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index e620874587..8ead75e037 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -99,6 +99,7 @@ }, // Specifies a prefix to be prepended to the generated Client FQDN. + // It may be specified at the global, shared-network and subnet levels. "ddns-generated-prefix": "myhost", // Boolean flag indicating that server should ignore DHCP client @@ -106,18 +107,21 @@ // the server will send DNS updates for both forward and // reverse DNS data. The default value is false, which indicates // that the server will delegate DNS update to the client when - // requested. + // requested. It may be specified at the global, shared-network + // and subnet levels. "ddns-override-client-update": false, // Boolean flag indicating that the server should override DHCP // client's wish to not update the DNS. With this parameter // set to true the server will send DNS update even when - // the client requested no update. + // the client requested no update. It may be specified at the + // global, shared-network and subnet levels. "ddns-override-no-update": false, // Suffix appended to the partial name sent to the DNS. The // default value is an empty string which indicates that no - // suffix is appended. + // suffix is appended. It may be specified at the global, + // shared-network and subnet levels. "ddns-qualifying-suffix": "", // Enumeration specifying whether the server should honor @@ -128,14 +132,15 @@ // sent, but do not generate one when the client didn't sent // the name), "when-not-present" (generate the name when // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // client sent). The default value is "never". It may be + // specified at the global, shared-network and subnet levels. "ddns-replace-client-name": "never", // Boolean flag which enables or disables the DDNS updating. It // defaults to true. It may be specified at the global, shared- // network and subnet levels. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns.. + // dhcp-ddns:enable-updates which must be true to enable connectivity + // to kea-dhcp-ddns. "ddns-send-updates": true, // Time in seconds specifying how long a declined lease should be @@ -177,7 +182,20 @@ "server-ip": "127.0.0.1", // Port number on which D2 listens for NCRs. - "server-port": 53001 + "server-port": 53001, + + // The follow parameters are DEPRECATED. They have been + // replaced with parameters that may be set at the global, + // shared-network, and subnet4 scopes. They are listed here + // as configuration parsing still accepts them. Eventually + // support for them will be removed. + "generated-prefix": "myhost", + "hostname-char-replacement": "x", + "hostname-char-set": "[^A-Za-z0-9.-]", + "override-client-update": false, + "override-no-update": false, + "qualifying-suffix": "", + "replace-client-name": "never" }, // Specifies the first of the two consecutive ports of the UDP @@ -520,53 +538,28 @@ // empty string is provided, no restriction is applied. "client-class": "", - // Specifies a prefix to be prepended to the generated Client FQDN. + // Shared network level value. See description at the global level. "ddns-generated-prefix": "myhost", - // Boolean flag indicating that server should ignore DHCP client - // wishes to update DNS on its own. With that flag set to true - // the server will send DNS updates for both forward and - // reverse DNS data. The default value is false, which indicates - // that the server will delegate DNS update to the client when - // requested. + // Shared network level value. See description at the global level. "ddns-override-client-update": false, - // Boolean flag indicating that the server should override DHCP - // client's wish to not update the DNS. With this parameter - // set to true the server will send DNS update even when - // the client requested no update. + // Shared network level value. See description at the global level. "ddns-override-no-update": false, - // Suffix appended to the partial name sent to the DNS. The - // default value is an empty string which indicates that no - // suffix is appended. + // Shared network level value. See description at the global level. "ddns-qualifying-suffix": "", - // Enumeration specifying whether the server should honor - // hostname or Client FQDN sent by the client or replace - // this name. The acceptable values are: "never" (use the - // name the client sent), "always" (replace the name the - // client sent), "when-present" (replace the name the client - // sent, but do not generate one when the client didn't sent - // the name), "when-not-present" (generate the name when - // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // Shared network level value. See description at the global level. "ddns-replace-client-name": "never", - // Boolean flag which enables or disables DDNS updating for - // subnets in this network. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns. The default value is "true". + // Shared network level value. See description at the global level. "ddns-send-updates": true, - // String of zero or more characters with which to replace each - // invalid character in the hostname or Client FQDN. The default - // value is an empty string which will cause invalid characters - // to be omitted rather than replaced. + // Shared network level value. See description at the global level. "hostname-char-replacement": "x", - // Regular expression describing the invalid character set in - // the hostname or Client FQDN. + // Shared network level value. See description at the global level. "hostname-char-set": "[^A-Za-z0-9.-]", // Specifies that this shared network is selected for the @@ -640,53 +633,28 @@ // provided, no restriction is applied. "client-class": "", - // Specifies a prefix to be prepended to the generated Client FQDN. + // Subnet level value. See description at the global level. "ddns-generated-prefix": "myhost", - // Boolean flag indicating that server should ignore DHCP client - // wishes to update DNS on its own. With that flag set to true - // the server will send DNS updates for both forward and - // reverse DNS data. The default value is false, which indicates - // that the server will delegate DNS update to the client when - // requested. + // Subnet level value. See description at the global level. "ddns-override-client-update": false, - // Boolean flag indicating that the server should override DHCP - // client's wish to not update the DNS. With this parameter - // set to true the server will send DNS update even when - // the client requested no update. + // Subnet level value. See description at the global level. "ddns-override-no-update": false, - // Suffix appended to the partial name sent to the DNS. The - // default value is an empty string which indicates that no - // suffix is appended. + // Subnet level value. See description at the global level. "ddns-qualifying-suffix": "", - // Enumeration specifying whether the server should honor - // hostname or Client FQDN sent by the client or replace - // this name. The acceptable values are: "never" (use the - // name the client sent), "always" (replace the name the - // client sent), "when-present" (replace the name the client - // sent, but do not generate one when the client didn't sent - // the name), "when-not-present" (generate the name when - // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // Subnet level value. See description at the global level. "ddns-replace-client-name": "never", - // Boolean flag which enables or disables DDNS updating for - // subnets in this network. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns. The default value is "true". + // Subnet level value. See description at the global level. "ddns-send-updates": true, - // String of zero or more characters with which to replace each - // invalid character in the hostname or Client FQDN. The default - // value is an empty string which will cause invalid characters - // to be omitted rather than replaced. + // Subnet level value. See description at the global level. "hostname-char-replacement": "x", - // Regular expression describing the invalid character set in - // the hostname or Client FQDN. + // Subnet level value. See description at the global level. "hostname-char-set": "[^A-Za-z0-9.-]", // Subnet unique identifier. diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 513e20d0cb..a5e5bb65f7 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -64,6 +64,7 @@ }, // Specifies a prefix to be prepended to the generated Client FQDN. + // It may be specified at the global, shared-network and subnet levels. "ddns-generated-prefix": "myhost", // Boolean flag indicating that server should ignore DHCP client @@ -71,18 +72,21 @@ // the server will send DNS updates for both forward and // reverse DNS data. The default value is false, which indicates // that the server will delegate DNS update to the client when - // requested. + // requested. It may be specified at the global, shared-network + // and subnet levels. "ddns-override-client-update": false, // Boolean flag indicating that the server should override DHCP // client's wish to not update the DNS. With this parameter // set to true the server will send DNS update even when - // the client requested no update. + // the client requested no update. It may be specified at the + // global, shared-network and subnet levels. "ddns-override-no-update": false, // Suffix appended to the partial name sent to the DNS. The // default value is an empty string which indicates that no - // suffix is appended. + // suffix is appended. It may be specified at the global, + // shared-network and subnet levels. "ddns-qualifying-suffix": "", // Enumeration specifying whether the server should honor @@ -93,14 +97,15 @@ // sent, but do not generate one when the client didn't sent // the name), "when-not-present" (generate the name when // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // client sent). The default value is "never". It may be + // specified at the global, shared-network and subnet levels. "ddns-replace-client-name": "never", // Boolean flag which enables or disables the DDNS updating. It // defaults to true. It may be specified at the global, shared- // network and subnet levels. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns.. + // dhcp-ddns:enable-updates which must be true to enable connectivity + // to kea-dhcp-ddns. "ddns-send-updates": true, // Time in seconds specifying how long a declined lease should be @@ -141,7 +146,20 @@ "server-ip": "::1", // Port number on which D2 listens for NCRs. - "server-port": 53001 + "server-port": 53001, + + // The follow parameters are DEPRECATED. They have been + // replaced with parameters that may be set at the global, + // shared-network, and subnet6 scopes. They are listed here + // as configuration parsing still accepts them. Eventually + // support for them will be removed. + "generated-prefix": "myhost", + "hostname-char-replacement": "x", + "hostname-char-set": "[^A-Za-z0-9.-]", + "override-client-update": false, + "override-no-update": false, + "qualifying-suffix": "", + "replace-client-name": "never" }, // Specifies the first of the two consecutive ports of the UDP @@ -473,53 +491,28 @@ // empty string is provided, no restriction is applied. "client-class": "", - // Specifies a prefix to be prepended to the generated Client FQDN. + // Shared network level value. See description at the global level. "ddns-generated-prefix": "myhost", - // Boolean flag indicating that server should ignore DHCP client - // wishes to update DNS on its own. With that flag set to true - // the server will send DNS updates for both forward and - // reverse DNS data. The default value is false, which indicates - // that the server will delegate DNS update to the client when - // requested. + // Shared network level value. See description at the global level. "ddns-override-client-update": false, - // Boolean flag indicating that the server should override DHCP - // client's wish to not update the DNS. With this parameter - // set to true the server will send DNS update even when - // the client requested no update. + // Shared network level value. See description at the global level. "ddns-override-no-update": false, - // Suffix appended to the partial name sent to the DNS. The - // default value is an empty string which indicates that no - // suffix is appended. + // Shared network level value. See description at the global level. "ddns-qualifying-suffix": "", - // Enumeration specifying whether the server should honor - // hostname or Client FQDN sent by the client or replace - // this name. The acceptable values are: "never" (use the - // name the client sent), "always" (replace the name the - // client sent), "when-present" (replace the name the client - // sent, but do not generate one when the client didn't sent - // the name), "when-not-present" (generate the name when - // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // Shared network level value. See description at the global level. "ddns-replace-client-name": "never", - // Boolean flag which enables or disables DDNS updating for - // subnets in this network. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns. The default value is "true". + // Shared network level value. See description at the global level. "ddns-send-updates": true, - // String of zero or more characters with which to replace each - // invalid character in the Client FQDN. The default - // value is an empty string which will cause invalid characters - // to be omitted rather than replaced. + // Shared network level value. See description at the global level. "hostname-char-replacement": "x", - // Regular expression describing the invalid character set in - // the Client FQDN. + // Shared network level value. See description at the global level. "hostname-char-set": "[^A-Za-z0-9.-]", // Specifies that this shared network is selected for the @@ -588,53 +581,28 @@ // provided, no restriction is applied. "client-class": "", - // Specifies a prefix to be prepended to the generated Client FQDN. + // Subnet level value. See description at the global level. "ddns-generated-prefix": "myhost", - // Boolean flag indicating that server should ignore DHCP client - // wishes to update DNS on its own. With that flag set to true - // the server will send DNS updates for both forward and - // reverse DNS data. The default value is false, which indicates - // that the server will delegate DNS update to the client when - // requested. + // Subnet level value. See description at the global level. "ddns-override-client-update": false, - // Boolean flag indicating that the server should override DHCP - // client's wish to not update the DNS. With this parameter - // set to true the server will send DNS update even when - // the client requested no update. + // Subnet level value. See description at the global level. "ddns-override-no-update": false, - // Suffix appended to the partial name sent to the DNS. The - // default value is an empty string which indicates that no - // suffix is appended. + // Subnet level value. See description at the global level. "ddns-qualifying-suffix": "", - // Enumeration specifying whether the server should honor - // hostname or Client FQDN sent by the client or replace - // this name. The acceptable values are: "never" (use the - // name the client sent), "always" (replace the name the - // client sent), "when-present" (replace the name the client - // sent, but do not generate one when the client didn't sent - // the name), "when-not-present" (generate the name when - // client didn't send one, otherwise leave the name the - // client sent). The default value is "never". + // Subnet level value. See description at the global level. "ddns-replace-client-name": "never", - // Boolean flag which enables or disables DDNS updating for - // subnets in this network. It works in conjunction with - // dhcp-ddns:enable-updates which must be true enable connectivity - // kea-dhcp-ddns. The default value is "true". + // Subnet level value. See description at the global level. "ddns-send-updates": true, - // String of zero or more characters with which to replace each - // invalid character in the Client FQDN. The default - // value is an empty string which will cause invalid characters - // to be omitted rather than replaced. + // Subnet level value. See description at the global level. "hostname-char-replacement": "x", - // Regular expression describing the invalid character set in - // the or Client FQDN. + // Subnet level value. See description at the global level. "hostname-char-set": "[^A-Za-z0-9.-]", // Subnet unique identifier. diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index d716301376..d193859a57 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -2812,7 +2812,7 @@ NCRs. Each NCR contains the following information: (information identifying the client associated with the FQDN) Prior to Kea 1.7.1, all parameters for controlling DDNS were within the -global, ``dhcp-ddns`` section of the kea-dhcp4. Beginning with Kea 1.7.1 +global ``dhcp-ddns`` section of the kea-dhcp4. Beginning with Kea 1.7.1 DDNS related parameters were split into two groups: 1. Connectivity Parameters @@ -2856,7 +2856,7 @@ DDNS related parameters were split into two groups: parameter is specified both globally and in ``dhcp-ddns``, the latter value will be ignored. In either case, a log will be emitted explaining what has occurred. Specifying these values within ``dhcp-ddns`` is - deprecated and support for it may be removed at some future date. + deprecated and support for it will be removed at some future date. The default configuration would appear as follows: @@ -2897,22 +2897,22 @@ together: .. table:: Enabling and Disabling DDNS Updates - +-----------------+--------------------+------------------------------+ - | dhcp-ddns: | Global | Outcome | - | enable-updates | ddns-send-udpates | | - +=================+====================+==============================+ - | false (default) | false | no updates at any scope | - +-----------------+--------------------+------------------------------+ - | false | true (default) | no updates at any scope | - +-----------------+--------------------+------------------------------+ - | true | false | updates only at scopes with | - | | | a local value of true for | - | | | ddns-enable-updates | - +-----------------+--------------------+------------------------------+ - | true | true | updates at all scopes except | - | | | those with a local value of | - | | | false for ddns-enble-updates | - +-----------------+--------------------+------------------------------+ + +-----------------+--------------------+-------------------------------+ + | dhcp-ddns: | Global | Outcome | + | enable-updates | ddns-send-udpates | | + +=================+====================+===============================+ + | false (default) | false | no updates at any scope | + +-----------------+--------------------+-------------------------------+ + | false | true (default) | no updates at any scope | + +-----------------+--------------------+-------------------------------+ + | true | false | updates only at scopes with | + | | | a local value of true for | + | | | ddns-enable-updates | + +-----------------+--------------------+-------------------------------+ + | true | true | updates at all scopes except | + | | | those with a local value of | + | | | false for ddns-enable-updates | + +-----------------+--------------------+-------------------------------+ .. _dhcpv4-d2-io-config: diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index 34929daf2b..17702a997c 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -2566,13 +2566,13 @@ NCR contains the following information: (information identifying the client associated with the FQDN) Prior to Kea 1.7.1, all parameters for controlling DDNS were within the -global, ``dhcp-ddns`` section of the kea-dhcp6. Beginning with Kea 1.7.1 +global ``dhcp-ddns`` section of the kea-dhcp6. Beginning with Kea 1.7.1 DDNS related parameters were split into two groups: 1. Connectivity Parameters - These are parameters which specify where and how kea-dhcp4 connects to + These are parameters which specify where and how kea-dhcp6 connects to and communicates with D2. These parameters can only be specified - within the top-level ``dhcp-ddns`` section in the kea-dhcp4 + within the top-level ``dhcp-ddns`` section in the kea-dhcp6 configuration. The connectivity parameters are listed below: - ``enable-updates`` @@ -2608,9 +2608,9 @@ DDNS related parameters were split into two groups: the original behavioral parameters specified in ``dhcp-ddns``. It will do so by translating the parameter into its global equivalent. If a parameter is specified both globally and in ``dhcp-ddns``, the latter - value will be ignored. In either case, a log will be emitted explaining what - has occurred. Specifying these values within ``dhcp-ddns`` is deprecated - and support for it may be removed at some future date. + value will be ignored. In either case, a log will be emitted explaining + what has occurred. Specifying these values within ``dhcp-ddns`` is + deprecated and support for it will be removed at some future date. The default configuration and values would appear as follows: @@ -2651,22 +2651,22 @@ together: .. table:: Enabling and Disabling DDNS Updates - +-----------------+--------------------+------------------------------+ - | dhcp-ddns: | Global | Outcome | - | enable-updates | ddns-send-udpates | | - +=================+====================+==============================+ - | false (default) | false | no updates at any scope | - +-----------------+--------------------+------------------------------+ - | false | true (default) | no updates at any scope | - +-----------------+--------------------+------------------------------+ - | true | false | updates only at scopes with | - | | | a local value of true for | - | | | ddns-enable-updates | - +-----------------+--------------------+------------------------------+ - | true | true | updates at all scopes except | - | | | those with a local value of | - | | | false for ddns-enble-updates | - +-----------------+--------------------+------------------------------+ + +-----------------+--------------------+-------------------------------+ + | dhcp-ddns: | Global | Outcome | + | enable-updates | ddns-send-udpates | | + +=================+====================+===============================+ + | false (default) | false | no updates at any scope | + +-----------------+--------------------+-------------------------------+ + | false | true (default) | no updates at any scope | + +-----------------+--------------------+-------------------------------+ + | true | false | updates only at scopes with | + | | | a local value of true for | + | | | ddns-enable-updates | + +-----------------+--------------------+-------------------------------+ + | true | true | updates at all scopes except | + | | | those with a local value of | + | | | false for ddns-enable-updates | + +-----------------+--------------------+-------------------------------+ .. _dhcpv6-d2-io-config: @@ -2674,7 +2674,7 @@ DHCP-DDNS Server Connectivity ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For NCRs to reach the D2 server, kea-dhcp6 must be able to communicate -with it. kea-dhcp4 uses the following configuration parameters to +with it. kea-dhcp6 uses the following configuration parameters to control this communication: - ``enable-updates`` - As of Kea 1.7.1, this parameter only enables diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index e5dfbedddc..456c6d9d89 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1799,8 +1799,9 @@ Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) { // send back a hostname option, send this option with a reserved // name for this client. if (should_send_hostname) { - std::string hostname = d2_mgr.qualifyName(ctx->currentHost()->getHostname(), - *(ex.getContext()->getDdnsParams()), false); + std::string hostname = + d2_mgr.qualifyName(ctx->currentHost()->getHostname(), + *(ex.getContext()->getDdnsParams()), false); // Convert hostname to lower case. boost::algorithm::to_lower(hostname); @@ -1823,8 +1824,8 @@ Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) { // hostname option to this client if the client has included hostname option // but there is no reservation, or the configuration of the server requires // that we send the option regardless. - D2ClientConfig::ReplaceClientNameMode replace_name_mode - = ex.getContext()->getDdnsParams()->replace_client_name_mode_; + D2ClientConfig::ReplaceClientNameMode replace_name_mode = + ex.getContext()->getDdnsParams()->replace_client_name_mode_; // If we don't have a hostname then either we'll supply it or do nothing. if (!opt_hostname) { @@ -1898,8 +1899,8 @@ Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) { opt_hostname_resp.reset(new OptionString(Option::V4, DHO_HOST_NAME, ".")); } else { // Sanitize the name the client sent us, if we're configured to do so. - isc::util::str::StringSanitizerPtr sanitizer - = ex.getContext()->getDdnsParams()->getHostnameSanitizer(); + isc::util::str::StringSanitizerPtr sanitizer = + ex.getContext()->getDdnsParams()->getHostnameSanitizer(); if (sanitizer) { hostname = sanitizer->scrub(hostname); @@ -2292,7 +2293,6 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { // Set T1 and T2 per configuration. setTeeTimes(lease, subnet, resp); - // Create NameChangeRequests if DDNS is enabled and this is a // real allocation. if (!fake_allocation && (ex.getContext()->getDdnsParams()->enable_updates_)) { diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index e2d3011c78..2b16276806 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -4289,7 +4289,6 @@ TEST_F(Dhcp4ParserTest, d2ClientConfigValid) { // The following, deprecated dhcp-ddns parameters, // should all have global default values. - checkGlobal("ddns-send-updates", true); checkGlobal("ddns-override-no-update", false); checkGlobal("ddns-override-client-update", false); checkGlobal("ddns-replace-client-name", "never"); diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc index 047964ef44..1560db92e7 100644 --- a/src/bin/dhcp4/tests/fqdn_unittest.cc +++ b/src/bin/dhcp4/tests/fqdn_unittest.cc @@ -2106,7 +2106,7 @@ TEST_F(NameDhcpv4SrvTest, sanitizeFqdnGlobal) { } } -// Verifies that socped ddns-parameter handling. +// Verifies that scoped ddns-parameter handling. // Specifically that D2 can be enabled with sending updates // disabled globally, and enabled at the subnet level. TEST_F(NameDhcpv4SrvTest, ddnsScopeTest) { @@ -2120,7 +2120,8 @@ TEST_F(NameDhcpv4SrvTest, ddnsScopeTest) { // Include the Client FQDN option. ASSERT_NO_THROW(client1.includeFQDN((Option4ClientFqdn::FLAG_S | Option4ClientFqdn::FLAG_E), - "client1.example.org.", Option4ClientFqdn::FULL)); + "client1.example.org.", + Option4ClientFqdn::FULL)); // Now send the DHCPREQUEST with including the FQDN option. ASSERT_NO_THROW(client1.doDORA()); @@ -2144,7 +2145,8 @@ TEST_F(NameDhcpv4SrvTest, ddnsScopeTest) { // Include the Client FQDN option. ASSERT_NO_THROW(client2.includeFQDN((Option4ClientFqdn::FLAG_S | Option4ClientFqdn::FLAG_E), - "two.example.org.", Option4ClientFqdn::FULL)); + "two.example.org.", + Option4ClientFqdn::FULL)); ASSERT_NO_THROW(client2.doDORA()); resp = client2.getContext().response_; diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 17d12797f9..fca45ccf9f 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -4781,9 +4781,8 @@ TEST_F(Dhcp6ParserTest, classifyPdPools) { EXPECT_TRUE (pools.at(3)->clientSupported(classes)); } -// This test checks the ability of the server to parse a configuration -// containing a full, valid dhcp-ddns (D2ClientConfig) entry. -TEST_F(Dhcp6ParserTest, d2ClientConfig) { +// This test verifies that valid d2CliengConfig works correctly. +TEST_F(Dhcp6ParserTest, d2ClientConfigValid) { // Verify that the D2 configuration can be fetched and is set to disabled. D2ClientConfigPtr d2_client_config = CfgMgr::instance().getD2ClientConfig(); EXPECT_FALSE(d2_client_config->getEnableUpdates()); @@ -4808,15 +4807,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) { " \"max-queue-size\" : 2048, " " \"ncr-protocol\" : \"UDP\", " " \"ncr-format\" : \"JSON\"}, " -#if 0 - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\", " - " \"hostname-char-set\" : \"[^A-Za-z0-9_-]\", " - " \"hostname-char-replacement\" : \"x\" }, " -#endif "\"valid-lifetime\": 4000 }"; // Convert the JSON string to configuration elements. @@ -4853,7 +4843,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) { // The following, deprecated dhcp-ddns parameters, // should all have global default values. - checkGlobal("ddns-send-updates", true); checkGlobal("ddns-override-no-update", false); checkGlobal("ddns-override-client-update", false); checkGlobal("ddns-replace-client-name", "never"); diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc index 68875f9f2e..6a20774da8 100644 --- a/src/bin/dhcp6/tests/d2_unittest.cc +++ b/src/bin/dhcp6/tests/d2_unittest.cc @@ -137,9 +137,9 @@ Dhcp6SrvD2Test::configure(const std::string& config, bool exp_result) { int rcode; ConstElementPtr comment = config::parseAnswer(rcode, status); if (exp_result == SHOULD_PASS) { - ASSERT_EQ(0, rcode); + ASSERT_EQ(0, rcode) << "parse comment: " << comment->stringValue(); } else { - ASSERT_EQ(1, rcode); + ASSERT_EQ(1, rcode) << "parse comment: " << comment->stringValue(); } if (rcode == 0) { diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc index eb27678235..b327969b44 100644 --- a/src/bin/dhcp6/tests/fqdn_unittest.cc +++ b/src/bin/dhcp6/tests/fqdn_unittest.cc @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -1587,7 +1586,7 @@ TEST_F(FqdnDhcpv6SrvTest, sanitizeFqdn) { "mxyxhost.example.com.", false); } -// Verifies that socped ddns-parameter handling. +// Verifies that scoped ddns-parameter handling. // Specifically that D2 can be enabled with sending updates // disabled globally, and enabled at the subnet level. TEST_F(FqdnDhcpv6SrvTest, ddnsScopeTest) { diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 95b1d65852..4f79f5cd95 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -554,7 +554,6 @@ AllocEngine::ClientContext6::getDdnsParams() { // Asked for it without a subnet? This case really shouldn't occur but // for now let's an instance with default values. - std::cout << "ClientContext6, Hey we're accessing this without a subnet!" << std::endl; return (DdnsParamsPtr(new DdnsParams())); } @@ -3083,7 +3082,6 @@ AllocEngine::ClientContext4::getDdnsParams() { // Asked for it without a subnet? This case really shouldn't occur but // for now let's an instance with default values. - std::cout << "ClientContext4, Hey we're accessing this without a subnet!" << std::endl; return (DdnsParamsPtr(new DdnsParams())); } diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index 3d55fa25eb..ce5649dd8c 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -557,7 +557,7 @@ public: /// the selected subnet. /// /// If there is no selected subnet (i.e. subnet_ is empty), the - /// returned set will cotain default values. + /// returned set will contain default values. /// /// @return pointer to a DdnsParams instance DdnsParamsPtr getDdnsParams(); @@ -1339,7 +1339,7 @@ public: /// the selected subnet. /// /// If there is no selected subnet (i.e. subnet_ is empty), the - /// returned set will cotain default values. + /// returned set will contain default values. /// /// @return pointer to a DdnsParams instance DdnsParamsPtr getDdnsParams(); diff --git a/src/lib/dhcpsrv/d2_client_cfg.h b/src/lib/dhcpsrv/d2_client_cfg.h index 4b67409df4..c131e5d7b6 100644 --- a/src/lib/dhcpsrv/d2_client_cfg.h +++ b/src/lib/dhcpsrv/d2_client_cfg.h @@ -242,7 +242,7 @@ struct DdnsParams { DdnsParams() : enable_updates_(false), override_no_update_(false), override_client_update_(false), replace_client_name_mode_(D2ClientConfig::RCM_NEVER), - generated_prefix_(""), qualifying_suffix_(""), hostname_char_set_(""), + generated_prefix_("myhost"), qualifying_suffix_(""), hostname_char_set_(""), hostname_char_replacement_("") {}; /// @brief Indicates whether or not DHCP DDNS updating is enabled. diff --git a/src/lib/dhcpsrv/parsers/base_network_parser.cc b/src/lib/dhcpsrv/parsers/base_network_parser.cc index ef96b3df6a..aac2a5de1f 100644 --- a/src/lib/dhcpsrv/parsers/base_network_parser.cc +++ b/src/lib/dhcpsrv/parsers/base_network_parser.cc @@ -19,6 +19,7 @@ namespace dhcp { const Triplet BaseNetworkParser::parseLifetime(const ConstElementPtr& scope, const std::string& name) { + // Initialize as some compilers complain otherwise. uint32_t value = 0; bool has_value = false; uint32_t min_value = 0; @@ -212,7 +213,7 @@ BaseNetworkParser::parseDdnsParams(const data::ConstElementPtr& network_data, } // We need to validate santizer values here so we can detect problems and - // cause a configuration. We dont' retain the compilation because it's not + // cause a configuration. We don't retain the compilation because it's not // something we can inherit. if (!hostname_char_set.empty()) { try { diff --git a/src/lib/dhcpsrv/srv_config.h b/src/lib/dhcpsrv/srv_config.h index 629a59307c..5e63faa2b0 100644 --- a/src/lib/dhcpsrv/srv_config.h +++ b/src/lib/dhcpsrv/srv_config.h @@ -405,7 +405,7 @@ public: return (hooks_config_); } - /// @brief Fetches the DDNS parameters for the given subnet + /// @brief Fetches the DDNS parameters for a given subnet. /// /// Creates a DdnsParams structure populated with the scoped /// values for DDNS behaviorial parameters. The scope mode used