]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1418] Checkpoint: renamed cache-max
authorFrancis Dupont <fdupont@isc.org>
Fri, 2 Oct 2020 15:00:36 +0000 (17:00 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 2 Oct 2020 15:00:36 +0000 (17:00 +0200)
12 files changed:
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy
src/lib/dhcpsrv/network.cc
src/lib/dhcpsrv/network.h
src/lib/dhcpsrv/tests/cfg_shared_networks4_unittest.cc
src/lib/dhcpsrv/tests/cfg_shared_networks6_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
src/lib/dhcpsrv/tests/network_unittest.cc
src/lib/dhcpsrv/tests/shared_network_parser_unittest.cc

index a336114bbad2c58826581d71bbb5f0af3dc48546..afb215b25c9fa6fd9f89d178a4f27de154da2812 100644 (file)
@@ -1044,14 +1044,14 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"cache-max\" {
+\"cache-max-age\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::DHCP4:
     case isc::dhcp::Parser4Context::SUBNET4:
     case isc::dhcp::Parser4Context::SHARED_NETWORK:
-        return isc::dhcp::Dhcp4Parser::make_CACHE_MAX(driver.loc_);
+        return isc::dhcp::Dhcp4Parser::make_CACHE_MAX_AGE(driver.loc_);
     default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("cache-max", driver.loc_);
+        return isc::dhcp::Dhcp4Parser::make_STRING("cache-max-age", driver.loc_);
     }
 }
 
index f21bd970a2ed74f166da93a656bc135b08ddaedb..3f5d7e24147f7976e11fa6c3b8baa7ba647518f5 100644 (file)
@@ -111,7 +111,7 @@ using namespace std;
   T1_PERCENT "t1-percent"
   T2_PERCENT "t2-percent"
   CACHE_THRESHOLD "cache-threshold"
-  CACHE_MAX "cache-max"
+  CACHE_MAX_AGE "cache-max-age"
   DECLINE_PROBATION_PERIOD "decline-probation-period"
   SERVER_TAG "server-tag"
   STATISTIC_DEFAULT_SAMPLE_COUNT "statistic-default-sample-count"
@@ -555,10 +555,10 @@ cache_threshold: CACHE_THRESHOLD COLON FLOAT {
     ctx.stack_.back()->set("cache-threshold", ct);
 };
 
