From: Thomas Markwalder Date: Mon, 8 May 2023 15:22:13 +0000 (-0400) Subject: [#2835] Replace preferred-lifetime as needed X-Git-Tag: Kea-2.3.8~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0482115cf8bf63bd98a1825f537fd18c948ab277;p=thirdparty%2Fkea.git [#2835] Replace preferred-lifetime as needed src/bin/dhcp6/tests/config_parser_unittest.cc src/bin/dhcp6/tests/get_config_unittest.cc src/bin/dhcp6/tests/simple_parser6_unittest.cc Updated tests src/lib/dhcpsrv/alloc_engine.cc AllocEngine::getLifetimes6() - modified to replace preferred lifetime with valid-lifetime * .625 it's unspecified or greater than valid-lifetime src/lib/dhcpsrv/alloc_engine_messages.mes ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME - new message src/lib/dhcpsrv/parsers/simple_parser6.cc SimpleParser6::GLOBAL6_DEFAULTS - removed preferred-lifetime src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc Updated tests --- diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 51344d0c38..59c17abb87 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -6800,7 +6800,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks1subnet) { const Subnet6SimpleCollection* subs = net->getAllSubnets(); ASSERT_TRUE(subs); EXPECT_EQ(1, subs->size()); - checkSubnet(*subs, "2001:db8::/48", 0, 0, 3600, 7200); + checkSubnet(*subs, "2001:db8::/48", 0, 0, 0, 7200); // Now make sure the subnet was added to global list of subnets. CfgSubnets6Ptr subnets6 = CfgMgr::instance().getStagingCfg()->getCfgSubnets6(); @@ -6808,7 +6808,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworks1subnet) { const Subnet6Collection* gsubs = subnets6->getAll(); ASSERT_TRUE(gsubs); - checkSubnet(*gsubs, "2001:db8::/48", 0, 0, 3600, 7200); + checkSubnet(*gsubs, "2001:db8::/48", 0, 0, 0, 7200); } // Test verifies that a proper shared-network (three subnets) is @@ -7122,7 +7122,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { // derived from shared-network level. Other parameters a derived // from global scope to shared-network level and later again to // subnet6 level. - Subnet6Ptr s = checkSubnet(*subs, "2001:db1::/48", 0, 10, 3600, 7200); + Subnet6Ptr s = checkSubnet(*subs, "2001:db1::/48", 0, 10, 0, 7200); ASSERT_TRUE(s); EXPECT_EQ("eth0", s->getIface().get()); @@ -7130,7 +7130,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { // was specified explicitly. Other parameters a derived // from global scope to shared-network level and later again to // subnet6 level. - checkSubnet(*subs, "2001:db2::/48", 0, 100, 3600, 7200); + checkSubnet(*subs, "2001:db2::/48", 0, 100, 0, 7200); EXPECT_EQ("eth0", s->getIface().get()); // Ok, now check the second shared subnet. @@ -7142,7 +7142,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveInterfaces) { EXPECT_EQ(1, subs->size()); // This subnet should derive its rebind-timer from global scope. - s = checkSubnet(*subs, "2001:db3::/48", 0, 0, 3600, 7200); + s = checkSubnet(*subs, "2001:db3::/48", 0, 0, 0, 7200); EXPECT_EQ("", s->getIface().get()); } @@ -7230,13 +7230,13 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveClientClass) { // For the first subnet, the client-class should be inherited from // shared-network level. - Subnet6Ptr s = checkSubnet(*subs, "2001:db1::/48", 0, 0, 3600, 7200); + Subnet6Ptr s = checkSubnet(*subs, "2001:db1::/48", 0, 0, 0, 7200); ASSERT_TRUE(s); EXPECT_EQ("alpha", s->getClientClass().get()); // For the second subnet, the values are overridden on subnet level. // The value should not be inherited. - s = checkSubnet(*subs, "2001:db2::/48", 0, 0, 3600, 7200); + s = checkSubnet(*subs, "2001:db2::/48", 0, 0, 0, 7200); ASSERT_TRUE(s); EXPECT_EQ("beta", s->getClientClass().get()); // beta defined on subnet level @@ -7251,7 +7251,7 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDeriveClientClass) { EXPECT_EQ(1, subs->size()); // This subnet should derive its renew-timer from global scope. - s = checkSubnet(*subs, "2001:db3::/48", 0, 0, 3600, 7200); + s = checkSubnet(*subs, "2001:db3::/48", 0, 0, 0, 7200); EXPECT_TRUE(s->getClientClass().empty()); } diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 3037935454..63bb46c773 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-2022 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 @@ -252,6 +252,30 @@ const char* EXTRACTED_CONFIGS[] = { " }\n", // CONFIGURATION 5 "{\n" +" \"compatibility\": {\n" +" \"lenient-option-parsing\": true\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" +" \"pools\": [\n" +" {\n" +" \"pool\": \"2001:db8:1::1 - 2001:db8:1::ffff\"\n" +" }\n" +" ],\n" +" \"subnet\": \"2001:db8:1::/64\"\n" +" }\n" +" ],\n" +" \"valid-lifetime\": 4000\n" +" }\n", + // CONFIGURATION 6 +"{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" " \"re-detect\": false\n" @@ -283,7 +307,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 6 + // CONFIGURATION 7 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -305,7 +329,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 7 + // CONFIGURATION 8 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -323,7 +347,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 8 + // CONFIGURATION 9 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -358,7 +382,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 9 + // CONFIGURATION 10 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -379,7 +403,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 10 + // CONFIGURATION 11 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -402,7 +426,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 11 + // CONFIGURATION 12 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -427,7 +451,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 12 + // CONFIGURATION 13 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -465,7 +489,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 13 + // CONFIGURATION 14 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -488,7 +512,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 14 + // CONFIGURATION 15 "{\n" " \"option-def\": [\n" " {\n" @@ -499,7 +523,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 15 + // CONFIGURATION 16 "{\n" " \"option-def\": [\n" " {\n" @@ -511,7 +535,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 16 + // CONFIGURATION 17 "{\n" " \"option-def\": [\n" " {\n" @@ -528,7 +552,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 17 + // CONFIGURATION 18 "{\n" " \"option-def\": [\n" " {\n" @@ -540,7 +564,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 18 + // CONFIGURATION 19 "{\n" " \"option-def\": [\n" " {\n" @@ -552,7 +576,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 19 + // CONFIGURATION 20 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -584,7 +608,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 20 + // CONFIGURATION 21 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -616,7 +640,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 21 + // CONFIGURATION 22 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -657,7 +681,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 22 + // CONFIGURATION 23 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -694,7 +718,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 23 + // CONFIGURATION 24 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -752,7 +776,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 24 + // CONFIGURATION 25 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -795,7 +819,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 25 + // CONFIGURATION 26 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -859,7 +883,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 26 + // CONFIGURATION 27 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -896,7 +920,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 27 + // CONFIGURATION 28 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -933,7 +957,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 28 + // CONFIGURATION 29 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"eth0\" ],\n" @@ -944,7 +968,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 29 + // CONFIGURATION 30 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"eth0\", \"eth1\", \"*\" ],\n" @@ -955,7 +979,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 30 + // CONFIGURATION 31 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -979,7 +1003,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 31 + // CONFIGURATION 32 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1003,7 +1027,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 32 + // CONFIGURATION 33 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1051,7 +1075,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 33 + // CONFIGURATION 34 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1084,7 +1108,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 34 + // CONFIGURATION 35 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1125,7 +1149,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 35 + // CONFIGURATION 36 "{\n" " \"dhcp-ddns\": {\n" " \"enable-updates\": true,\n" @@ -1156,7 +1180,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 36 + // CONFIGURATION 37 "{\n" " \"dhcp-ddns\": {\n" " \"enable-updates\": true,\n" @@ -1194,7 +1218,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 37 + // CONFIGURATION 38 "{\n" " \"ddns-generated-prefix\": \"global.prefix\",\n" " \"ddns-override-client-update\": true,\n" @@ -1240,7 +1264,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 38 + // CONFIGURATION 39 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1327,7 +1351,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 40 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1367,7 +1391,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 41 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1380,7 +1404,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 42 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1393,7 +1417,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 43 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -1474,7 +1498,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 44 "{\n" " \"preferred-lifetime\": 3000,\n" " \"rebind-timer\": 2000,\n" @@ -1505,7 +1529,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 45 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1518,7 +1542,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"subnet6\": [ ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 46 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1526,7 +1550,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 47 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1534,7 +1558,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 48 "{\n" " \"decline-probation-period\": 12345,\n" " \"interfaces-config\": {\n" @@ -1543,7 +1567,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 49 "{\n" " \"expired-leases-processing\": {\n" " \"flush-reclaimed-timer-wait-time\": 35,\n" @@ -1559,7 +1583,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 50 "{\n" " \"client-classes\": [\n" " {\n" @@ -1591,7 +1615,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 51 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1612,7 +1636,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 52 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1634,7 +1658,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 53 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1661,7 +1685,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 54 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1688,7 +1712,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 55 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1711,7 +1735,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 56 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1735,7 +1759,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 57 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1764,7 +1788,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 58 "{\n" " \"hosts-databases\": [\n" " {\n" @@ -1789,7 +1813,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"renew-timer\": 1000,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 59 "{\n" " \"client-classes\": [\n" " {\n" @@ -1914,7 +1938,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"comment\": \"A DHCPv6 server\"\n" " }\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 60 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1979,7 +2003,7 @@ const char* EXTRACTED_CONFIGS[] = { " ],\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 61 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -1992,7 +2016,7 @@ const char* EXTRACTED_CONFIGS[] = { " \"statistic-default-sample-count\": 10,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 62 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2000,7 +2024,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 63 "{\n" " \"interfaces-config\": {\n" " \"interfaces\": [ \"*\" ],\n" @@ -2013,7 +2037,7 @@ const char* EXTRACTED_CONFIGS[] = { " },\n" " \"subnet6\": [ ]\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 64 "{\n" " \"client-classes\": [\n" " {\n" @@ -2044,7 +2068,7 @@ const char* EXTRACTED_CONFIGS[] = { " }\n" " ]\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 65 "{\n" " \"client-classes\": [\n" " {\n" @@ -2946,6 +2970,131 @@ const char* UNPARSED_CONFIGS[] = { "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" +" \"compatibility\": {\n" +" \"lenient-option-parsing\": true\n" +" },\n" +" \"ddns-generated-prefix\": \"myhost\",\n" +" \"ddns-override-client-update\": false,\n" +" \"ddns-override-no-update\": false,\n" +" \"ddns-qualifying-suffix\": \"\",\n" +" \"ddns-replace-client-name\": \"never\",\n" +" \"ddns-send-updates\": true,\n" +" \"ddns-update-on-renew\": false,\n" +" \"ddns-use-conflict-resolution\": true,\n" +" \"decline-probation-period\": 86400,\n" +" \"dhcp-ddns\": {\n" +" \"enable-updates\": false,\n" +" \"max-queue-size\": 1024,\n" +" \"ncr-format\": \"JSON\",\n" +" \"ncr-protocol\": \"UDP\",\n" +" \"sender-ip\": \"0.0.0.0\",\n" +" \"sender-port\": 0,\n" +" \"server-ip\": \"127.0.0.1\",\n" +" \"server-port\": 53001\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\": \"\",\n" +" \"hostname-char-set\": \"[^A-Za-z0-9.-]\",\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::1-2001:db8:1::ffff\"\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 6 +"{\n" +" \"allocator\": \"iterative\",\n" +" \"calculate-tee-times\": true,\n" " \"ddns-generated-prefix\": \"myhost\",\n" " \"ddns-override-client-update\": false,\n" " \"ddns-override-no-update\": false,\n" @@ -3068,7 +3217,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 6 + // CONFIGURATION 7 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3191,7 +3340,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 7 + // CONFIGURATION 8 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3314,7 +3463,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 8 + // CONFIGURATION 9 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3475,7 +3624,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 9 + // CONFIGURATION 10 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3597,7 +3746,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 10 + // CONFIGURATION 11 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3721,7 +3870,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 11 + // CONFIGURATION 12 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3847,7 +3996,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 12 + // CONFIGURATION 13 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -3988,7 +4137,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 13 + // CONFIGURATION 14 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4112,7 +4261,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 14 + // CONFIGURATION 15 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4182,7 +4331,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -4210,7 +4358,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 15 + // CONFIGURATION 16 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4280,7 +4428,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -4308,7 +4455,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 16 + // CONFIGURATION 17 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4387,7 +4534,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -4415,7 +4561,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 17 + // CONFIGURATION 18 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4485,7 +4631,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -4513,7 +4658,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 18 + // CONFIGURATION 19 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4583,7 +4728,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -4611,7 +4755,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 19 + // CONFIGURATION 20 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4752,7 +4896,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 20 + // CONFIGURATION 21 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -4893,7 +5037,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 21 + // CONFIGURATION 22 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5044,7 +5188,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 22 + // CONFIGURATION 23 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5172,7 +5316,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 23 + // CONFIGURATION 24 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5350,7 +5494,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 24 + // CONFIGURATION 25 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5523,7 +5667,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 25 + // CONFIGURATION 26 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5702,7 +5846,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 26 + // CONFIGURATION 27 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5841,7 +5985,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 27 + // CONFIGURATION 28 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -5983,7 +6127,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 28 + // CONFIGURATION 29 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6073,7 +6217,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 29 + // CONFIGURATION 30 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6163,7 +6307,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 30 + // CONFIGURATION 31 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6285,7 +6429,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 31 + // CONFIGURATION 32 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6407,7 +6551,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 32 + // CONFIGURATION 33 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6625,7 +6769,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 33 + // CONFIGURATION 34 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6762,7 +6906,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 34 + // CONFIGURATION 35 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -6907,7 +7051,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 35 + // CONFIGURATION 36 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7029,7 +7173,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 36 + // CONFIGURATION 37 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7151,7 +7295,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 37 + // CONFIGURATION 38 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7273,7 +7417,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 38 + // CONFIGURATION 39 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7538,7 +7682,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 39 + // CONFIGURATION 40 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7684,7 +7828,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 40 + // CONFIGURATION 41 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7774,7 +7918,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 41 + // CONFIGURATION 42 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -7864,7 +8008,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 42 + // CONFIGURATION 43 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8188,7 +8332,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 43 + // CONFIGURATION 44 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8344,7 +8488,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 44 + // CONFIGURATION 45 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8434,7 +8578,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 45 + // CONFIGURATION 46 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8494,7 +8638,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -8522,7 +8665,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 46 + // CONFIGURATION 47 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8582,7 +8725,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -8610,7 +8752,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 47 + // CONFIGURATION 48 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8670,7 +8812,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -8698,7 +8839,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 48 + // CONFIGURATION 49 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8758,7 +8899,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -8786,7 +8926,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 49 + // CONFIGURATION 50 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -8922,7 +9062,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 50 + // CONFIGURATION 51 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9044,7 +9184,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 51 + // CONFIGURATION 52 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9167,7 +9307,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 52 + // CONFIGURATION 53 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9295,7 +9435,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 53 + // CONFIGURATION 54 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9423,7 +9563,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 54 + // CONFIGURATION 55 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9547,7 +9687,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 55 + // CONFIGURATION 56 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9672,7 +9812,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 56 + // CONFIGURATION 57 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9802,7 +9942,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 57 + // CONFIGURATION 58 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -9906,7 +10046,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 58 + // CONFIGURATION 59 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10027,7 +10167,6 @@ const char* UNPARSED_CONFIGS[] = { " ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -10053,14 +10192,11 @@ const char* UNPARSED_CONFIGS[] = { " {\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" -" \"max-preferred-lifetime\": 3600,\n" " \"max-valid-lifetime\": 7200,\n" -" \"min-preferred-lifetime\": 3600,\n" " \"min-valid-lifetime\": 7200,\n" " \"name\": \"foo\",\n" " \"option-data\": [ ],\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"rapid-commit\": false,\n" " \"relay\": {\n" " \"ip-addresses\": [ ]\n" @@ -10071,9 +10207,7 @@ const char* UNPARSED_CONFIGS[] = { " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" " \"id\": 100,\n" -" \"max-preferred-lifetime\": 3600,\n" " \"max-valid-lifetime\": 7200,\n" -" \"min-preferred-lifetime\": 3600,\n" " \"min-valid-lifetime\": 7200,\n" " \"option-data\": [ ],\n" " \"pd-allocator\": \"iterative\",\n" @@ -10097,7 +10231,6 @@ const char* UNPARSED_CONFIGS[] = { " }\n" " }\n" " ],\n" -" \"preferred-lifetime\": 3600,\n" " \"relay\": {\n" " \"ip-addresses\": [ ]\n" " },\n" @@ -10156,7 +10289,7 @@ const char* UNPARSED_CONFIGS[] = { " },\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 59 + // CONFIGURATION 60 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10386,7 +10519,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 60 + // CONFIGURATION 61 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10476,7 +10609,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 4000\n" " }\n", - // CONFIGURATION 61 + // CONFIGURATION 62 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10536,7 +10669,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -10564,7 +10696,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 62 + // CONFIGURATION 63 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10624,7 +10756,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -10652,7 +10783,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 63 + // CONFIGURATION 64 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10728,7 +10859,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -10756,9 +10886,7 @@ const char* UNPARSED_CONFIGS[] = { " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" " \"id\": 1,\n" -" \"max-preferred-lifetime\": 3600,\n" " \"max-valid-lifetime\": 7200,\n" -" \"min-preferred-lifetime\": 3600,\n" " \"min-valid-lifetime\": 7200,\n" " \"option-data\": [ ],\n" " \"pd-allocator\": \"iterative\",\n" @@ -10769,7 +10897,6 @@ const char* UNPARSED_CONFIGS[] = { " \"pool\": \"2001:db8:1::1-2001:db8:1::ffff\"\n" " }\n" " ],\n" -" \"preferred-lifetime\": 3600,\n" " \"rapid-commit\": false,\n" " \"relay\": {\n" " \"ip-addresses\": [ ]\n" @@ -10786,7 +10913,7 @@ const char* UNPARSED_CONFIGS[] = { " \"t2-percent\": 0.8,\n" " \"valid-lifetime\": 7200\n" " }\n", - // CONFIGURATION 64 + // CONFIGURATION 65 "{\n" " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" @@ -10864,7 +10991,6 @@ const char* UNPARSED_CONFIGS[] = { " \"option-def\": [ ],\n" " \"parked-packet-limit\": 256,\n" " \"pd-allocator\": \"iterative\",\n" -" \"preferred-lifetime\": 3600,\n" " \"relay-supplied-options\": [ \"65\" ],\n" " \"reservations-global\": false,\n" " \"reservations-in-subnet\": true,\n" @@ -10892,9 +11018,7 @@ const char* UNPARSED_CONFIGS[] = { " \"allocator\": \"iterative\",\n" " \"calculate-tee-times\": true,\n" " \"id\": 1,\n" -" \"max-preferred-lifetime\": 3600,\n" " \"max-valid-lifetime\": 7200,\n" -" \"min-preferred-lifetime\": 3600,\n" " \"min-valid-lifetime\": 7200,\n" " \"option-data\": [ ],\n" " \"pd-allocator\": \"iterative\",\n" @@ -10905,7 +11029,6 @@ const char* UNPARSED_CONFIGS[] = { " \"pool\": \"2001:db8:1::1-2001:db8:1::ffff\"\n" " }\n" " ],\n" -" \"preferred-lifetime\": 3600,\n" " \"rapid-commit\": false,\n" " \"relay\": {\n" " \"ip-addresses\": [ ]\n" diff --git a/src/bin/dhcp6/tests/simple_parser6_unittest.cc b/src/bin/dhcp6/tests/simple_parser6_unittest.cc index 70b5c3373d..678e1a1646 100644 --- a/src/bin/dhcp6/tests/simple_parser6_unittest.cc +++ b/src/bin/dhcp6/tests/simple_parser6_unittest.cc @@ -138,7 +138,7 @@ TEST_F(SimpleParser6Test, globalDefaults6) { EXPECT_TRUE(num >= 5); checkIntegerValue(empty, "valid-lifetime", 7200); - checkIntegerValue(empty, "preferred-lifetime", 3600); + checkNoValue(empty, "preferred-lifetime"); checkBoolValue(empty, "calculate-tee-times", true); checkDoubleValue(empty, "t1-percent", 0.5); checkDoubleValue(empty, "t2-percent", 0.8); diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 733404a17c..f2e87015d9 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -1848,6 +1848,15 @@ AllocEngine::getLifetimes6(ClientContext6& ctx, uint32_t& preferred, uint32_t& v valid = candidate_valid.get(ctx.currentIA().hints_[0].getValid()); } } + + // If preferred isn't set or insane, calculate it as valid_lft * 0.625. + if (!preferred || preferred > valid) { + preferred = ((valid * 5)/8); + LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE, + ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME) + .arg(ctx.query_->getLabel()) + .arg(preferred); + } } Lease6Ptr AllocEngine::createLease6(ClientContext6& ctx, diff --git a/src/lib/dhcpsrv/alloc_engine_messages.cc b/src/lib/dhcpsrv/alloc_engine_messages.cc index 8b2412b65b..060dcfe759 100644 --- a/src/lib/dhcpsrv/alloc_engine_messages.cc +++ b/src/lib/dhcpsrv/alloc_engine_messages.cc @@ -56,6 +56,7 @@ extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_LEASES_NO_HR = "ALLOC_ENG extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR = "ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR"; extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_NO_V6_HR = "ALLOC_ENGINE_V6_ALLOC_NO_V6_HR"; extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_UNRESERVED = "ALLOC_ENGINE_V6_ALLOC_UNRESERVED"; +extern const isc::log::MessageID ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME = "ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME"; extern const isc::log::MessageID ALLOC_ENGINE_V6_DECLINED_RECOVERED = "ALLOC_ENGINE_V6_DECLINED_RECOVERED"; extern const isc::log::MessageID ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED = "ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED"; extern const isc::log::MessageID ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED = "ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED"; @@ -141,6 +142,7 @@ const char* values[] = { "ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR", "no leases found but reservations exist for client %1", "ALLOC_ENGINE_V6_ALLOC_NO_V6_HR", "%1: unable to allocate reserved leases - no IPv6 reservations", "ALLOC_ENGINE_V6_ALLOC_UNRESERVED", "no static reservations available - trying to dynamically allocate leases for client %1", + "ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME", "%1: using a calculated preferred-lifetime of %2", "ALLOC_ENGINE_V6_DECLINED_RECOVERED", "IPv6 address %1 was recovered after %2 seconds of probation-period", "ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED", "%1: expired lease for the client's hint %2 is reserved for another client", "ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED", "allocate new (unreserved) leases for the renewing client %1", diff --git a/src/lib/dhcpsrv/alloc_engine_messages.h b/src/lib/dhcpsrv/alloc_engine_messages.h index 866ce92b33..e9cd896b88 100644 --- a/src/lib/dhcpsrv/alloc_engine_messages.h +++ b/src/lib/dhcpsrv/alloc_engine_messages.h @@ -57,6 +57,7 @@ extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_LEASES_NO_HR; extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_NO_LEASES_HR; extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_NO_V6_HR; extern const isc::log::MessageID ALLOC_ENGINE_V6_ALLOC_UNRESERVED; +extern const isc::log::MessageID ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME; extern const isc::log::MessageID ALLOC_ENGINE_V6_DECLINED_RECOVERED; extern const isc::log::MessageID ALLOC_ENGINE_V6_EXPIRED_HINT_RESERVED; extern const isc::log::MessageID ALLOC_ENGINE_V6_EXTEND_ALLOC_UNRESERVED; diff --git a/src/lib/dhcpsrv/alloc_engine_messages.mes b/src/lib/dhcpsrv/alloc_engine_messages.mes index 93bba77e67..f6a50a2ec9 100644 --- a/src/lib/dhcpsrv/alloc_engine_messages.mes +++ b/src/lib/dhcpsrv/alloc_engine_messages.mes @@ -419,6 +419,13 @@ reservations for the client but they are not usable because the addresses are in use by another client or (c) we had a reserved lease but that has now been allocated to another client. +% ALLOC_ENGINE_V6_CALCULATED_PREFERRED_LIFETIME %1: using a calculated preferred-lifetime of %2 +This debug message indicates that the preferred-lifetime being returned +to the client is defaulting to 62.5% of the valid-lifetime. This may +occur if either the preferred-lifetime has not been explicitly configured, +or the configured value is larger than the valid-lifetime. The arguments +detail the client and the preferred-lifetime that will be used. + % ALLOC_ENGINE_V6_DECLINED_RECOVERED IPv6 address %1 was recovered after %2 seconds of probation-period This informational message indicates that the specified address was reported as duplicate (client sent DECLINE) and the server marked this address as diff --git a/src/lib/dhcpsrv/parsers/simple_parser6.cc b/src/lib/dhcpsrv/parsers/simple_parser6.cc index 3ec663a4b1..5515f4e423 100644 --- a/src/lib/dhcpsrv/parsers/simple_parser6.cc +++ b/src/lib/dhcpsrv/parsers/simple_parser6.cc @@ -111,7 +111,7 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = { /// in Dhcp6) are optional. If not defined, the following values will be /// used. const SimpleDefaults SimpleParser6::GLOBAL6_DEFAULTS = { - { "preferred-lifetime", Element::integer, "3600" }, + // { "preferred-lifetime", Element::integer, "3600" }, unspecified { "valid-lifetime", Element::integer, "7200" }, { "decline-probation-period", Element::integer, "86400" }, // 24h { "dhcp4o6-port", Element::integer, "0" }, diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc index 4c614fdb51..6c0dfa0dfe 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc @@ -1049,8 +1049,8 @@ TEST_F(AllocEngine6Test, renewClassLeaseLifetime) { EXPECT_GT(renewed[0]->cltt_, lease_cltt) << "Lease lifetime was not extended, but it should"; - // Verify life times came from the class. - EXPECT_EQ(renewed[0]->preferred_lft_, 750); + // Verify life times came from the class. Preferred should get adjusted. + EXPECT_EQ(renewed[0]->preferred_lft_, 437); EXPECT_EQ(renewed[0]->valid_lft_, 700); } @@ -5707,13 +5707,18 @@ TEST_F(AllocEngine6Test, getPreferredLifetime) { // Commit our class changes. CfgMgr::instance().commit(); - // Update the subnet's triplet to something more useful. - subnet_->setPreferred(Triplet(500, 1000, 1500)); + // Ensure subnet valid-lft is 400. + subnet_->setValid(Triplet(400, 400, 400)); + + // Convenience Triplet values. + Triplet unspecified; + Triplet specified(Triplet(301, 350, 450)); // Describes a test scenario. struct Scenario { std::string desc_; // descriptive text for logging std::vector classes_; // class list of assigned classes + Triplet subnet_pref_; // subnet's preferred lifetime triplet. uint32_t requested_lft_; // use as option 51 is > 0 uint32_t exp_preferred_; // expected lifetime }; @@ -5721,62 +5726,79 @@ TEST_F(AllocEngine6Test, getPreferredLifetime) { // Scenarios to test. std::vector scenarios = { { - "no classes, no hint", + "no classes, no hint, subnet specified", {}, + specified, 0, - subnet_->getPreferred() + specified + }, + { + "no classes, no hint, subnet unspecified", + {}, + unspecified, + 0, + (subnet_->getValid() * 5 / 8) }, { "no classes, hint", {}, + specified, subnet_->getPreferred().getMin() + 50, subnet_->getPreferred().getMin() + 50 }, { "no classes, hint too small", {}, - subnet_->getPreferred().getMin() - 50, - subnet_->getPreferred().getMin() + specified, + specified.getMin() - 50, + specified.getMin() }, { "no classes, hint too big", {}, - subnet_->getPreferred().getMax() + 50, - subnet_->getPreferred().getMax() + specified, + specified.getMax() + 50, + (subnet_->getValid() * 5 / 8) }, { "class unspecified, no hint", { "preferred_unspec" }, + specified, 0, - subnet_->getPreferred() + specified }, { "from last class, no hint", { "preferred_unspec", "preferred_one" }, + specified, 0, preferred_one.get() }, { "from first class, no hint", { "preferred_two", "preferred_one" }, + specified, 0, preferred_two.get() }, { "class plus hint", { "preferred_one" }, + specified, preferred_one.getMin() + 25, preferred_one.getMin() + 25 }, { "class plus hint too small", { "preferred_one" }, + specified, preferred_one.getMin() - 25, preferred_one.getMin() }, { "class plus hint too big", { "preferred_one" }, + specified, preferred_one.getMax() + 25, preferred_one.getMax() } @@ -5785,6 +5807,9 @@ TEST_F(AllocEngine6Test, getPreferredLifetime) { // Iterate over the scenarios and verify the correct outcome. for (auto scenario : scenarios) { SCOPED_TRACE(scenario.desc_); { + // Set the subnet's preferred-lifetime triplet. + subnet_->setPreferred(scenario.subnet_pref_); + // Create a context; AllocEngine::ClientContext6 ctx(subnet_, duid_, false, false, "", true, Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234))); @@ -5848,8 +5873,9 @@ TEST_F(AllocEngine6Test, getTemplateClassPreferredLifetime) { // Commit our class changes. CfgMgr::instance().commit(); - // Update the subnet's triplet to something more useful. - subnet_->setPreferred(Triplet(500, 1000, 1500)); + // Update the subnet's triplet to something more useful. Note max is + // intentionally larger than valid-lft. + subnet_->setPreferred(Triplet(301, 350, 450)); // Describes a test scenario. struct Scenario { @@ -5883,7 +5909,7 @@ TEST_F(AllocEngine6Test, getTemplateClassPreferredLifetime) { "no classes, hint too big", {}, subnet_->getPreferred().getMax() + 50, - subnet_->getPreferred().getMax() + (subnet_->getValid() * 5 / 8) }, { "class unspecified, no hint",