]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#226] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Wed, 20 Aug 2025 16:14:43 +0000 (18:14 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 20 Aug 2025 16:14:43 +0000 (18:14 +0200)
changelog_unreleased/226-adaptive-lease-time-threshold [moved from changelog_unreleased/266-adaptive-lease-time-threshold with 79% similarity]
doc/examples/kea4/all-keys.json
doc/examples/kea6/all-keys.json
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/lib/dhcpsrv/allocator.cc
src/lib/dhcpsrv/allocator.h
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc

similarity index 79%
rename from changelog_unreleased/266-adaptive-lease-time-threshold
rename to changelog_unreleased/226-adaptive-lease-time-threshold
index 9802eca838b2ec808ce083d4f93ae867bbd40884..bffd3217b9fd8dd7cac9c30989ac07d0aa909bcd 100644 (file)
@@ -1,7 +1,7 @@
 [func]         fdupont
        Added the new "adaptive-lease-time-threshold" parameter
        for the FLQ (Free Lease Queue) allocator which reduces
-       lifetime of leases when pools of a subnet have an
+       the lifetime of leases when pools of a subnet have an
        occupancy rate above a configured threshold (new feature
        from ISC DHCP).
        (Gitlab #226)
index 14bc800074554c3b09ed3c8dd2710b8375f3db5a..89465c33e1109c6195718ffa395d0d0b911982af 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Adaptive lease time threshold = 1. (disabled).
-                "adaptive-lease-time-threshold": 1.,
+                // Adaptive lease time threshold (1.0 is disabled).
+                "adaptive-lease-time-threshold": 0.8,
 
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
                         // Subnet-level cache maximum.
                         "cache-max-age": 1000,
 
-                        // Adaptive lease time threshold = 1. (disabled).
-                        "adaptive-lease-time-threshold": 1.,
+                        // Adaptive lease time threshold (1.0 is disabled).
+                        "adaptive-lease-time-threshold": 0.8,
 
                         // List of static IPv4 reservations assigned to clients belonging
                         // to this subnet. For a detailed example, see reservations.json.
         // Global cache maximum.
         "cache-max-age": 1000,
 
-        // Adaptive lease time threshold = 1. (disabled).
-        "adaptive-lease-time-threshold": 1.,
+        // Adaptive lease time threshold (1.0 is disabled).
+        "adaptive-lease-time-threshold": 0.8,
 
         // String of zero or more characters with which to replace each
         // invalid character in the hostname or Client FQDN. The default
index 7b857daa94d1339ab5d6484d1b02f1bd42d46e61..4b8d344650ef02dc2022f7467b731d566c303c02 100644 (file)
                 // lease is returned as it was "cached".
                 "cache-max-age": 1000,
 
-                // Adaptive lease time threshold = 1. (disabled).
-                "adaptive-lease-time-threshold": 1.,
+                // Adaptive lease time threshold (1.0 is disabled).
+                "adaptive-lease-time-threshold": 0.8,
 
                 // Specify whether the server should look up global reservations.
                 "reservations-global": false,
                         // Subnet-level cache maximum.
                         "cache-max-age": 1000,
 
-                        // Adaptive lease time threshold = 1. (disabled).
-                        "adaptive-lease-time-threshold": 1.,
+                        // Adaptive lease time threshold (1.0 is disabled).
+                        "adaptive-lease-time-threshold": 0.8,
 
                         // List of static IPv6 reservations assigned to clients belonging
                         // to this subnet. For a detailed example, see reservations.json.
         // Global cache maximum.
         "cache-max-age": 1000,
 
-        // Adaptive lease time threshold = 1.0 (disabled)
-        "adaptive-lease-time-threshold": 1.0,
+        // Adaptive lease time threshold (1.0 is disabled)
+        "adaptive-lease-time-threshold": 0.8,
 
         // String of zero or more characters with which to replace each
         // invalid character in the Client FQDN. The default
index 5b37376c76e2108e9afa962de1804a4905048fdf..335337bca38f8db2c5f69cdf0e096c8cde9837c3 100644 (file)
@@ -8988,9 +8988,9 @@ avoiding unnecessary impact on the server's startup time.
 
 In Kea 3.1.1 a new parameter ``adaptive-lease-time-threshold`` was added.
 It can be specified at global, shared network and subnet levels and
-takes a floating point value between ``0.`` (excluded) and ``1.``.
-It is disabled by default or when set to ``1.``. It is active only with
-he FLQ allocator and when the occupancy rate of pools of subnet is
+takes a floating point value between ``0.0`` (excluded) and ``1.0``.
+It is disabled by default or when set to ``1.0``. It is only supported
+by the FLQ allocator. When the occupancy rate of pools in a subnet is
 above the specified value the server decreases the lease valid lifetime
 to the applicable ``min-valid-lifetime`` for new clients. Clients
 renewing an already existing lease get at least the remaining lifetime
index 52649b8cc1468c10b05025fca0eb2882ddbb9a5b..2bc7ded5f20b618ae3e35a6412828456fc5a30c7 100644 (file)
@@ -8733,9 +8733,9 @@ avoiding unnecessary impact on the server's startup time.
 
 In Kea 3.1.1 a new parameter ``adaptive-lease-time-threshold`` was added.
 It can be specified at global, shared network and subnet levels and
-takes a floating point value between ``0.`` (excluded) and ``1.``.
-It is disabled by default or when set to ``1.``. It is active only with
-he FLQ allocator and when the occupancy rate of pools of subnet is
+takes a floating point value between ``0.0`` (excluded) and ``1.0``.
+It is disabled by default or when set to ``1.0``. It is  only supported
+by the FLQ allocator. When the occupancy rate of pools in a subnet is
 above the specified value the server decreases the lease valid lifetime
 to the applicable ``min-valid-lifetime`` for new clients. Clients
 renewing an already existing lease get at least the remaining lifetime
index 5175ff985da9ca535c8280df1405780e7750753a..a86d3cfc0b7edb265e00d9a5aaee63027037dc22 100644 (file)
@@ -78,5 +78,18 @@ Allocator::initAfterConfigure() {
     inited_ = true;
 }
 
+double
+Allocator::getOccupancyRate(const asiolink::IOAddress&ddr,
+                            const ClientClasses&) const {
+    return (0.);
+}
+
+double
+Allocator::getOccupancyRate(const asiolink::IOAddress&,
+                            const uint8_t,
+                            const ClientClasses&) const {
+    return (0.);
+}
+
 }
 }
