diff options
author | Razvan Becheriu <razvan@isc.org> | 2024-05-10 22:48:32 +0200 |
---|---|---|
committer | Razvan Becheriu <razvan@isc.org> | 2024-05-22 18:04:53 +0200 |
commit | d149028d61849a724f3f24c15a00d94303010672 (patch) | |
tree | a516953f528c36dcfbfd6146ffddb026b47ebb55 /src | |
parent | [#3021] Add link to the code-signing keys (diff) | |
download | kea-d149028d61849a724f3f24c15a00d94303010672.tar.xz kea-d149028d61849a724f3f24c15a00d94303010672.zip |
[#2958] removed deprecated dhcp-ddns parameters
Diffstat (limited to 'src')
29 files changed, 286 insertions, 1729 deletions
diff --git a/src/bin/dhcp4/dhcp4_lexer.ll b/src/bin/dhcp4/dhcp4_lexer.ll index 4d740ea4ea..f3a722cba1 100644 --- a/src/bin/dhcp4/dhcp4_lexer.ll +++ b/src/bin/dhcp4/dhcp4_lexer.ll @@ -1799,15 +1799,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] } } -\"qualifying-suffix\" { - switch(driver.ctx_) { - case isc::dhcp::Parser4Context::DHCP_DDNS: - return isc::dhcp::Dhcp4Parser::make_QUALIFYING_SUFFIX(driver.loc_); - default: - return isc::dhcp::Dhcp4Parser::make_STRING("qualifying-suffix", driver.loc_); - } -} - \"server-ip\" { switch(driver.ctx_) { case isc::dhcp::Parser4Context::DHCP_DDNS: @@ -1871,46 +1862,9 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] } } -\"override-no-update\" { - switch(driver.ctx_) { - case isc::dhcp::Parser4Context::DHCP_DDNS: - return isc::dhcp::Dhcp4Parser::make_OVERRIDE_NO_UPDATE(driver.loc_); - default: - return isc::dhcp::Dhcp4Parser::make_STRING("override-no-update", driver.loc_); - } -} - -\"override-client-update\" { - switch(driver.ctx_) { - case isc::dhcp::Parser4Context::DHCP_DDNS: - return isc::dhcp::Dhcp4Parser::make_OVERRIDE_CLIENT_UPDATE(driver.loc_); - default: - return isc::dhcp::Dhcp4Parser::make_STRING("override-client-update", driver.loc_); - } -} - -\"replace-client-name\" { - switch(driver.ctx_) { - case isc::dhcp::Parser4Context::DHCP_DDNS: - return isc::dhcp::Dhcp4Parser::make_REPLACE_CLIENT_NAME(driver.loc_); - default: - return isc::dhcp::Dhcp4Parser::make_STRING("replace-client-name", driver.loc_); - } -} - -\"generated-prefix\" { - switch(driver.ctx_) { - case isc::dhcp::Parser4Context::DHCP_DDNS: - return isc::dhcp::Dhcp4Parser::make_GENERATED_PREFIX(driver.loc_); - default: - return isc::dhcp::Dhcp4Parser::make_STRING("generated-prefix", driver.loc_); - } -} - \"hostname-char-set\" { switch(driver.ctx_) { case isc::dhcp::Parser4Context::DHCP4: - case isc::dhcp::Parser4Context::DHCP_DDNS: case isc::dhcp::Parser4Context::SUBNET4: case isc::dhcp::Parser4Context::SHARED_NETWORK: return isc::dhcp::Dhcp4Parser::make_HOSTNAME_CHAR_SET(driver.loc_); @@ -1922,7 +1876,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] \"hostname-char-replacement\" { switch(driver.ctx_) { case isc::dhcp::Parser4Context::DHCP4: - case isc::dhcp::Parser4Context::DHCP_DDNS: case isc::dhcp::Parser4Context::SUBNET4: case isc::dhcp::Parser4Context::SHARED_NETWORK: return isc::dhcp::Dhcp4Parser::make_HOSTNAME_CHAR_REPLACEMENT(driver.loc_); diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 573e53b21b..ed36ddc620 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -971,7 +971,7 @@ lease lookup when multi-threading is enabled overwriting configured value. This debug message is issued when the server found a hostname reservation for a client and uses this reservation in a hostname option sent back to this client. The reserved hostname is qualified with a value -of 'qualifying-suffix' parameter, if this parameter is specified. +of 'ddns-qualifying-suffix' parameter, if this parameter is specified. % DHCP4_RESPONSE_DATA %1: responding with packet %2 (type %3), packet details: %4 A debug message including the detailed data about the packet being sent diff --git a/src/bin/dhcp4/dhcp4_parser.yy b/src/bin/dhcp4/dhcp4_parser.yy index b1b3941885..9cad59405c 100644 --- a/src/bin/dhcp4/dhcp4_parser.yy +++ b/src/bin/dhcp4/dhcp4_parser.yy @@ -236,7 +236,6 @@ using namespace std; DHCP_DDNS "dhcp-ddns" ENABLE_UPDATES "enable-updates" - QUALIFYING_SUFFIX "qualifying-suffix" SERVER_IP "server-ip" SERVER_PORT "server-port" SENDER_IP "sender-ip" @@ -244,10 +243,6 @@ using namespace std; MAX_QUEUE_SIZE "max-queue-size" NCR_PROTOCOL "ncr-protocol" NCR_FORMAT "ncr-format" - OVERRIDE_NO_UPDATE "override-no-update" - OVERRIDE_CLIENT_UPDATE "override-client-update" - REPLACE_CLIENT_NAME "replace-client-name" - GENERATED_PREFIX "generated-prefix" TCP "tcp" JSON "JSON" WHEN_PRESENT "when-present" @@ -724,7 +719,7 @@ ddns_replace_client_name_value: $$ = ElementPtr(new StringElement("when-not-present", ctx.loc2pos(@1))); } | BOOLEAN { - error(@1, "boolean values for the replace-client-name are " + error(@1, "boolean values for the ddns-replace-client-name are " "no longer supported"); } ; @@ -2665,13 +2660,6 @@ dhcp_ddns_param: enable_updates | max_queue_size | ncr_protocol | ncr_format - | dep_override_no_update - | dep_override_client_update - | dep_replace_client_name - | dep_generated_prefix - | dep_qualifying_suffix - | dep_hostname_char_set - | dep_hostname_char_replacement | user_context | comment | unknown_map_entry @@ -2741,70 +2729,6 @@ ncr_format: NCR_FORMAT { ctx.leave(); }; -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_qualifying_suffix: QUALIFYING_SUFFIX { - ctx.unique("qualifying-suffix", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("qualifying-suffix", s); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_override_no_update: OVERRIDE_NO_UPDATE COLON BOOLEAN { - ctx.unique("override-no-update", ctx.loc2pos(@1)); - ElementPtr b(new BoolElement($3, ctx.loc2pos(@3))); - ctx.stack_.back()->set("override-no-update", b); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_override_client_update: OVERRIDE_CLIENT_UPDATE COLON BOOLEAN { - ctx.unique("override-client-update", ctx.loc2pos(@1)); - ElementPtr b(new BoolElement($3, ctx.loc2pos(@3))); - ctx.stack_.back()->set("override-client-update", b); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_replace_client_name: REPLACE_CLIENT_NAME { - ctx.unique("replace-client-name", ctx.loc2pos(@1)); - ctx.enter(ctx.REPLACE_CLIENT_NAME); -} COLON ddns_replace_client_name_value { - ctx.stack_.back()->set("replace-client-name", $4); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_generated_prefix: GENERATED_PREFIX { - ctx.unique("generated-prefix", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("generated-prefix", s); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_hostname_char_set: HOSTNAME_CHAR_SET { - ctx.unique("hostname-char-set", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("hostname-char-set", s); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_hostname_char_replacement: HOSTNAME_CHAR_REPLACEMENT { - ctx.unique("hostname-char-replacement", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("hostname-char-replacement", s); - ctx.leave(); -}; - - // Config control information element config_control: CONFIG_CONTROL { diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index 3bb4bb9ddd..33347425e6 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -928,15 +928,15 @@ private: /// configuration. A reserved hostname takes precedence over a hostname /// supplied by the client or auto generated hostname. /// - /// If the 'qualifying-suffix' parameter is specified, its value is used + /// If the 'ddns-qualifying-suffix' parameter is specified, its value is used /// to qualify a hostname. For example, if the host reservation contains /// a hostname 'marcin-laptop', and the qualifying suffix is /// 'example.isc.org', the hostname returned to the client will be - /// 'marcin-laptop.example.isc.org'. If the 'qualifying-suffix' is not + /// 'marcin-laptop.example.isc.org'. If the 'ddns-qualifying-suffix' is not /// specified (empty), the reserved hostname is returned to the client /// unqualified. /// - /// The 'qualifying-suffix' value is also used to qualify the hostname + /// The 'ddns-qualifying-suffix' value is also used to qualify the hostname /// supplied by the client, when this hostname is unqualified, /// e.g. 'laptop-x'. If the supplied hostname is qualified, e.g. /// 'laptop-x.example.org', the qualifying suffix will not be appended diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 9a45e0b69a..02741cf0a0 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -352,12 +352,6 @@ processDhcp4Config(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 compatibility. - srv_config->moveDdnsParams(mutable_cfg); - // Move from reservation mode to new reservations flags. // @todo add warning BaseNetworkParser::moveReservationMode(mutable_cfg); diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 797305d5a9..fa96578c8c 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -4578,168 +4578,6 @@ TEST_F(Dhcp4ParserTest, d2ClientConfigValid) { checkGlobal("ddns-qualifying-suffix", ""); } -// This test verifies that valid but deprecated dhcp-ddns parameters -// get moved to the global scope when they do not already exist there. -TEST_F(Dhcp4ParserTest, d2ClientConfigMoveToGlobal) { - ConstElementPtr status; - - // 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()); - - // Verify that the convenience method agrees. - ASSERT_FALSE(CfgMgr::instance().ddnsEnabled()); - - string config_str = "{ " + genIfaceConfig() + "," + - "\"rebind-timer\": 2000, " - "\"renew-timer\": 1000, " - "\"subnet4\": [ { " - " \"id\": 1," - " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," - " \"subnet\": \"192.0.2.0/24\" } ]," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"server-ip\" : \"192.168.2.1\", " - " \"server-port\" : 777, " - " \"sender-ip\" : \"192.168.2.2\", " - " \"sender-port\" : 778, " - " \"max-queue-size\" : 2048, " - " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"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-Z]\", " - " \"hostname-char-replacement\" : \"x\" }, " - "\"valid-lifetime\": 4000 }"; - - // Convert the JSON string to configuration elements. - ConstElementPtr config; - ASSERT_NO_THROW(config = parseDHCP4(config_str, true)); - extractConfig(config_str); - - // Pass the configuration in for parsing. - EXPECT_NO_THROW(status = Dhcpv4SrvTest::configure(*srv_, config)); - - // check if returned status is OK - checkResult(status, 0); - - // Verify that DHCP-DDNS updating is enabled. - EXPECT_TRUE(CfgMgr::instance().ddnsEnabled()); - - // Verify that the D2 configuration can be retrieved. - d2_client_config = CfgMgr::instance().getD2ClientConfig(); - ASSERT_TRUE(d2_client_config); - - // Verify that the configuration values are correct. - EXPECT_TRUE(d2_client_config->getEnableUpdates()); - EXPECT_EQ("192.168.2.1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); - EXPECT_EQ("192.168.2.2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); - EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); - EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); - - // ddns-send-updates should be global default - checkGlobal("ddns-send-updates", true); - - // The following should all have been moved from dhcp-ddns. - checkGlobal("ddns-override-no-update", true); - checkGlobal("ddns-override-client-update", true); - checkGlobal("ddns-replace-client-name", "when-present"); - checkGlobal("ddns-generated-prefix", "test.prefix"); - checkGlobal("ddns-qualifying-suffix", "test.suffix."); - checkGlobal("hostname-char-set", "[^A-Z]"); - checkGlobal("hostname-char-replacement", "x"); -} - -// This test verifies that explicit global values override deprecated -// dhcp-ddns parameters (i.e. global scope wins) -TEST_F(Dhcp4ParserTest, d2ClientConfigBoth) { - ConstElementPtr status; - - // 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()); - - // Verify that the convenience method agrees. - ASSERT_FALSE(CfgMgr::instance().ddnsEnabled()); - - string config_str = "{ " + genIfaceConfig() + "," + - "\"rebind-timer\": 2000, " - "\"renew-timer\": 1000, " - "\"subnet4\": [ { " - " \"id\": 1," - " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," - " \"subnet\": \"192.0.2.0/24\" } ]," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"server-ip\" : \"192.168.2.1\", " - " \"server-port\" : 777, " - " \"sender-ip\" : \"192.168.2.2\", " - " \"sender-port\" : 778, " - " \"max-queue-size\" : 2048, " - " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : false, " - " \"override-client-update\" : false, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"d2.prefix\", " - " \"qualifying-suffix\" : \"d2.suffix.\", " - " \"hostname-char-set\" : \"[^0-9]\", " - " \"hostname-char-replacement\" : \"z\" }, " - " \"ddns-send-updates\" : false, " - " \"ddns-override-no-update\" : true, " - " \"ddns-override-client-update\" : true, " - " \"ddns-replace-client-name\" : \"always\", " - " \"ddns-generated-prefix\" : \"global.prefix\", " - " \"ddns-qualifying-suffix\" : \"global.suffix.\", " - " \"hostname-char-set\" : \"[^A-Z]\", " - " \"hostname-char-replacement\" : \"x\", " - "\"valid-lifetime\": 4000 }"; - - // Convert the JSON string to configuration elements. - ConstElementPtr config; - ASSERT_NO_THROW(config = parseDHCP4(config_str, true)); - extractConfig(config_str); - - // Pass the configuration in for parsing. - EXPECT_NO_THROW(status = Dhcpv4SrvTest::configure(*srv_, config)); - - // check if returned status is OK - checkResult(status, 0); - - // Verify that DHCP-DDNS updating is enabled. - EXPECT_TRUE(CfgMgr::instance().ddnsEnabled()); - - // Verify that the D2 configuration can be retrieved. - d2_client_config = CfgMgr::instance().getD2ClientConfig(); - ASSERT_TRUE(d2_client_config); - - // Verify that the configuration values are correct. - EXPECT_TRUE(d2_client_config->getEnableUpdates()); - EXPECT_EQ("192.168.2.1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); - EXPECT_EQ("192.168.2.2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); - EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); - EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); - - // Verify all global values won. - checkGlobal("ddns-send-updates", false); - checkGlobal("ddns-override-no-update", true); - checkGlobal("ddns-override-client-update", true); - checkGlobal("ddns-replace-client-name", "always"); - checkGlobal("ddns-generated-prefix", "global.prefix"); - checkGlobal("ddns-qualifying-suffix", "global.suffix."); - checkGlobal("hostname-char-set", "[^A-Z]"); - checkGlobal("hostname-char-replacement", "x"); -} - // This test checks the ability of the server to handle a configuration // containing an invalid dhcp-ddns (D2ClientConfig) entry. TEST_F(Dhcp4ParserTest, invalidD2ClientConfig) { @@ -4750,6 +4588,11 @@ TEST_F(Dhcp4ParserTest, invalidD2ClientConfig) { string config_str = "{ " + genIfaceConfig() + "," + "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet4\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," @@ -4759,12 +4602,7 @@ TEST_F(Dhcp4ParserTest, invalidD2ClientConfig) { " \"server-ip\" : \"bogus-value\", " " \"server-port\" : 5301, " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; // Convert the JSON string to configuration elements. diff --git a/src/bin/dhcp4/tests/d2_unittest.cc b/src/bin/dhcp4/tests/d2_unittest.cc index 937dcb22db..c45afa5f01 100644 --- a/src/bin/dhcp4/tests/d2_unittest.cc +++ b/src/bin/dhcp4/tests/d2_unittest.cc @@ -99,6 +99,11 @@ Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result, "}," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet4\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," @@ -111,12 +116,7 @@ Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result, " \"sender-port\" : " << sender_port << ", " " \"max-queue-size\" : " << max_queue_size << ", " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; configure(config.str(), exp_result); @@ -412,6 +412,11 @@ TEST_F(Dhcp4SrvD2Test, badTCP) { "}," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet4\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," @@ -424,12 +429,7 @@ TEST_F(Dhcp4SrvD2Test, badTCP) { " \"sender-port\" : 0, " " \"max-queue-size\" : 1024, " " \"ncr-protocol\" : \"TCP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; ElementPtr json = Element::fromJSON(config); @@ -452,6 +452,11 @@ TEST_F(Dhcp4SrvD2Test, badFamily) { "}," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet4\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," @@ -464,12 +469,7 @@ TEST_F(Dhcp4SrvD2Test, badFamily) { " \"sender-port\" : 0, " " \"max-queue-size\" : 1024, " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; ElementPtr json = Element::fromJSON(config); @@ -492,6 +492,11 @@ TEST_F(Dhcp4SrvD2Test, senderEqServer) { "}," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet4\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ]," @@ -504,12 +509,7 @@ TEST_F(Dhcp4SrvD2Test, senderEqServer) { " \"sender-port\" : 53001, " " \"max-queue-size\" : 1024, " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; ElementPtr json = Element::fromJSON(config); diff --git a/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in b/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in index 8ea55c1767..4680da8476 100644 --- a/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in +++ b/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in @@ -45,9 +45,9 @@ CONFIG="{ \"subnet\": \"10.0.0.0/8\", \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"loggers\": [ { @@ -198,9 +198,9 @@ INVALID_CONFIG_HOOKS_LOAD="{ \"subnet\": \"10.0.0.0/8\", \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { @@ -250,9 +250,9 @@ INVALID_CONFIG_HOOKS_CALLOUT_FAIL_ON_LOAD="{ \"subnet\": \"10.0.0.0/8\", \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { @@ -302,9 +302,9 @@ INVALID_CONFIG_HOOKS_CALLOUT_FAIL_ON_POLL="{ \"subnet\": \"10.0.0.0/8\", \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc index 99b707db9c..edc0b3c445 100644 --- a/src/bin/dhcp4/tests/fqdn_unittest.cc +++ b/src/bin/dhcp4/tests/fqdn_unittest.cc @@ -56,9 +56,9 @@ const char* CONFIGS[] = { " }" " ]" " }]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - "\"enable-updates\": true," - "\"qualifying-suffix\": \"\"" + "\"enable-updates\": true" "}" "}", // 1 @@ -81,9 +81,9 @@ const char* CONFIGS[] = { " }" " ]" " }]," + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\"," "\"dhcp-ddns\": {" - "\"enable-updates\": true," - "\"qualifying-suffix\": \"fake-suffix.isc.org.\"" + "\"enable-updates\": true" "}" "}", // 2 @@ -98,9 +98,9 @@ const char* CONFIGS[] = { " \"id\": 1," " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.10\" } ]" " }]," + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\"," "\"dhcp-ddns\": {" - "\"enable-updates\": false," - "\"qualifying-suffix\": \"fake-suffix.isc.org.\"" + "\"enable-updates\": false" "}" "}", // 3 @@ -115,9 +115,9 @@ const char* CONFIGS[] = { " \"id\": 1," " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.10\" } ]" " }]," + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\"," "\"dhcp-ddns\": {" - "\"enable-updates\": true," - "\"qualifying-suffix\": \"fake-suffix.isc.org.\"" + "\"enable-updates\": true" "}" "}", // 4 @@ -143,14 +143,14 @@ const char* CONFIGS[] = { " }" " ]" " }]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - "\"enable-updates\": false," - "\"qualifying-suffix\": \"\"" + "\"enable-updates\": false" "}" "}", // 5 // Configuration which disables DNS updates but contains a reservation - // for a hostname and the qualifying-suffix which should be appended to + // for a hostname and the ddns-qualifying-suffix which should be appended to // the reserved hostname in the Hostname option returned to a client. "{ \"interfaces-config\": {" " \"interfaces\": [ \"*\" ]" @@ -171,9 +171,9 @@ const char* CONFIGS[] = { " }" " ]" " }]," + "\"ddns-qualifying-suffix\": \"example.isc.org\"," "\"dhcp-ddns\": {" - "\"enable-updates\": false," - "\"qualifying-suffix\": \"example.isc.org\"" + "\"enable-updates\": false" "}" "}", // 6 @@ -197,11 +197,11 @@ const char* CONFIGS[] = { " }" " ]" " }]," + "\"hostname-char-set\" : \"[^A-Za-z0-9.-]\"," + "\"hostname-char-replacement\" : \"x\"," + "\"ddns-qualifying-suffix\": \"example.com\"," "\"dhcp-ddns\": {" - "\"enable-updates\": true," - "\"hostname-char-set\" : \"[^A-Za-z0-9.-]\"," - "\"hostname-char-replacement\" : \"x\"," - "\"qualifying-suffix\": \"example.com\"" + "\"enable-updates\": true" "}" "}", // 7 @@ -268,9 +268,9 @@ const char* CONFIGS[] = { " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.10-192.0.2.10\" } ]" " }]," + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\"," "\"dhcp-ddns\": {" - "\"enable-updates\": true," - "\"qualifying-suffix\": \"fake-suffix.isc.org.\"" + "\"enable-updates\": true" "}" "}", // 10 @@ -318,9 +318,9 @@ const char* CONFIGS[] = { " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.10\" } ],\n" " \"offer-lifetime\": 45,\n" "} ],\n" + "\"ddns-qualifying-suffix\": \"example.com.\",\n" "\"dhcp-ddns\": {\n" - "\"enable-updates\": true,\n" - "\"qualifying-suffix\": \"example.com.\"\n" + "\"enable-updates\": true\n" "}\n" "}", // 12 @@ -337,9 +337,9 @@ const char* CONFIGS[] = { " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.10\" } ],\n" " \"ddns-ttl-percent\": .25\n" "} ],\n" + "\"ddns-qualifying-suffix\": \"example.com.\",\n" "\"dhcp-ddns\": {\n" - "\"enable-updates\": true,\n" - "\"qualifying-suffix\": \"example.com.\"\n" + "\"enable-updates\": true\n" "}\n" "}" }; @@ -644,11 +644,11 @@ public: } // Test that the server's processes the hostname (or lack thereof) - // in a client request correctly, according to the replace-client-name + // in a client request correctly, according to the ddns-replace-client-name // mode configuration parameter. We include hostname sanitizer to ensure // it does not interfere with name replacement. // - // @param mode - value to use for replace-client-name + // @param mode - value to use for ddns-replace-client-name // @param client_name_flag - specifies whether or not the client request // should contain a hostname option // @param exp_replacement_flag - specifies whether or not the server is @@ -667,12 +667,12 @@ public: " \"id\": 1," " \"pools\": [ { \"pool\": \"192.0.2.10-192.0.2.10\" } ]" " }]," + "\"ddns-replace-client-name\": \"%s\"," + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\"," + "\"hostname-char-set\": \"[^A-Za-z0-9.-]\"," + "\"hostname-char-replacement\": \"x\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"fake-suffix.isc.org.\"," - " \"hostname-char-set\": \"[^A-Za-z0-9.-]\"," - " \"hostname-char-replacement\": \"x\"," - " \"replace-client-name\": \"%s\"" + " \"enable-updates\": true" "}}"; // Create the configuration and configure the server @@ -960,7 +960,7 @@ TEST_F(NameDhcpv4SrvTest, respectNoUpdate) { // Tests the following scenario: // - Updates are enabled -// - override-no-update is on +// - ddns-override-no-update is on // - Client requests no updates (N = 1, S = 0) // // Server should override "no update" request and perform updates: @@ -992,14 +992,14 @@ TEST_F(NameDhcpv4SrvTest, respectClientDelegation) { // Tests the following scenario: // - Updates are enabled -// - override-client-update is on. +// - ddns-override-client-update is on. // - Client requests delegation (N = 0, S = 0) // // Server should override client's delegation request and do updates: // - Response flags should be N = 0, S = 1, O = 1 // - Should queue an NCR TEST_F(NameDhcpv4SrvTest, overrideClientDelegation) { - // Turn on override-client-update. + // Turn on ddns-override-client-update. enableD2(OVERRIDE_CLIENT_UPDATE); flagVsConfigScenario(Option4ClientFqdn::FLAG_E, @@ -1966,7 +1966,7 @@ TEST_F(NameDhcpv4SrvTest, hostnameReservationPRL) { } // This test verifies that the server sends the Hostname option to the client -// with partial hostname reservation and with the global qualifying-suffix set. +// with partial hostname reservation and with the global ddns-qualifying-suffix set. TEST_F(NameDhcpv4SrvTest, hostnameReservationNoDNSQualifyingSuffix) { Dhcp4Client client(Dhcp4Client::SELECTING); // Use HW address that matches the reservation entry in the configuration. @@ -2092,7 +2092,7 @@ TEST_F(NameDhcpv4SrvTest, emptyFqdn) { EXPECT_EQ(expected_fqdn, lease->hostname_); } -// Verifies that the replace-client-name behavior is correct for each of +// Verifies that the ddns-replace-client-name behavior is correct for each of // the supported modes. TEST_F(NameDhcpv4SrvTest, replaceClientNameModeTest) { diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 13fe908335..1f020f09b4 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -1239,90 +1239,6 @@ const char* EXTRACTED_CONFIGS[] = { " }\n", // CONFIGURATION 42 "{\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"generated-prefix\": \"test.prefix\",\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"override-client-update\": true,\n" -" \"override-no-update\": true,\n" -" \"qualifying-suffix\": \"test.suffix.\",\n" -" \"replace-client-name\": \"when-present\",\n" -" \"sender-ip\": \"192.168.2.2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"192.168.2.1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"subnet4\": [\n" -" {\n" -" \"id\": 1,\n" -" \"pools\": [\n" -" {\n" -" \"pool\": \"192.0.2.1 - 192.0.2.100\"\n" -" }\n" -" ],\n" -" \"subnet\": \"192.0.2.0/24\"\n" -" }\n" -" ],\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 43 -"{\n" -" \"ddns-generated-prefix\": \"global.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"global.suffix.\",\n" -" \"ddns-replace-client-name\": \"always\",\n" -" \"ddns-send-updates\": false,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"generated-prefix\": \"d2.prefix\",\n" -" \"hostname-char-replacement\": \"z\",\n" -" \"hostname-char-set\": \"[^0-9]\",\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"override-client-update\": false,\n" -" \"override-no-update\": false,\n" -" \"qualifying-suffix\": \"d2.suffix.\",\n" -" \"replace-client-name\": \"when-present\",\n" -" \"sender-ip\": \"192.168.2.2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"192.168.2.1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"subnet4\": [\n" -" {\n" -" \"id\": 1,\n" -" \"pools\": [\n" -" {\n" -" \"pool\": \"192.0.2.1 - 192.0.2.100\"\n" -" }\n" -" ],\n" -" \"subnet\": \"192.0.2.0/24\"\n" -" }\n" -" ],\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 44 -"{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" " \"re-detect\": false\n" @@ -1348,7 +1264,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 43 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1375,7 +1291,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 44 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1426,7 +1342,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 45 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1459,7 +1375,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 46 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1558,7 +1474,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 47 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1600,7 +1516,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 48 "{\n" " \"rebind-timer\": 2000,\n" " \"renew-timer\": 1000,\n" @@ -1687,7 +1603,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 49 "{\n" " \"rebind-timer\": 2000,\n" " \"renew-timer\": 1000,\n" @@ -1719,7 +1635,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 50 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1727,7 +1643,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 51 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1735,7 +1651,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 52 "{\n" " \"decline-probation-period\": 12345,\n" " \"interfaces-config\": {\n" @@ -1744,7 +1660,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 53 "{\n" " \"expired-leases-processing\": {\n" " \"flush-reclaimed-timer-wait-time\": 35,\n" @@ -1760,7 +1676,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 54 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1781,7 +1697,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 55 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1803,7 +1719,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 56 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1825,7 +1741,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 57 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1848,7 +1764,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 58 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1870,7 +1786,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 59 "{\n" " \"client-classes\": [\n" " {\n" @@ -1902,7 +1818,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 60 "{\n" " \"client-classes\": [\n" " {\n" @@ -1931,7 +1847,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 61 "{\n" " \"client-classes\": [\n" " {\n" @@ -1962,7 +1878,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 62 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1983,7 +1899,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 65 + // CONFIGURATION 63 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2005,7 +1921,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 66 + // CONFIGURATION 64 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2031,7 +1947,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 67 + // CONFIGURATION 65 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2057,7 +1973,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 68 + // CONFIGURATION 66 "{\n" " \"hosts-databases\": [\n" " {\n" @@ -2081,7 +1997,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 69 + // CONFIGURATION 67 "{\n" " \"client-classes\": [\n" " {\n" @@ -2190,7 +2106,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"comment\": \"A DHCPv4 server\"\n" " }\n" " }\n", - // CONFIGURATION 70 + // CONFIGURATION 68 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2252,7 +2168,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 71 + // CONFIGURATION 69 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2302,7 +2218,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 72 + // CONFIGURATION 70 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2334,7 +2250,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 73 + // CONFIGURATION 71 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2366,7 +2282,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 74 + // CONFIGURATION 72 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2378,7 +2294,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"statistic-default-sample-count\": 10,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 75 + // CONFIGURATION 73 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2386,7 +2302,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 76 + // CONFIGURATION 74 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2399,7 +2315,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet4\": [ ]\n" " }\n", - // CONFIGURATION 77 + // CONFIGURATION 75 "{\n" " \"ddns-conflict-resolution-mode\": \"no-check-with-dhcid\",\n" " \"interfaces-config\": {\n" @@ -7649,234 +7565,6 @@ const char* UNPARSED_CONFIGS[] = { " \"boot-file-name\": \"\",\n" " \"calculate-tee-times\": false,\n" " \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" -" \"ddns-generated-prefix\": \"test.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"test.suffix.\",\n" -" \"ddns-replace-client-name\": \"when-present\",\n" -" \"ddns-send-updates\": true,\n" -" \"ddns-update-on-renew\": false,\n" -" \"decline-probation-period\": 86400,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"sender-ip\": \"192.168.2.2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"192.168.2.1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"dhcp-queue-control\": {\n" -" \"capacity\": 64,\n" -" \"enable-queue\": false,\n" -" \"queue-type\": \"kea-ring4\"\n" -" },\n" -" \"dhcp4o6-port\": 0,\n" -" \"early-global-reservations-lookup\": false,\n" -" \"echo-client-id\": true,\n" -" \"expired-leases-processing\": {\n" -" \"flush-reclaimed-timer-wait-time\": 25,\n" -" \"hold-reclaimed-time\": 3600,\n" -" \"max-reclaim-leases\": 100,\n" -" \"max-reclaim-time\": 250,\n" -" \"reclaim-timer-wait-time\": 10,\n" -" \"unwarned-reclaim-cycles\": 5\n" -" },\n" -" \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"ip-reservations-unique\": true,\n" -" \"lease-database\": {\n" -" \"type\": \"memfile\"\n" -" },\n" -" \"match-client-id\": true,\n" -" \"multi-threading\": {\n" -" \"enable-multi-threading\": true,\n" -" \"packet-queue-size\": 64,\n" -" \"thread-pool-size\": 0\n" -" },\n" -" \"next-server\": \"0.0.0.0\",\n" -" \"option-data\": [ ],\n" -" \"option-def\": [ ],\n" -" \"parked-packet-limit\": 256,\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"reservations-global\": false,\n" -" \"reservations-in-subnet\": true,\n" -" \"reservations-lookup-first\": false,\n" -" \"reservations-out-of-pool\": false,\n" -" \"sanity-checks\": {\n" -" \"extended-info-checks\": \"fix\",\n" -" \"lease-checks\": \"warn\"\n" -" },\n" -" \"server-hostname\": \"\",\n" -" \"server-tag\": \"\",\n" -" \"shared-networks\": [ ],\n" -" \"stash-agent-options\": false,\n" -" \"statistic-default-sample-age\": 0,\n" -" \"statistic-default-sample-count\": 20,\n" -" \"store-extended-info\": false,\n" -" \"subnet4\": [\n" -" {\n" -" \"4o6-interface\": \"\",\n" -" \"4o6-interface-id\": \"\",\n" -" \"4o6-subnet\": \"\",\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": false,\n" -" \"id\": 1,\n" -" \"max-valid-lifetime\": 4000,\n" -" \"min-valid-lifetime\": 4000,\n" -" \"option-data\": [ ],\n" -" \"pools\": [\n" -" {\n" -" \"option-data\": [ ],\n" -" \"pool\": \"192.0.2.1-192.0.2.100\"\n" -" }\n" -" ],\n" -" \"rebind-timer\": 2000,\n" -" \"relay\": {\n" -" \"ip-addresses\": [ ]\n" -" },\n" -" \"renew-timer\": 1000,\n" -" \"reservations\": [ ],\n" -" \"store-extended-info\": false,\n" -" \"subnet\": \"192.0.2.0/24\",\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.875,\n" -" \"valid-lifetime\": 4000\n" -" }\n" -" ],\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.875,\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 43 -"{\n" -" \"allocator\": \"iterative\",\n" -" \"authoritative\": false,\n" -" \"boot-file-name\": \"\",\n" -" \"calculate-tee-times\": false,\n" -" \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" -" \"ddns-generated-prefix\": \"global.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"global.suffix.\",\n" -" \"ddns-replace-client-name\": \"always\",\n" -" \"ddns-send-updates\": false,\n" -" \"ddns-update-on-renew\": false,\n" -" \"decline-probation-period\": 86400,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"sender-ip\": \"192.168.2.2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"192.168.2.1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"dhcp-queue-control\": {\n" -" \"capacity\": 64,\n" -" \"enable-queue\": false,\n" -" \"queue-type\": \"kea-ring4\"\n" -" },\n" -" \"dhcp4o6-port\": 0,\n" -" \"early-global-reservations-lookup\": false,\n" -" \"echo-client-id\": true,\n" -" \"expired-leases-processing\": {\n" -" \"flush-reclaimed-timer-wait-time\": 25,\n" -" \"hold-reclaimed-time\": 3600,\n" -" \"max-reclaim-leases\": 100,\n" -" \"max-reclaim-time\": 250,\n" -" \"reclaim-timer-wait-time\": 10,\n" -" \"unwarned-reclaim-cycles\": 5\n" -" },\n" -" \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"ip-reservations-unique\": true,\n" -" \"lease-database\": {\n" -" \"type\": \"memfile\"\n" -" },\n" -" \"match-client-id\": true,\n" -" \"multi-threading\": {\n" -" \"enable-multi-threading\": true,\n" -" \"packet-queue-size\": 64,\n" -" \"thread-pool-size\": 0\n" -" },\n" -" \"next-server\": \"0.0.0.0\",\n" -" \"option-data\": [ ],\n" -" \"option-def\": [ ],\n" -" \"parked-packet-limit\": 256,\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"reservations-global\": false,\n" -" \"reservations-in-subnet\": true,\n" -" \"reservations-lookup-first\": false,\n" -" \"reservations-out-of-pool\": false,\n" -" \"sanity-checks\": {\n" -" \"extended-info-checks\": \"fix\",\n" -" \"lease-checks\": \"warn\"\n" -" },\n" -" \"server-hostname\": \"\",\n" -" \"server-tag\": \"\",\n" -" \"shared-networks\": [ ],\n" -" \"stash-agent-options\": false,\n" -" \"statistic-default-sample-age\": 0,\n" -" \"statistic-default-sample-count\": 20,\n" -" \"store-extended-info\": false,\n" -" \"subnet4\": [\n" -" {\n" -" \"4o6-interface\": \"\",\n" -" \"4o6-interface-id\": \"\",\n" -" \"4o6-subnet\": \"\",\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": false,\n" -" \"id\": 1,\n" -" \"max-valid-lifetime\": 4000,\n" -" \"min-valid-lifetime\": 4000,\n" -" \"option-data\": [ ],\n" -" \"pools\": [\n" -" {\n" -" \"option-data\": [ ],\n" -" \"pool\": \"192.0.2.1-192.0.2.100\"\n" -" }\n" -" ],\n" -" \"rebind-timer\": 2000,\n" -" \"relay\": {\n" -" \"ip-addresses\": [ ]\n" -" },\n" -" \"renew-timer\": 1000,\n" -" \"reservations\": [ ],\n" -" \"store-extended-info\": false,\n" -" \"subnet\": \"192.0.2.0/24\",\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.875,\n" -" \"valid-lifetime\": 4000\n" -" }\n" -" ],\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.875,\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 44 -"{\n" -" \"allocator\": \"iterative\",\n" -" \"authoritative\": false,\n" -" \"boot-file-name\": \"\",\n" -" \"calculate-tee-times\": false,\n" -" \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" " \"ddns-generated-prefix\": \"myhost\",\n" " \"ddns-override-client-update\": false,\n" " \"ddns-override-no-update\": false,\n" @@ -7984,7 +7672,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 43 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -8098,7 +7786,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 44 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -8299,7 +7987,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 45 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -8428,7 +8116,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 46 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -8707,7 +8395,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 47 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -8852,7 +8540,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 48 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9150,7 +8838,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 49 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9295,7 +8983,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 50 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9378,7 +9066,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 51 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9461,7 +9149,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 52 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9544,7 +9232,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 53 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9627,7 +9315,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 54 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9741,7 +9429,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 55 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9855,7 +9543,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 56 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -9969,7 +9657,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 57 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10083,7 +9771,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 58 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10197,7 +9885,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 59 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10337,7 +10025,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 60 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10468,7 +10156,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 61 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10601,7 +10289,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 62 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10715,7 +10403,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 65 + // CONFIGURATION 63 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10830,7 +10518,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 66 + // CONFIGURATION 64 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -10949,7 +10637,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 67 + // CONFIGURATION 65 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11068,7 +10756,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 68 + // CONFIGURATION 66 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11167,7 +10855,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 69 + // CONFIGURATION 67 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11405,7 +11093,7 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 70 + // CONFIGURATION 68 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11606,7 +11294,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 71 + // CONFIGURATION 69 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11786,7 +11474,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 72 + // CONFIGURATION 70 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -11928,7 +11616,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 73 + // CONFIGURATION 71 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -12070,7 +11758,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 74 + // CONFIGURATION 72 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -12155,7 +11843,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 75 + // CONFIGURATION 73 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -12238,7 +11926,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 76 + // CONFIGURATION 74 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" @@ -12321,7 +12009,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.875,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 77 + // CONFIGURATION 75 "{\n" " \"allocator\": \"iterative\",\n" " \"authoritative\": false,\n" diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc.skel b/src/bin/dhcp4/tests/get_config_unittest.cc.skel index b6dc39fadd..8be9f77c0e 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp4/tests/get_config_unittest.cc.skel @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/bin/dhcp4/tests/out_of_range_unittest.cc b/src/bin/dhcp4/tests/out_of_range_unittest.cc index 8b86d59619..014649fcf4 100644 --- a/src/bin/dhcp4/tests/out_of_range_unittest.cc +++ b/src/bin/dhcp4/tests/out_of_range_unittest.cc @@ -61,9 +61,9 @@ const char* OOR_CONFIGS[] = { " }" " ]" "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", @@ -87,9 +87,9 @@ const char* OOR_CONFIGS[] = { " }" " ]" "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", @@ -103,9 +103,9 @@ const char* OOR_CONFIGS[] = { " \"id\": 1, " " \"pools\": [ { \"pool\": \"10.0.0.101-10.0.0.200\" } ]," "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", @@ -129,9 +129,9 @@ const char* OOR_CONFIGS[] = { " }" " ]" "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", @@ -145,9 +145,9 @@ const char* OOR_CONFIGS[] = { " \"id\": 1, " " \"pools\": [ { \"pool\": \"192.0.2.101-192.0.2.200\" } ]" "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", @@ -161,9 +161,9 @@ const char* OOR_CONFIGS[] = { " \"id\": 1, " " \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ]" "} ]," + "\"ddns-qualifying-suffix\": \"\"," "\"dhcp-ddns\": {" - " \"enable-updates\": true," - " \"qualifying-suffix\": \"\"" + " \"enable-updates\": true" "}" "}", diff --git a/src/bin/dhcp6/dhcp6_lexer.ll b/src/bin/dhcp6/dhcp6_lexer.ll index 6762e6d6b5..db827af2a4 100644 --- a/src/bin/dhcp6/dhcp6_lexer.ll +++ b/src/bin/dhcp6/dhcp6_lexer.ll @@ -198,15 +198,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] } } -\"qualifying-suffix\" { - switch(driver.ctx_) { - case isc::dhcp::Parser6Context::DHCP_DDNS: - return isc::dhcp::Dhcp6Parser::make_QUALIFYING_SUFFIX(driver.loc_); - default: - return isc::dhcp::Dhcp6Parser::make_STRING("qualifying-suffix", driver.loc_); - } -} - \"server-ip\" { switch(driver.ctx_) { case isc::dhcp::Parser6Context::DHCP_DDNS: @@ -270,46 +261,9 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] } } -\"override-no-update\" { - switch(driver.ctx_) { - case isc::dhcp::Parser6Context::DHCP_DDNS: - return isc::dhcp::Dhcp6Parser::make_OVERRIDE_NO_UPDATE(driver.loc_); - default: - return isc::dhcp::Dhcp6Parser::make_STRING("override-no-update", driver.loc_); - } -} - -\"override-client-update\" { - switch(driver.ctx_) { - case isc::dhcp::Parser6Context::DHCP_DDNS: - return isc::dhcp::Dhcp6Parser::make_OVERRIDE_CLIENT_UPDATE(driver.loc_); - default: - return isc::dhcp::Dhcp6Parser::make_STRING("override-client-update", driver.loc_); - } -} - -\"replace-client-name\" { - switch(driver.ctx_) { - case isc::dhcp::Parser6Context::DHCP_DDNS: - return isc::dhcp::Dhcp6Parser::make_REPLACE_CLIENT_NAME(driver.loc_); - default: - return isc::dhcp::Dhcp6Parser::make_STRING("replace-client-name", driver.loc_); - } -} - -\"generated-prefix\" { - switch(driver.ctx_) { - case isc::dhcp::Parser6Context::DHCP_DDNS: - return isc::dhcp::Dhcp6Parser::make_GENERATED_PREFIX(driver.loc_); - default: - return isc::dhcp::Dhcp6Parser::make_STRING("generated-prefix", driver.loc_); - } -} - \"hostname-char-set\" { switch(driver.ctx_) { case isc::dhcp::Parser6Context::DHCP6: - case isc::dhcp::Parser6Context::DHCP_DDNS: case isc::dhcp::Parser6Context::SUBNET6: case isc::dhcp::Parser6Context::SHARED_NETWORK: return isc::dhcp::Dhcp6Parser::make_HOSTNAME_CHAR_SET(driver.loc_); @@ -321,7 +275,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] \"hostname-char-replacement\" { switch(driver.ctx_) { case isc::dhcp::Parser6Context::DHCP6: - case isc::dhcp::Parser6Context::DHCP_DDNS: case isc::dhcp::Parser6Context::SUBNET6: case isc::dhcp::Parser6Context::SHARED_NETWORK: return isc::dhcp::Dhcp6Parser::make_HOSTNAME_CHAR_REPLACEMENT(driver.loc_); diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index c54ed4aa60..bdf9d5aeec 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -240,7 +240,6 @@ using namespace std; DHCP_DDNS "dhcp-ddns" ENABLE_UPDATES "enable-updates" - QUALIFYING_SUFFIX "qualifying-suffix" SERVER_IP "server-ip" SERVER_PORT "server-port" SENDER_IP "sender-ip" @@ -248,10 +247,6 @@ using namespace std; MAX_QUEUE_SIZE "max-queue-size" NCR_PROTOCOL "ncr-protocol" NCR_FORMAT "ncr-format" - OVERRIDE_NO_UPDATE "override-no-update" - OVERRIDE_CLIENT_UPDATE "override-client-update" - REPLACE_CLIENT_NAME "replace-client-name" - GENERATED_PREFIX "generated-prefix" UDP "UDP" TCP "TCP" JSON "JSON" @@ -691,8 +686,8 @@ ddns_override_client_update: DDNS_OVERRIDE_CLIENT_UPDATE COLON BOOLEAN { }; ddns_replace_client_name: DDNS_REPLACE_CLIENT_NAME { - ctx.unique("ddns-replace-client-name", ctx.loc2pos(@1)); ctx.enter(ctx.REPLACE_CLIENT_NAME); + ctx.unique("ddns-replace-client-name", ctx.loc2pos(@1)); } COLON ddns_replace_client_name_value { ctx.stack_.back()->set("ddns-replace-client-name", $4); ctx.leave(); @@ -712,7 +707,7 @@ ddns_replace_client_name_value: $$ = ElementPtr(new StringElement("when-not-present", ctx.loc2pos(@1))); } | BOOLEAN { - error(@1, "boolean values for the replace-client-name are " + error(@1, "boolean values for the ddns-replace-client-name are " "no longer supported"); } ; @@ -2793,13 +2788,6 @@ dhcp_ddns_param: enable_updates | max_queue_size | ncr_protocol | ncr_format - | dep_override_no_update - | dep_override_client_update - | dep_replace_client_name - | dep_generated_prefix - | dep_qualifying_suffix - | dep_hostname_char_set - | dep_hostname_char_replacement | user_context | comment | unknown_map_entry @@ -2811,16 +2799,6 @@ enable_updates: ENABLE_UPDATES COLON BOOLEAN { ctx.stack_.back()->set("enable-updates", b); }; -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_qualifying_suffix: QUALIFYING_SUFFIX { - ctx.unique("qualifying-suffix", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("qualifying-suffix", s); - ctx.leave(); -}; - server_ip: SERVER_IP { ctx.unique("server-ip", ctx.loc2pos(@1)); ctx.enter(ctx.NO_KEYWORD); @@ -2879,60 +2857,6 @@ ncr_format: NCR_FORMAT { ctx.leave(); }; -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_override_no_update: OVERRIDE_NO_UPDATE COLON BOOLEAN { - ctx.unique("override-no-update", ctx.loc2pos(@1)); - ElementPtr b(new BoolElement($3, ctx.loc2pos(@3))); - ctx.stack_.back()->set("override-no-update", b); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_override_client_update: OVERRIDE_CLIENT_UPDATE COLON BOOLEAN { - ctx.unique("override-client-update", ctx.loc2pos(@1)); - ElementPtr b(new BoolElement($3, ctx.loc2pos(@3))); - ctx.stack_.back()->set("override-client-update", b); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_replace_client_name: REPLACE_CLIENT_NAME { - ctx.unique("replace-client-name", ctx.loc2pos(@1)); - ctx.enter(ctx.REPLACE_CLIENT_NAME); -} COLON ddns_replace_client_name_value { - ctx.stack_.back()->set("replace-client-name", $4); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_generated_prefix: GENERATED_PREFIX { - ctx.unique("generated-prefix", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("generated-prefix", s); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_hostname_char_set: HOSTNAME_CHAR_SET { - ctx.unique("hostname-char-set", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("hostname-char-set", s); - ctx.leave(); -}; - -// Deprecated, moved to global/network scopes. Eventually it should be removed. -dep_hostname_char_replacement: HOSTNAME_CHAR_REPLACEMENT { - ctx.unique("hostname-char-replacement", ctx.loc2pos(@1)); - ctx.enter(ctx.NO_KEYWORD); -} COLON STRING { - ElementPtr s(new StringElement($4, ctx.loc2pos(@4))); - ctx.stack_.back()->set("hostname-char-replacement", s); - ctx.leave(); -}; - - // Config control information element config_control: CONFIG_CONTROL { diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 319d5ffe38..13dc444ba2 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -743,7 +743,7 @@ protected: /// - If there is a Client FQDN but no reserved hostname then both the /// FQDN and lease hostname will be equal to the name provided in the /// client FQDN adjusted according the DhcpDdns configuration - /// parameters (e.g.replace-client-name, qualifying suffix...). + /// parameters (e.g. ddns-replace-client-name, ddns-qualifying-suffix...). /// /// All the logic required to form appropriate answer to the client is /// held in this function. diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index c5cf8772b4..cd7fa99e5d 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -454,12 +454,6 @@ processDhcp6Config(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 compatibility. - srv_config->moveDdnsParams(mutable_cfg); - // Move from reservation mode to new reservations flags. // @todo add warning BaseNetworkParser::moveReservationMode(mutable_cfg); diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 1a7fa160ad..6ecc515837 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -5152,168 +5152,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfigValid) { checkGlobal("ddns-qualifying-suffix", ""); } -// This test verifies that valid but deprecated dhcp-ddns parameters -// get moved to the global scope when they do not already exist there. -TEST_F(Dhcp6ParserTest, d2ClientConfigMoveToGlobal) { - // 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()); - - // Verify that the convenience method agrees. - ASSERT_FALSE(CfgMgr::instance().ddnsEnabled()); - - string config_str = "{ " + genIfaceConfig() + "," - "\"preferred-lifetime\": 3000," - "\"rebind-timer\": 2000, " - "\"renew-timer\": 1000, " - "\"subnet6\": [ { " - " \"id\": 1," - " \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ]," - " \"subnet\": \"2001:db8:1::/64\" } ], " - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"server-ip\" : \"3001::1\", " - " \"server-port\" : 777, " - " \"sender-ip\" : \"3001::2\", " - " \"sender-port\" : 778, " - " \"max-queue-size\" : 2048, " - " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"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-Z]\", " - " \"hostname-char-replacement\" : \"x\"}, " - "\"valid-lifetime\": 4000 }"; - - // Convert the JSON string to configuration elements. - ConstElementPtr config; - ASSERT_NO_THROW(config = parseDHCP6(config_str)); - extractConfig(config_str); - - // Pass the configuration in for parsing. - ConstElementPtr status; - EXPECT_NO_THROW(status = Dhcpv6SrvTest::configure(srv_, config)); - - // check if returned status is OK - checkResult(status, 0); - - // Verify that DHCP-DDNS updating is enabled. - EXPECT_TRUE(CfgMgr::instance().ddnsEnabled()); - - // Verify that the D2 configuration can be retrieved. - d2_client_config = CfgMgr::instance().getD2ClientConfig(); - ASSERT_TRUE(d2_client_config); - - // Verify that the configuration values are correct. - EXPECT_TRUE(d2_client_config->getEnableUpdates()); - EXPECT_EQ("3001::1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); - EXPECT_EQ("3001::2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); - EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); - EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); - - // ddns-send-updates should be global default - checkGlobal("ddns-send-updates", true); - - // The following should all have been moved from dhcp-ddns. - checkGlobal("ddns-override-no-update", true); - checkGlobal("ddns-override-client-update", true); - checkGlobal("ddns-replace-client-name", "when-present"); - checkGlobal("ddns-generated-prefix", "test.prefix"); - checkGlobal("ddns-qualifying-suffix", "test.suffix."); - checkGlobal("hostname-char-set", "[^A-Z]"); - checkGlobal("hostname-char-replacement", "x"); -} - -// This test verifies that explicit global values override deprecated -// dhcp-ddns parameters (i.e. global scope wins) -TEST_F(Dhcp6ParserTest, d2ClientConfigBoth) { - // 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()); - - // Verify that the convenience method agrees. - ASSERT_FALSE(CfgMgr::instance().ddnsEnabled()); - - string config_str = "{ " + genIfaceConfig() + "," - "\"preferred-lifetime\": 3000," - "\"rebind-timer\": 2000, " - "\"renew-timer\": 1000, " - "\"subnet6\": [ { " - " \"id\": 1," - " \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ]," - " \"subnet\": \"2001:db8:1::/64\" } ], " - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"server-ip\" : \"3001::1\", " - " \"server-port\" : 777, " - " \"sender-ip\" : \"3001::2\", " - " \"sender-port\" : 778, " - " \"max-queue-size\" : 2048, " - " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : false, " - " \"override-client-update\" : false, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"d2.prefix\", " - " \"qualifying-suffix\" : \"d2.suffix.\", " - " \"hostname-char-set\" : \"[^0-9]\", " - " \"hostname-char-replacement\" : \"z\" }, " - " \"ddns-send-updates\" : false, " - " \"ddns-override-no-update\" : true, " - " \"ddns-override-client-update\" : true, " - " \"ddns-replace-client-name\" : \"always\", " - " \"ddns-generated-prefix\" : \"global.prefix\", " - " \"ddns-qualifying-suffix\" : \"global.suffix.\", " - " \"hostname-char-set\" : \"[^A-Z]\", " - " \"hostname-char-replacement\" : \"x\", " - "\"valid-lifetime\": 4000 }"; - - // Convert the JSON string to configuration elements. - ConstElementPtr config; - ASSERT_NO_THROW(config = parseDHCP6(config_str)); - extractConfig(config_str); - - // Pass the configuration in for parsing. - ConstElementPtr status; - EXPECT_NO_THROW(status = Dhcpv6SrvTest::configure(srv_, config)); - - // check if returned status is OK - checkResult(status, 0); - - // Verify that DHCP-DDNS updating is enabled. - EXPECT_TRUE(CfgMgr::instance().ddnsEnabled()); - - // Verify that the D2 configuration can be retrieved. - d2_client_config = CfgMgr::instance().getD2ClientConfig(); - ASSERT_TRUE(d2_client_config); - - // Verify that the configuration values are correct. - EXPECT_TRUE(d2_client_config->getEnableUpdates()); - EXPECT_EQ("3001::1", d2_client_config->getServerIp().toText()); - EXPECT_EQ(777, d2_client_config->getServerPort()); - EXPECT_EQ("3001::2", d2_client_config->getSenderIp().toText()); - EXPECT_EQ(778, d2_client_config->getSenderPort()); - EXPECT_EQ(2048, d2_client_config->getMaxQueueSize()); - EXPECT_EQ(dhcp_ddns::NCR_UDP, d2_client_config->getNcrProtocol()); - EXPECT_EQ(dhcp_ddns::FMT_JSON, d2_client_config->getNcrFormat()); - - // Verify all global values won. - checkGlobal("ddns-send-updates", false); - checkGlobal("ddns-override-no-update", true); - checkGlobal("ddns-override-client-update", true); - checkGlobal("ddns-replace-client-name", "always"); - checkGlobal("ddns-generated-prefix", "global.prefix"); - checkGlobal("ddns-qualifying-suffix", "global.suffix."); - checkGlobal("hostname-char-set", "[^A-Z]"); - checkGlobal("hostname-char-replacement", "x"); -} - // This test checks the ability of the server to handle a configuration // containing an invalid dhcp-ddns (D2ClientConfig) entry. TEST_F(Dhcp6ParserTest, invalidD2ClientConfig) { @@ -5322,6 +5160,11 @@ TEST_F(Dhcp6ParserTest, invalidD2ClientConfig) { string config_str = "{ " + genIfaceConfig() + "," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet6\": [ { " " \"id\": 1," " \"pools\": [ { \"pool\": \"2001:db8:1::/80\" } ]," @@ -5331,12 +5174,7 @@ TEST_F(Dhcp6ParserTest, invalidD2ClientConfig) { " \"server-ip\" : \"bogus-value\", " " \"server-port\" : 5301, " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; // Convert the JSON string to configuration elements. diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc index e4d592bfdd..db8205362a 100644 --- a/src/bin/dhcp6/tests/d2_unittest.cc +++ b/src/bin/dhcp6/tests/d2_unittest.cc @@ -103,6 +103,11 @@ Dhcp6SrvD2Test::configureD2(bool enable_d2, const bool exp_result, "\"preferred-lifetime\": 3000," "\"rebind-timer\": 2000, " "\"renew-timer\": 1000, " + "\"ddns-override-no-update\" : true, " + "\"ddns-override-client-update\" : true, " + "\"ddns-replace-client-name\" : \"when-present\", " + "\"ddns-generated-prefix\" : \"test.prefix\", " + "\"ddns-qualifying-suffix\" : \"test.suffix.\", " "\"subnet6\": [ { " " \"id\": 1, " " \"pools\": [ { \"pool\": \"2001:db8:1::1 - 2001:db8:1::ffff\" } ]," @@ -115,12 +120,7 @@ Dhcp6SrvD2Test::configureD2(bool enable_d2, const bool exp_result, " \"sender-port\" : " << sender_port << ", " " \"max-queue-size\" : " << max_queue_size << ", " " \"ncr-protocol\" : \"UDP\", " - " \"ncr-format\" : \"JSON\", " - " \"override-no-update\" : true, " - " \"override-client-update\" : true, " - " \"replace-client-name\" : \"when-present\", " - " \"generated-prefix\" : \"test.prefix\", " - " \"qualifying-suffix\" : \"test.suffix.\" }," + " \"ncr-format\" : \"JSON\"}," "\"valid-lifetime\": 4000 }"; configure(config.str(), exp_result); diff --git a/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in b/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in index 3e2c5550da..2896804117 100644 --- a/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in +++ b/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in @@ -50,9 +50,9 @@ CONFIG="{ \"id\": 1, \"pools\": [ { \"pool\": \"2001:db8:1::10-2001:db8:1::100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"loggers\": [ { @@ -171,9 +171,9 @@ CONFIG_BAD_VALUES="{ \"id\": 1, \"pools\": [ { \"pool\": \"3000::-3000::ffff\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true } } }" @@ -210,9 +210,9 @@ INVALID_CONFIG_HOOKS_LOAD="{ \"id\": 1, \"pools\": [ { \"pool\": \"2001:db8:1::10-2001:db8:1::100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { @@ -267,9 +267,9 @@ INVALID_CONFIG_HOOKS_CALLOUT_FAIL_ON_LOAD="{ \"id\": 1, \"pools\": [ { \"pool\": \"2001:db8:1::10-2001:db8:1::100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { @@ -324,9 +324,9 @@ INVALID_CONFIG_HOOKS_CALLOUT_FAIL_ON_POLL="{ \"id\": 1, \"pools\": [ { \"pool\": \"2001:db8:1::10-2001:db8:1::100\" } ] } ], + \"ddns-qualifying-suffix\": \"\", \"dhcp-ddns\": { - \"enable-updates\": true, - \"qualifying-suffix\": \"\" + \"enable-updates\": true }, \"hooks-libraries\": [ { diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc index 5dc089277d..d75ed06176 100644 --- a/src/bin/dhcp6/tests/fqdn_unittest.cc +++ b/src/bin/dhcp6/tests/fqdn_unittest.cc @@ -407,10 +407,10 @@ public: } // Test that the server processes the FQDN option (or lack thereof) - // in a client request correctly, according to the replace-client-name + // in a client request correctly, according to the ddns-replace-client-name // mode configuration parameter. // - // @param mode - value to use for replace-client-name mode + // @param mode - value to use for ddns-replace-client-name mode // // @param client_name_flag - specifies whether or not the client request // should contain a hostname option @@ -428,6 +428,8 @@ public: "\"preferred-lifetime\": 3000, \n" "\"rebind-timer\": 2000, \n" "\"renew-timer\": 1000, \n" + "\"ddns-replace-client-name\": \"%s\", \n" + "\"ddns-qualifying-suffix\": \"fake-suffix.isc.org.\", \n" "\"subnet6\": [ { \n" " \"id\": 1, \n" " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ], \n" @@ -435,9 +437,7 @@ public: " \"interface\": \"eth0\" \n" " } ], \n" "\"dhcp-ddns\": { \n" - "\"enable-updates\": true, \n" - "\"qualifying-suffix\": \"fake-suffix.isc.org.\", \n" - "\"replace-client-name\": \"%s\" \n" + "\"enable-updates\": true \n" "}} \n"; // Create the configuration and configure the server @@ -726,7 +726,7 @@ TEST_F(FqdnDhcpv6SrvTest, noUpdate) { } // Test server's response when client requests no DNS update and -// override-no-updates is true. +// ddns-override-no-updates is true. TEST_F(FqdnDhcpv6SrvTest, overrideNoUpdate) { enableD2(OVERRIDE_NO_UPDATE); testFqdn(DHCPV6_SOLICIT, Option6ClientFqdn::FLAG_N, @@ -1473,7 +1473,7 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationSuffix) { " \"id\": 1, \n" " \"subnet\": \"2001:db8:1::/48\", " " \"pools\": [ { \"pool\": \"2001:db8:1:1::/64\" } ]," - " \"interface\" : \"eth0\" , " + " \"interface\": \"eth0\" , " " \"reservations\": [" " {" " \"duid\": \"" + duid_->toText() + "\"," @@ -1482,9 +1482,9 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationSuffix) { " }" " ]" " } ]," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"qualifying-suffix\" : \"example.com\" }" + " \"ddns-qualifying-suffix\": \"example.com\", " + " \"dhcp-ddns\": {" + " \"enable-updates\": true }" "}"; configure(config_str); @@ -1528,7 +1528,7 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationNoSuffix) { " \"id\": 1, \n" " \"subnet\": \"2001:db8:1::/48\", " " \"pools\": [ { \"pool\": \"2001:db8:1:1::/64\" } ]," - " \"interface\" : \"eth0\" , " + " \"interface\": \"eth0\" , " " \"reservations\": [" " {" " \"duid\": \"" + duid_->toText() + "\"," @@ -1537,9 +1537,9 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationNoSuffix) { " }" " ]" " } ]," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"qualifying-suffix\" : \"\" }" + " \"ddns-qualifying-suffix\": \"\", " + " \"dhcp-ddns\": {" + " \"enable-updates\": true }" "}"; configure(config_str); @@ -1578,7 +1578,7 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationDdnsDisabled) { " \"id\": 1, \n" " \"subnet\": \"2001:db8:1::/48\", " " \"pools\": [ { \"pool\": \"2001:db8:1:1::/64\" } ]," - " \"interface\" : \"eth0\" , " + " \"interface\": \"eth0\" , " " \"reservations\": [" " {" " \"duid\": \"" + duid_->toText() + "\"," @@ -1587,9 +1587,9 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationDdnsDisabled) { " }" " ]" " } ]," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : false, " - " \"qualifying-suffix\" : \"disabled.example.com\" }" + " \"ddns-qualifying-suffix\": \"disabled.example.com\", " + " \"dhcp-ddns\": {" + " \"enable-updates\": false }" "}"; configure(config_str); @@ -1604,7 +1604,7 @@ TEST_F(FqdnDhcpv6SrvTest, hostnameReservationDdnsDisabled) { IOAddress("2001:db8:1:1::babe")); } -// Verifies that the replace-client-name behavior is correct for each of +// Verifies that the ddns-replace-client-name behavior is correct for each of // the supported modes. TEST_F(FqdnDhcpv6SrvTest, replaceClientNameModeTest) { isc::dhcp::test::IfaceMgrTestConfig test_config(true); @@ -1691,8 +1691,8 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsScopeTest) { " \"ddns-send-updates\": true\n" " } ],\n" "\"valid-lifetime\": 4000,\n" - " \"dhcp-ddns\" : {\n" - " \"enable-updates\" : true\n" + " \"dhcp-ddns\": {\n" + " \"enable-updates\": true\n" " }\n" "}"; @@ -1792,8 +1792,8 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest) { " } ] \n" "} ], \n" "\"ddns-send-updates\": true, \n" - "\"dhcp-ddns\" : { \n" - " \"enable-updates\" : true \n" + "\"dhcp-ddns\": { \n" + " \"enable-updates\": true \n" " } \n" "}"; @@ -1949,8 +1949,8 @@ TEST_F(FqdnDhcpv6SrvTest, ddnsSharedNetworkTest2) { "\"ddns-send-updates\": false \n" " } ] \n" "} ], \n" - "\"dhcp-ddns\" : { \n" - " \"enable-updates\" : true \n" + "\"dhcp-ddns\": { \n" + " \"enable-updates\": true \n" " } \n" "}"; diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 343434b9b6..83c306f56c 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -1166,92 +1166,6 @@ const char* EXTRACTED_CONFIGS[] = { " }\n", // CONFIGURATION 36 "{\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"generated-prefix\": \"test.prefix\",\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"override-client-update\": true,\n" -" \"override-no-update\": true,\n" -" \"qualifying-suffix\": \"test.suffix.\",\n" -" \"replace-client-name\": \"when-present\",\n" -" \"sender-ip\": \"3001::2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"3001::1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"preferred-lifetime\": 3000,\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"subnet6\": [\n" -" {\n" -" \"id\": 1,\n" -" \"pools\": [\n" -" {\n" -" \"pool\": \"2001:db8:1::/80\"\n" -" }\n" -" ],\n" -" \"subnet\": \"2001:db8:1::/64\"\n" -" }\n" -" ],\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 37 -"{\n" -" \"ddns-generated-prefix\": \"global.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"global.suffix.\",\n" -" \"ddns-replace-client-name\": \"always\",\n" -" \"ddns-send-updates\": false,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"generated-prefix\": \"d2.prefix\",\n" -" \"hostname-char-replacement\": \"z\",\n" -" \"hostname-char-set\": \"[^0-9]\",\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"override-client-update\": false,\n" -" \"override-no-update\": false,\n" -" \"qualifying-suffix\": \"d2.suffix.\",\n" -" \"replace-client-name\": \"when-present\",\n" -" \"sender-ip\": \"3001::2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"3001::1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"preferred-lifetime\": 3000,\n" -" \"rebind-timer\": 2000,\n" -" \"renew-timer\": 1000,\n" -" \"subnet6\": [\n" -" {\n" -" \"id\": 1,\n" -" \"pools\": [\n" -" {\n" -" \"pool\": \"2001:db8:1::/80\"\n" -" }\n" -" ],\n" -" \"subnet\": \"2001:db8:1::/64\"\n" -" }\n" -" ],\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 38 -"{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" " \"re-detect\": false\n" @@ -1337,7 +1251,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 37 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1377,7 +1291,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 38 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1390,7 +1304,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 39 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1403,7 +1317,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 40 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -1491,7 +1405,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 41 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -1524,7 +1438,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 42 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1537,7 +1451,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 43 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1545,7 +1459,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 44 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1553,7 +1467,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 45 "{\n" " \"decline-probation-period\": 12345,\n" " \"interfaces-config\": {\n" @@ -1562,7 +1476,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 46 "{\n" " \"expired-leases-processing\": {\n" " \"flush-reclaimed-timer-wait-time\": 35,\n" @@ -1578,7 +1492,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 47 "{\n" " \"client-classes\": [\n" " {\n" @@ -1611,7 +1525,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 48 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1633,7 +1547,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 49 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1656,7 +1570,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 50 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1684,7 +1598,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 51 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1712,7 +1626,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 52 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1736,7 +1650,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 53 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1761,7 +1675,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 54 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1791,7 +1705,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 55 "{\n" " \"hosts-databases\": [\n" " {\n" @@ -1816,7 +1730,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 56 "{\n" " \"client-classes\": [\n" " {\n" @@ -1941,7 +1855,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"comment\": \"A DHCPv6 server\"\n" " }\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 57 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2006,7 +1920,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 58 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2019,7 +1933,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"statistic-default-sample-count\": 10,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 59 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2027,7 +1941,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 60 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2040,7 +1954,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 61 "{\n" " \"client-classes\": [\n" " {\n" @@ -2072,7 +1986,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 62 "{\n" " \"client-classes\": [\n" " {\n" @@ -2106,7 +2020,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 65 + // CONFIGURATION 63 "{\n" " \"ddns-conflict-resolution-mode\": \"no-check-with-dhcid\",\n" " \"interfaces-config\": {\n" @@ -7030,250 +6944,6 @@ const char* UNPARSED_CONFIGS[] = { " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" " \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" -" \"ddns-generated-prefix\": \"test.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"test.suffix.\",\n" -" \"ddns-replace-client-name\": \"when-present\",\n" -" \"ddns-send-updates\": true,\n" -" \"ddns-update-on-renew\": false,\n" -" \"decline-probation-period\": 86400,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"sender-ip\": \"3001::2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"3001::1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"dhcp-queue-control\": {\n" -" \"capacity\": 64,\n" -" \"enable-queue\": false,\n" -" \"queue-type\": \"kea-ring6\"\n" -" },\n" -" \"dhcp4o6-port\": 0,\n" -" \"early-global-reservations-lookup\": false,\n" -" \"expired-leases-processing\": {\n" -" \"flush-reclaimed-timer-wait-time\": 25,\n" -" \"hold-reclaimed-time\": 3600,\n" -" \"max-reclaim-leases\": 100,\n" -" \"max-reclaim-time\": 250,\n" -" \"reclaim-timer-wait-time\": 10,\n" -" \"unwarned-reclaim-cycles\": 5\n" -" },\n" -" \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\" ],\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"ip-reservations-unique\": true,\n" -" \"lease-database\": {\n" -" \"type\": \"memfile\"\n" -" },\n" -" \"mac-sources\": [ \"any\" ],\n" -" \"multi-threading\": {\n" -" \"enable-multi-threading\": true,\n" -" \"packet-queue-size\": 64,\n" -" \"thread-pool-size\": 0\n" -" },\n" -" \"option-data\": [ ],\n" -" \"option-def\": [ ],\n" -" \"parked-packet-limit\": 256,\n" -" \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3000,\n" -" \"rebind-timer\": 2000,\n" -" \"relay-supplied-options\": [ \"65\" ],\n" -" \"renew-timer\": 1000,\n" -" \"reservations-global\": false,\n" -" \"reservations-in-subnet\": true,\n" -" \"reservations-lookup-first\": false,\n" -" \"reservations-out-of-pool\": false,\n" -" \"sanity-checks\": {\n" -" \"extended-info-checks\": \"fix\",\n" -" \"lease-checks\": \"warn\"\n" -" },\n" -" \"server-id\": {\n" -" \"enterprise-id\": 0,\n" -" \"htype\": 0,\n" -" \"identifier\": \"\",\n" -" \"persist\": true,\n" -" \"time\": 0,\n" -" \"type\": \"LLT\"\n" -" },\n" -" \"server-tag\": \"\",\n" -" \"shared-networks\": [ ],\n" -" \"statistic-default-sample-age\": 0,\n" -" \"statistic-default-sample-count\": 20,\n" -" \"store-extended-info\": false,\n" -" \"subnet6\": [\n" -" {\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": true,\n" -" \"id\": 1,\n" -" \"max-preferred-lifetime\": 3000,\n" -" \"max-valid-lifetime\": 4000,\n" -" \"min-preferred-lifetime\": 3000,\n" -" \"min-valid-lifetime\": 4000,\n" -" \"option-data\": [ ],\n" -" \"pd-allocator\": \"iterative\",\n" -" \"pd-pools\": [ ],\n" -" \"pools\": [\n" -" {\n" -" \"option-data\": [ ],\n" -" \"pool\": \"2001:db8:1::/80\"\n" -" }\n" -" ],\n" -" \"preferred-lifetime\": 3000,\n" -" \"rapid-commit\": false,\n" -" \"rebind-timer\": 2000,\n" -" \"relay\": {\n" -" \"ip-addresses\": [ ]\n" -" },\n" -" \"renew-timer\": 1000,\n" -" \"reservations\": [ ],\n" -" \"store-extended-info\": false,\n" -" \"subnet\": \"2001:db8:1::/64\",\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.8,\n" -" \"valid-lifetime\": 4000\n" -" }\n" -" ],\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.8,\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 37 -"{\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": true,\n" -" \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" -" \"ddns-generated-prefix\": \"global.prefix\",\n" -" \"ddns-override-client-update\": true,\n" -" \"ddns-override-no-update\": true,\n" -" \"ddns-qualifying-suffix\": \"global.suffix.\",\n" -" \"ddns-replace-client-name\": \"always\",\n" -" \"ddns-send-updates\": false,\n" -" \"ddns-update-on-renew\": false,\n" -" \"decline-probation-period\": 86400,\n" -" \"dhcp-ddns\": {\n" -" \"enable-updates\": true,\n" -" \"max-queue-size\": 2048,\n" -" \"ncr-format\": \"JSON\",\n" -" \"ncr-protocol\": \"UDP\",\n" -" \"sender-ip\": \"3001::2\",\n" -" \"sender-port\": 778,\n" -" \"server-ip\": \"3001::1\",\n" -" \"server-port\": 777\n" -" },\n" -" \"dhcp-queue-control\": {\n" -" \"capacity\": 64,\n" -" \"enable-queue\": false,\n" -" \"queue-type\": \"kea-ring6\"\n" -" },\n" -" \"dhcp4o6-port\": 0,\n" -" \"early-global-reservations-lookup\": false,\n" -" \"expired-leases-processing\": {\n" -" \"flush-reclaimed-timer-wait-time\": 25,\n" -" \"hold-reclaimed-time\": 3600,\n" -" \"max-reclaim-leases\": 100,\n" -" \"max-reclaim-time\": 250,\n" -" \"reclaim-timer-wait-time\": 10,\n" -" \"unwarned-reclaim-cycles\": 5\n" -" },\n" -" \"hooks-libraries\": [ ],\n" -" \"host-reservation-identifiers\": [ \"hw-address\", \"duid\" ],\n" -" \"hostname-char-replacement\": \"x\",\n" -" \"hostname-char-set\": \"[^A-Z]\",\n" -" \"interfaces-config\": {\n" -" \"interfaces\": [ \"*\" ],\n" -" \"re-detect\": false\n" -" },\n" -" \"ip-reservations-unique\": true,\n" -" \"lease-database\": {\n" -" \"type\": \"memfile\"\n" -" },\n" -" \"mac-sources\": [ \"any\" ],\n" -" \"multi-threading\": {\n" -" \"enable-multi-threading\": true,\n" -" \"packet-queue-size\": 64,\n" -" \"thread-pool-size\": 0\n" -" },\n" -" \"option-data\": [ ],\n" -" \"option-def\": [ ],\n" -" \"parked-packet-limit\": 256,\n" -" \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3000,\n" -" \"rebind-timer\": 2000,\n" -" \"relay-supplied-options\": [ \"65\" ],\n" -" \"renew-timer\": 1000,\n" -" \"reservations-global\": false,\n" -" \"reservations-in-subnet\": true,\n" -" \"reservations-lookup-first\": false,\n" -" \"reservations-out-of-pool\": false,\n" -" \"sanity-checks\": {\n" -" \"extended-info-checks\": \"fix\",\n" -" \"lease-checks\": \"warn\"\n" -" },\n" -" \"server-id\": {\n" -" \"enterprise-id\": 0,\n" -" \"htype\": 0,\n" -" \"identifier\": \"\",\n" -" \"persist\": true,\n" -" \"time\": 0,\n" -" \"type\": \"LLT\"\n" -" },\n" -" \"server-tag\": \"\",\n" -" \"shared-networks\": [ ],\n" -" \"statistic-default-sample-age\": 0,\n" -" \"statistic-default-sample-count\": 20,\n" -" \"store-extended-info\": false,\n" -" \"subnet6\": [\n" -" {\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": true,\n" -" \"id\": 1,\n" -" \"max-preferred-lifetime\": 3000,\n" -" \"max-valid-lifetime\": 4000,\n" -" \"min-preferred-lifetime\": 3000,\n" -" \"min-valid-lifetime\": 4000,\n" -" \"option-data\": [ ],\n" -" \"pd-allocator\": \"iterative\",\n" -" \"pd-pools\": [ ],\n" -" \"pools\": [\n" -" {\n" -" \"option-data\": [ ],\n" -" \"pool\": \"2001:db8:1::/80\"\n" -" }\n" -" ],\n" -" \"preferred-lifetime\": 3000,\n" -" \"rapid-commit\": false,\n" -" \"rebind-timer\": 2000,\n" -" \"relay\": {\n" -" \"ip-addresses\": [ ]\n" -" },\n" -" \"renew-timer\": 1000,\n" -" \"reservations\": [ ],\n" -" \"store-extended-info\": false,\n" -" \"subnet\": \"2001:db8:1::/64\",\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.8,\n" -" \"valid-lifetime\": 4000\n" -" }\n" -" ],\n" -" \"t1-percent\": 0.5,\n" -" \"t2-percent\": 0.8,\n" -" \"valid-lifetime\": 4000\n" -" }\n", - // CONFIGURATION 38 -"{\n" -" \"allocator\": \"iterative\",\n" -" \"calculate-tee-times\": true,\n" -" \"ddns-conflict-resolution-mode\": \"check-with-dhcid\",\n" " \"ddns-generated-prefix\": \"myhost\",\n" " \"ddns-override-client-update\": false,\n" " \"ddns-override-no-update\": false,\n" @@ -7534,7 +7204,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 37 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7680,7 +7350,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 38 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7770,7 +7440,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 39 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7860,7 +7530,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 40 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8184,7 +7854,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 41 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8340,7 +8010,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 42 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8430,7 +8100,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 43 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8517,7 +8187,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 44 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8604,7 +8274,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 45 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8691,7 +8361,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 46 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8778,7 +8448,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 47 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8914,7 +8584,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 48 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9036,7 +8706,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 49 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9159,7 +8829,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 50 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9287,7 +8957,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 51 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9415,7 +9085,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 52 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9539,7 +9209,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 53 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9664,7 +9334,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 54 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9794,7 +9464,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 55 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9898,7 +9568,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 56 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10141,7 +9811,7 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 57 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10371,7 +10041,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 58 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10461,7 +10131,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 59 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10548,7 +10218,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 60 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10635,7 +10305,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 61 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10765,7 +10435,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 62 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10897,7 +10567,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 65 + // CONFIGURATION 63 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc.skel b/src/bin/dhcp6/tests/get_config_unittest.cc.skel index 9c3e54772e..b07abaa16d 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp6/tests/get_config_unittest.cc.skel @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/bin/dhcp6/tests/sarr_unittest.cc b/src/bin/dhcp6/tests/sarr_unittest.cc index 055ddd0729..4371bc97ea 100644 --- a/src/bin/dhcp6/tests/sarr_unittest.cc +++ b/src/bin/dhcp6/tests/sarr_unittest.cc @@ -117,9 +117,9 @@ const char* CONFIGS[] = { " \"rapid-commit\": false" " } ]," "\"valid-lifetime\": 4000," - " \"dhcp-ddns\" : {" - " \"enable-updates\" : true, " - " \"qualifying-suffix\" : \"example.com\" }" + " \"ddns-qualifying-suffix\": \"example.com\", " + " \"dhcp-ddns\": {" + " \"enable-updates\": true }" "}", // Configuration 2 diff --git a/src/lib/dhcpsrv/d2_client_cfg.cc b/src/lib/dhcpsrv/d2_client_cfg.cc index 78d7ffd75c..b26ebc5f2a 100644 --- a/src/lib/dhcpsrv/d2_client_cfg.cc +++ b/src/lib/dhcpsrv/d2_client_cfg.cc @@ -208,7 +208,6 @@ D2ClientConfig::toElement() const { result->set("ncr-protocol", Element::create(dhcp_ddns::ncrProtocolToString(ncr_protocol_))); // Set ncr-format result->set("ncr-format", Element::create(dhcp_ddns::ncrFormatToString(ncr_format_))); - // Set override-no-update return (result); } diff --git a/src/lib/dhcpsrv/d2_client_mgr.h b/src/lib/dhcpsrv/d2_client_mgr.h index ecd755fcbd..c9f44c98c7 100644 --- a/src/lib/dhcpsrv/d2_client_mgr.h +++ b/src/lib/dhcpsrv/d2_client_mgr.h @@ -108,9 +108,9 @@ public: /// @brief Determines server flags based on configuration and client flags. /// /// This method uses input values for the client's FQDN S and N flags, in - /// conjunction with the configuration parameters updates-enabled, override- - /// no-updates, and override-client-updates to determine the values that - /// should be used for the server's FQDN S and N flags. + /// conjunction with the configuration parameters updates-enabled, + /// ddns-override-no-updates, and ddns-override-client-updates to determine + /// the values that should be used for the server's FQDN S and N flags. /// The logic in this method is based upon RFCs 4702 and 4704, and is /// shown in the following truth table: /// @@ -158,12 +158,13 @@ public: /// @brief Builds a FQDN based on the configuration and given IP address. /// - /// Using the current values for generated-prefix, qualifying-suffix and - /// an IP address, this method constructs a fully qualified domain name. + /// Using the current values for ddns-generated-prefix, + /// ddns-qualifying-suffix and an IP address, this method constructs a fully + /// qualified domain name. /// It supports both IPv4 and IPv6 addresses. The format of the name /// is as follows: /// - /// <generated-prefix>-<ip address>.<qualifying-suffix>. + /// <ddns-generated-prefix>-<ip address>.<ddns-qualifying-suffix>. /// /// <ip-address> is the result of IOAddress.toText() with the delimiters /// ('.' for IPv4 or ':' for IPv6) replaced with a hyphen, '-'. @@ -180,10 +181,10 @@ public: /// @brief Adds a qualifying suffix to a given domain name /// - /// Constructs a FQDN based on the configured qualifying-suffix and + /// Constructs a FQDN based on the configured ddns-qualifying-suffix and /// a partial domain name as follows: /// - /// <partial_name>.<qualifying-suffix>. + /// <partial_name>.<ddns-qualifying-suffix>. /// /// Note that the qualifying suffix will only be appended if the /// input name does not already end with that suffix. @@ -202,7 +203,7 @@ public: /// @brief Set server FQDN flags based on configuration and a given FQDN /// - /// Templated wrapper around the analyzeFqdn() allowing that method to + /// Template wrapper around the analyzeFqdn() allowing that method to /// be used for either IPv4 or IPv6 processing. This methods resets all /// of the flags in the response to zero and then sets the S,N, and O /// flags. Any other flags are the responsibility of the invoking layer. @@ -218,7 +219,7 @@ public: /// @brief Get directional update flags based on server FQDN flags /// - /// Templated convenience method which determines whether forward and + /// Template convenience method which determines whether forward and /// reverse updates should be performed based on a server response version /// of the FQDN flags. The logic is straight forward and currently not /// dependent upon configuration specific values: @@ -238,18 +239,18 @@ public: /// @brief Set server FQDN name based on configuration and a given FQDN /// - /// Templated method which adjusts the domain name value and type in + /// Template method which adjusts the domain name value and type in /// a server FQDN from a client (inbound) FQDN and the current /// configuration. The logic is as follows: /// - /// If replace-client-name is true or the supplied name is empty, the + /// If ddns-replace-client-name is true or the supplied name is empty, the /// server FQDN is set to ""/PARTIAL. /// - /// If replace-client-name is false and the supplied name is a partial + /// If ddns-replace-client-name is false and the supplied name is a partial /// name the server FQDN is set to the supplied name qualified by - /// appending the qualifying-suffix. + /// appending the ddns-qualifying-suffix. /// - /// If replace-client-name is false and the supplied name is a fully + /// If ddns-replace-client-name is false and the supplied name is a fully /// qualified name, set the server FQDN to the supplied name. /// /// If hostname-char-set is not empty, the inbound name will be diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index 30a6ad8124..3979dc467b 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -964,56 +964,6 @@ SrvConfig::getDdnsParams(const Subnet6Ptr& subnet) const { } void -SrvConfig::moveDdnsParams(isc::data::ElementPtr srv_elem) { - if (!srv_elem || (srv_elem->getType() != Element::map)) { - isc_throw(BadValue, "moveDdnsParams server config must be given a map element"); - } - - if (!srv_elem->contains("dhcp-ddns")) { - /* nothing to do */ - return; - } - - ElementPtr d2_elem = boost::const_pointer_cast<Element>(srv_elem->get("dhcp-ddns")); - if (!d2_elem || (d2_elem->getType() != Element::map)) { - isc_throw(BadValue, "moveDdnsParams dhcp-ddns is not a map"); - } - - struct Param { - std::string from_name; - std::string to_name; - }; - - std::vector<Param> params { - { "override-no-update", "ddns-override-no-update" }, - { "override-client-update", "ddns-override-client-update" }, - { "replace-client-name", "ddns-replace-client-name" }, - { "generated-prefix", "ddns-generated-prefix" }, - { "qualifying-suffix", "ddns-qualifying-suffix" }, - { "hostname-char-set", "hostname-char-set" }, - { "hostname-char-replacement", "hostname-char-replacement" } - }; - - for (auto const& param : params) { - if (d2_elem->contains(param.from_name)) { - if (!srv_elem->contains(param.to_name)) { - // No global value for it already, so let's add it. - srv_elem->set(param.to_name, d2_elem->get(param.from_name)); - LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_DDNS_PARAMETER_MOVED) - .arg(param.from_name).arg(param.to_name); - } else { - // Already a global value, we'll use it and ignore this one. - LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_DDNS_PARAMETER_IGNORED) - .arg(param.from_name).arg(param.to_name); - } - - // Now remove it from d2_data, so D2ClientCfg won't complain. - d2_elem->remove(param.from_name); - } - } -} - -void SrvConfig::setIPReservationsUnique(const bool unique) { if (!getCfgDbAccess()->getIPReservationsUnique() && unique) { LOG_WARN(dhcpsrv_logger, DHCPSRV_CFGMGR_IP_RESERVATIONS_UNIQUE_DUPLICATES_POSSIBLE); diff --git a/src/lib/dhcpsrv/srv_config.h b/src/lib/dhcpsrv/srv_config.h index c329eb6421..69c6cb9318 100644 --- a/src/lib/dhcpsrv/srv_config.h +++ b/src/lib/dhcpsrv/srv_config.h @@ -935,31 +935,6 @@ public: void sanityChecksLifetime(const SrvConfig& target_config, const std::string& name) const; - /// @brief Moves deprecated parameters from dhcp-ddns element to global element - /// - /// Given a server configuration element map, the following parameters are moved - /// from dhcp-ddns to top-level (i.e. global) element if they do not already - /// exist there: - /// - /// @code - /// From dhcp-ddns: To (global): - /// ------------------------------------------------------ - /// override-no-update ddns-override-no-update - /// override-client-update ddns-override-client-update - /// replace-client-name ddns-replace-client-name - /// generated-prefix ddns-generated-prefix - /// qualifying-suffix ddns-qualifying-suffix - /// hostname-char-set hostname-char-set - /// hostname-char-replacement hostname-char-replacement - /// @endcode - /// - /// Note that the whether or not the deprecated parameters are added - /// to the global element, they are always removed from the dhcp-ddns - /// element. - /// - /// @param srv_elem server top level map to alter - static void moveDdnsParams(isc::data::ElementPtr srv_elem); - /// @brief Configures the server to allow or disallow specifying multiple /// hosts with the same IP address/subnet. /// diff --git a/src/lib/dhcpsrv/tests/d2_client_unittest.cc b/src/lib/dhcpsrv/tests/d2_client_unittest.cc index 8dff72a7c0..3ca6b7eeeb 100644 --- a/src/lib/dhcpsrv/tests/d2_client_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_client_unittest.cc @@ -425,13 +425,13 @@ TEST_F(D2ClientMgrParamsTest, analyzeFqdnEnabledNoOverrides) { } /// @brief Tests that analyzeFqdn generates correct server S and N flags when -/// updates are enabled and override-no-update is on. +/// updates are enabled and ddns-override-no-update is on. TEST_F(D2ClientMgrParamsTest, analyzeFqdnEnabledOverrideNoUpdate) { D2ClientMgr mgr; bool server_s = false; bool server_n = false; - // Create enabled configuration with override-no-update true. + // Create enabled configuration with ddns-override-no-update true. subnet_->setDdnsSendUpdates(true); subnet_->setDdnsOverrideNoUpdate(true); subnet_->setDdnsOverrideClientUpdate(false); @@ -464,13 +464,13 @@ TEST_F(D2ClientMgrParamsTest, analyzeFqdnEnabledOverrideNoUpdate) { } /// @brief Tests that analyzeFqdn generates correct server S and N flags when -/// updates are enabled and override-client-update is on. +/// updates are enabled and ddns-override-client-update is on. TEST_F(D2ClientMgrParamsTest, analyzeFqdnEnabledOverrideClientUpdate) { D2ClientMgr mgr; bool server_s = false; bool server_n = false; - // Create enabled configuration with override-client-update true. + // Create enabled configuration with ddns-override-client-update true. subnet_->setDdnsSendUpdates(true); subnet_->setDdnsOverrideNoUpdate(false); subnet_->setDdnsOverrideClientUpdate(true); diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index c53bd2a863..f3d6bb1107 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -1315,150 +1315,6 @@ TEST_F(SrvConfigTest, mergeEmptyClientClasses) { EXPECT_TRUE(cfg_to.getClientClassDictionary()->findClass("bar")); } -// Validates SrvConfig::moveDdnsParams by ensuring that deprecated dhcp-ddns -// parameters are: -// 1. Translated to their global counterparts if they do not exist globally -// 2. Removed from the dhcp-ddns element -TEST_F(SrvConfigTest, moveDdnsParamsTest) { - DdnsParamsPtr params; - - CfgMgr::instance().setFamily(AF_INET); - - struct Scenario { - std::string description; - std::string input_cfg; - std::string exp_cfg; - }; - - std::vector<Scenario> scenarios { - { - "scenario 1, move with no global conflicts", - // input_cfg - "{\n" - " \"dhcp-ddns\": {\n" - " \"enable-updates\": true, \n" - " \"server-ip\" : \"192.0.2.0\",\n" - " \"server-port\" : 3432,\n" - " \"sender-ip\" : \"192.0.2.1\",\n" - " \"sender-port\" : 3433,\n" - " \"max-queue-size\" : 2048,\n" - " \"ncr-protocol\" : \"UDP\",\n" - " \"ncr-format\" : \"JSON\",\n" - " \"user-context\": { \"foo\": \"bar\" },\n" - " \"override-no-update\": true,\n" - " \"override-client-update\": false,\n" - " \"replace-client-name\": \"always\",\n" - " \"generated-prefix\": \"prefix\",\n" - " \"qualifying-suffix\": \"suffix.com.\",\n" - " \"hostname-char-set\": \"[^A-Z]\",\n" - " \"hostname-char-replacement\": \"x\"\n" - " }\n" - "}\n", - // exp_cfg - "{\n" - " \"dhcp-ddns\": {\n" - " \"enable-updates\": true, \n" - " \"server-ip\" : \"192.0.2.0\",\n" - " \"server-port\" : 3432,\n" - " \"sender-ip\" : \"192.0.2.1\",\n" - " \"sender-port\" : 3433,\n" - " \"max-queue-size\" : 2048,\n" - " \"ncr-protocol\" : \"UDP\",\n" - " \"ncr-format\" : \"JSON\",\n" - " \"user-context\": { \"foo\": \"bar\" }\n" - " },\n" - " \"ddns-override-no-update\": true,\n" - " \"ddns-override-client-update\": false,\n" - " \"ddns-replace-client-name\": \"always\",\n" - " \"ddns-generated-prefix\": \"prefix\",\n" - " \"ddns-qualifying-suffix\": \"suffix.com.\",\n" - " \"hostname-char-set\": \"[^A-Z]\",\n" - " \"hostname-char-replacement\": \"x\"\n" - "}\n" - }, - { - "scenario 2, globals already exist for all movable params", - // input_cfg - "{\n" - " \"dhcp-ddns\" : {\n" - " \"enable-updates\": true, \n" - " \"override-no-update\": true,\n" - " \"override-client-update\": true,\n" - " \"replace-client-name\": \"always\",\n" - " \"generated-prefix\": \"prefix\",\n" - " \"qualifying-suffix\": \"suffix.com.\",\n" - " \"hostname-char-set\": \"[^A-Z]\",\n" - " \"hostname-char-replacement\": \"x\"\n" - " },\n" - " \"ddns-override-no-update\": false,\n" - " \"ddns-override-client-update\": false,\n" - " \"ddns-replace-client-name\": \"when-present\",\n" - " \"ddns-generated-prefix\": \"org_prefix\",\n" - " \"ddns-qualifying-suffix\": \"org_suffix.com.\",\n" - " \"hostname-char-set\": \"[^a-z]\",\n" - " \"hostname-char-replacement\": \"y\"\n" - "}\n", - // exp_cfg - "{\n" - " \"dhcp-ddns\" : {\n" - " \"enable-updates\": true\n" - " },\n" - " \"ddns-override-no-update\": false,\n" - " \"ddns-override-client-update\": false,\n" - " \"ddns-replace-client-name\": \"when-present\",\n" - " \"ddns-generated-prefix\": \"org_prefix\",\n" - " \"ddns-qualifying-suffix\": \"org_suffix.com.\",\n" - " \"hostname-char-set\": \"[^a-z]\",\n" - " \"hostname-char-replacement\": \"y\"\n" - "}\n" - }, - { - "scenario 3, nothing to move", - // input_cfg - "{\n" - " \"dhcp-ddns\" : {\n" - " \"enable-updates\": true, \n" - " \"server-ip\" : \"192.0.2.0\",\n" - " \"server-port\" : 3432,\n" - " \"sender-ip\" : \"192.0.2.1\"\n" - " }\n" - "}\n", - // exp_output - "{\n" - " \"dhcp-ddns\" : {\n" - " \"enable-updates\": true, \n" - " \"server-ip\" : \"192.0.2.0\",\n" - " \"server-port\" : 3432,\n" - " \"sender-ip\" : \"192.0.2.1\"\n" - " }\n" - "}\n" - } - }; - - for (auto const& scenario : scenarios) { - SrvConfig conf(32); - ElementPtr input_cfg; - ConstElementPtr exp_cfg; - { - SCOPED_TRACE(scenario.description); - // Parse the input cfg into a mutable Element map. - ASSERT_NO_THROW(input_cfg = boost::const_pointer_cast<Element> - (Element::fromJSON(scenario.input_cfg))) - << "input_cfg didn't parse, test is broken"; - - // Parse the expected cfg into an Element map. - ASSERT_NO_THROW(exp_cfg = Element::fromJSON(scenario.exp_cfg)) - << "exp_cfg didn't parse, test is broken"; - - // Now call moveDdnsParams. - ASSERT_NO_THROW(SrvConfig::moveDdnsParams(input_cfg)); - - // Make sure the resultant configuration is as expected. - EXPECT_TRUE(input_cfg->equals(*exp_cfg)); - } - } -} - // Verifies that the scoped values for DDNS parameters can be fetched // for a given Subnet4. TEST_F(SrvConfigTest, getDdnsParamsTest4) { |