-cache_max: CACHE_MAX COLON INTEGER {
-    ctx.unique("cache-max", ctx.loc2pos(@1));
+cache_max_age: CACHE_MAX_AGE COLON INTEGER {
+    ctx.unique("cache-max-age", ctx.loc2pos(@1));
     ElementPtr cm(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("cache-max", cm);
+    ctx.stack_.back()->set("cache-max-age", cm);
 };
 
 decline_probation_period: DECLINE_PROBATION_PERIOD COLON INTEGER {
@@ -1359,7 +1359,7 @@ subnet4_param: valid_lifetime
              | t1_percent
              | t2_percent
              | cache_threshold
-             | cache_max
+             | cache_max_age
              | ddns_send_updates
              | ddns_override_no_update
              | ddns_override_client_update
@@ -1516,7 +1516,7 @@ shared_network_param: name
                     | t1_percent
                     | t2_percent
                     | cache_threshold
-                    | cache_max
+                    | cache_max_age
                     | ddns_send_updates
                     | ddns_override_no_update
                     | ddns_override_client_update
index e713e6e50c605466f411fdfdee8fbff600e93acb..7bde4b74b48917a416853c87bef858bd06999cb8 100644 (file)
@@ -1371,14 +1371,14 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"cache-max\" {
+\"cache-max-age\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::DHCP6:
     case isc::dhcp::Parser6Context::SUBNET6:
     case isc::dhcp::Parser6Context::SHARED_NETWORK:
-        return isc::dhcp::Dhcp6Parser::make_CACHE_MAX(driver.loc_);
+        return isc::dhcp::Dhcp6Parser::make_CACHE_MAX_AGE(driver.loc_);
     default:
-        return isc::dhcp::Dhcp6Parser::make_STRING("cache-max", driver.loc_);
+        return isc::dhcp::Dhcp6Parser::make_STRING("cache-max-age", driver.loc_);
     }
 }
 
index a1215bb651abd8a66293a8bb54361270716f54f7..63b45abb4155e47414ad342507af8b65a0cdff9e 100644 (file)
@@ -99,7 +99,7 @@ using namespace std;
   T1_PERCENT "t1-percent"
   T2_PERCENT "t2-percent"
   CACHE_THRESHOLD "cache-threshold"
-  CACHE_MAX "cache-max"
+  CACHE_MAX_AGE "cache-max-age"
   DECLINE_PROBATION_PERIOD "decline-probation-period"
   SERVER_TAG "server-tag"
   STATISTIC_DEFAULT_SAMPLE_COUNT "statistic-default-sample-count"
@@ -492,7 +492,7 @@ global_param: data_directory
             | t1_percent
             | t2_percent
             | cache_threshold
-            | cache_max
+            | cache_max_age
             | loggers
             | hostname_char_set
             | hostname_char_replacement
@@ -590,10 +590,10 @@ cache_threshold: CACHE_THRESHOLD COLON FLOAT {
     ctx.stack_.back()->set("cache-threshold", ct);
 };
 
-cache_max: CACHE_MAX COLON INTEGER {
-    ctx.unique("cache-max", ctx.loc2pos(@1));
+cache_max_age: CACHE_MAX_AGE COLON INTEGER {
+    ctx.unique("cache-max-age", ctx.loc2pos(@1));
     ElementPtr cm(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("cache-max", cm);
+    ctx.stack_.back()->set("cache-max-age", cm);
 };
 
 decline_probation_period: DECLINE_PROBATION_PERIOD COLON INTEGER {
@@ -1369,7 +1369,7 @@ subnet6_param: preferred_lifetime
              | t1_percent
              | t2_percent
              | cache_threshold
-             | cache_max
+             | cache_max_age
              | hostname_char_set
              | hostname_char_replacement
              | ddns_send_updates
@@ -1514,7 +1514,7 @@ shared_network_param: name
                     | t1_percent
                     | t2_percent
                     | cache_threshold
-                    | cache_max
+                    | cache_max_age
                     | hostname_char_set
                     | hostname_char_replacement
                     | ddns_send_updates
index 13549de53195ff5933f3fec3155b464080a38cf2..daeaaa47255a3441cf8570fce9c43c01f48bcfd5 100644 (file)
@@ -284,9 +284,9 @@ Network::toElement() const {
         map->set("cache-threshold", Element::create(cache_threshold_));
     }
 
-    if (!cache_max_.unspecified()) {
-        map->set("cache-max",
-                 Element::create(static_cast<long long>(cache_max_)));
+    if (!cache_max_age_.unspecified()) {
+        map->set("cache-max-age",
+                 Element::create(static_cast<long long>(cache_max_age_)));
     }
 
     return (map);
index 37b9eb3a2edb6418baad042614e1bb719ca73f0a..09c01aaa740f99fe279f16d9c926ae744de72131 100644 (file)
@@ -208,7 +208,7 @@ public:
           ddns_send_updates_(), ddns_override_no_update_(), ddns_override_client_update_(),
           ddns_replace_client_name_mode_(), ddns_generated_prefix_(), ddns_qualifying_suffix_(),
           hostname_char_set_(), hostname_char_replacement_(), store_extended_info_(),
-          cache_threshold_(), cache_max_() {
+          cache_threshold_(), cache_max_age_() {
     }
 
     /// @brief Virtual destructor.
@@ -720,16 +720,16 @@ public:
     ///
     /// @param inheritance inheritance mode to be used.
     util::Optional<uint32_t>
-    getCacheMax(const Inheritance& inheritance = Inheritance::ALL) const {
-        return (getProperty<Network>(&Network::getCacheMax, cache_max_,
-                                     inheritance, "cache-max"));
+    getCacheMaxAge(const Inheritance& inheritance = Inheritance::ALL) const {
+        return (getProperty<Network>(&Network::getCacheMaxAge, cache_max_age_,
+                                     inheritance, "cache-max-age"));
     }
 
     /// @brief Sets cache max for a network.
     ///
-    /// @param cache_max New cache maximum value in seconds to use.
-    void setCacheMax(const util::Optional<uint32_t>& cache_max) {
-        cache_max_ = cache_max;
+    /// @param cache_max_age New cache maximum value in seconds to use.
+    void setCacheMaxAge(const util::Optional<uint32_t>& cache_max_age) {
+        cache_max_age_ = cache_max_age;
     }
 
     /// @brief Unparses network object.
@@ -1030,7 +1030,7 @@ protected:
     util::Optional<double> cache_threshold_;
 
     /// @brief Value in seconds to use as cache maximal age.
-    util::Optional<uint32_t> cache_max_;
+    util::Optional<uint32_t> cache_max_age_;
 
     /// @brief Pointer to another network that this network belongs to.
     ///
index eaf8d8faac4d16bde73a10933472ad231bc904b0..4bf17662ec36ea6db56598f11e8384f7adda61fa 100644 (file)
@@ -215,7 +215,7 @@ TEST(CfgSharedNetworks4Test, unparse) {
     network2->setValid(Triplet<uint32_t>(200, 300, 400));
     network2->setDdnsSendUpdates(false);
     network2->setStoreExtendedInfo(true);
-    network2->setCacheMax(50);
+    network2->setCacheMaxAge(50);
 
     network3->setIface("eth2");
     network3->setValid(Triplet<uint32_t>(100));
@@ -248,7 +248,7 @@ TEST(CfgSharedNetworks4Test, unparse) {
         "    \"min-valid-lifetime\": 200,\n"
         "    \"max-valid-lifetime\": 400,\n"
         "    \"store-extended-info\": true,\n"
-        "    \"cache-max\": 50\n"
+        "    \"cache-max-age\": 50\n"
         "  },\n"
         "  {\n"
         "    \"calculate-tee-times\": true,\n"
index 6ee9998702652e11192f40f4a029c8111c29d0c6..18878dffee3b9218f097a9254b39310ac641c041 100644 (file)
@@ -217,7 +217,7 @@ TEST(CfgSharedNetworks6Test, unparse) {
     network2->setValid(Triplet<uint32_t>(300));
     network2->setDdnsSendUpdates(false);
     network2->setStoreExtendedInfo(true);
-    network2->setCacheMax(80);
+    network2->setCacheMaxAge(80);
 
     network3->setIface("eth2");
     network3->setPreferred(Triplet<uint32_t>(100,200,300));
@@ -255,7 +255,7 @@ TEST(CfgSharedNetworks6Test, unparse) {
         "    \"preferred-lifetime\": 200,\n"
         "    \"valid-lifetime\": 300\n,"
         "    \"store-extended-info\": true,\n"
-        "    \"cache-max\": 80\n"
+        "    \"cache-max-age\": 80\n"
         "  },\n"
         "  {\n"
         "    \"calculate-tee-times\": true,\n"
index 597938d16643f5340048e067580f7eb4a0ff0ec1..62809c955ab93ecc1f0e79b094ddc13d8dfbf6be 100644 (file)
@@ -1029,7 +1029,7 @@ TEST(CfgSubnets4Test, unparseSubnet) {
     subnet2->addRelayAddress(IOAddress("10.0.0.1"));
     subnet2->setValid(Triplet<uint32_t>(100));
     subnet2->setStoreExtendedInfo(true);
-    subnet2->setCacheMax(80);
+    subnet2->setCacheMaxAge(80);
 
     subnet3->setIface("eth1");
     subnet3->requireClientClass("foo");
@@ -1096,7 +1096,7 @@ TEST(CfgSubnets4Test, unparseSubnet) {
         "    \"option-data\": [ ],\n"
         "    \"pools\": [ ],\n"
         "    \"store-extended-info\": true,\n"
-        "    \"cache-max\": 80\n"
+        "    \"cache-max-age\": 80\n"
         "},{\n"
         "    \"id\": 125,\n"
         "    \"subnet\": \"192.0.2.128/26\",\n"
index 0f9b0ecc6b8eb18077bc543f3cc078c733f27ad5..55419d4fc8d5b6422376575f0312d76f04b4fbff 100644 (file)
@@ -632,7 +632,7 @@ TEST(CfgSubnets6Test, unparseSubnet) {
     subnet2->setValid(Triplet<uint32_t>(200));
     subnet2->setPreferred(Triplet<uint32_t>(100));
     subnet2->setStoreExtendedInfo(true);
-    subnet2->setCacheMax(80);
+    subnet2->setCacheMaxAge(80);
 
     subnet3->setIface("eth1");
     subnet3->requireClientClass("foo");
@@ -695,7 +695,7 @@ TEST(CfgSubnets6Test, unparseSubnet) {
         "    \"pd-pools\": [ ],\n"
         "    \"option-data\": [ ],\n"
         "    \"store-extended-info\": true,\n"
-        "    \"cache-max\": 80\n"
+        "    \"cache-max-age\": 80\n"
         "},{\n"
         "    \"id\": 125,\n"
         "    \"subnet\": \"2001:db8:3::/48\",\n"
index 19c36c08aaf389f8514f40999dbf872b1313a600..8f7dbd2fb75e7dac3139d24372ed79cf2eb99428 100644 (file)
@@ -182,7 +182,7 @@ TEST_F(NetworkTest, inheritanceSupport4) {
     globals_->set("hostname-char-replacement", Element::create("gr"));
     globals_->set("store-extended-info", Element::create(true));
     globals_->set("cache-threshold", Element::create(.25));
-    globals_->set("cache-max", Element::create(20));
+    globals_->set("cache-max-age", Element::create(20));
 
     // For each parameter for which inheritance is supported run
     // the test that checks if the values are inherited properly.
@@ -327,9 +327,9 @@ TEST_F(NetworkTest, inheritanceSupport4) {
                                              .1, .25);
     }
     {
-        SCOPED_TRACE("cache-max");
-        testNetworkInheritance<TestNetwork4>(&Network::getCacheMax,
-                                             &Network::setCacheMax,
+        SCOPED_TRACE("cache-max-age");
+        testNetworkInheritance<TestNetwork4>(&Network::getCacheMaxAge,
+                                             &Network::setCacheMaxAge,
                                              10, 20);
     }
 }
index 34fb2f63e1b05b271c4230b78a7722f04e52126e..f3ce4669bd57034a767ebd83bbb939513844dd68 100644 (file)
@@ -148,7 +148,7 @@ public:
                 "    \"hostname-char-replacement\": \"x\","
                 "    \"store-extended-info\": true,"
                 "    \"cache-threshold\": 0.123,"
-                "    \"cache-max\": 123,"
+                "    \"cache-max-age\": 123,"
                 "    \"option-data\": ["
                 "        {"
                 "            \"name\": \"domain-name-servers\","
@@ -182,7 +182,7 @@ public:
                 "            \"t2-percent\": .65,"
                 "            \"hostname-char-set\": \"\","
                 "            \"cache-threshold\": .20,"
-                "            \"cache-max\": 50"
+                "            \"cache-max-age\": 50"
                 "        },"
                 "        {"
                 "            \"id\": 2,"
@@ -207,7 +207,7 @@ public:
                 "            \"t1-percent\": .40,"
                 "            \"t2-percent\": .80,"
                 "            \"cache-threshold\": .15,"
-                "            \"cache-max\": 5"
+                "            \"cache-max-age\": 5"
                 "        }"
                 "    ]"
                 "}";
@@ -271,7 +271,7 @@ TEST_F(SharedNetwork4ParserTest, parse) {
     EXPECT_EQ("x", network->getHostnameCharReplacement().get());
     EXPECT_TRUE(network->getStoreExtendedInfo().get());
     EXPECT_EQ(0.123, network->getCacheThreshold());
-    EXPECT_EQ(123, network->getCacheMax());
+    EXPECT_EQ(123, network->getCacheMaxAge());
 
     // Relay information.
     auto relay_info = network->getRelayInfo();
@@ -565,7 +565,7 @@ public:
                 "    \"hostname-char-replacement\": \"x\","
                 "    \"store-extended-info\": true,"
                 "    \"cache-threshold\": 0.123,"
-                "    \"cache-max\": 123,"
+                "    \"cache-max-age\": 123,"
                 "    \"option-data\": ["
                 "        {"
                 "            \"name\": \"dns-servers\","
@@ -671,7 +671,7 @@ TEST_F(SharedNetwork6ParserTest, parse) {
     EXPECT_EQ("x", network->getHostnameCharReplacement().get());
     EXPECT_TRUE(network->getStoreExtendedInfo().get());
     EXPECT_EQ(0.123, network->getCacheThreshold());
-    EXPECT_EQ(123, network->getCacheMax());
+    EXPECT_EQ(123, network->getCacheMaxAge());
 
     // Relay information.
     auto relay_info = network->getRelayInfo();