index 44a5309a8205cb12deb17a8247761a30847d1925..01e117edaf5fd925afb16a678f1062ca9f510303 100644 (file)
@@ -152,9 +152,7 @@ public:
     /// @param client_classes list of classes client belongs to.
     virtual double
     getOccupancyRate(const asiolink::IOAddress& addr,
-                     const ClientClasses& client_classes) const {
-        return (0.);
-    }
+                     const ClientClasses& client_classes) const;
 
     /// @brief Returns the occupancy rate (v6 prefixes).
     ///
@@ -170,9 +168,7 @@ public:
     virtual double
     getOccupancyRate(const asiolink::IOAddress& pref,
                      const uint8_t plen,
-                     const ClientClasses& client_classes) const {
-        return (0.);
-    }
+                     const ClientClasses& client_classes) const;
 
     /// @brief Check if the pool matches the selection criteria relative to the
     /// provided hint prefix length.
index e185509e4a8cd2dc9c0b83bba13ce6726a58b8e5..cb02517d7af91e489f73925f37b447694e1d3e77 100644 (file)
@@ -1894,7 +1894,7 @@ TEST(CfgSubnets4Test, cacheParamValidation) {
 
 // This test verifies the Subnet4 parser's validation logic for
 // adaptive lease time parameter.
-TEST(CfgSubnets4Test, AdaptiveLeaseTimeParamValidation) {
+TEST(CfgSubnets4Test, adaptiveLeaseTimeParamValidation) {
 
     // Describes a single test scenario.
     struct Scenario {
index 3445e9f2e1719e736a1884a3affe07b5e99baf2e..51f38cee856836d7ad9370d5ed406498e6769ada 100644 (file)
@@ -1675,7 +1675,7 @@ TEST(CfgSubnets6Test, cacheParamValidation) {
 
 // This test verifies the Subnet6 parser's validation logic for
 // adaptive lease time parameter.
-TEST(CfgSubnets6Test, AdaptiveLeaseTimeParamValidation) {
+TEST(CfgSubnets6Test, adaptiveLeaseTimeParamValidation) {
 
     // Describes a single test scenario.
     struct Scenario {