]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[295-min-max-lease-time-configuration-options] Addressed easy comments
authorFrancis Dupont <fdupont@isc.org>
Tue, 18 Jun 2019 18:15:38 +0000 (20:15 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sat, 22 Jun 2019 14:05:23 +0000 (10:05 -0400)
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/hooks/dhcp/mysql_cb/mysql_cb_impl.h
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/alloc_engine.h
src/lib/dhcpsrv/cache_host_data_source.h
src/lib/dhcpsrv/network.cc
src/lib/yang/tests/translator_unittests.cc

index d2816f9b092c6d40c0e46de717136352a74df2f6..5d65908d150830202d6d6db0544114b1c6a223f2 100644 (file)
@@ -231,12 +231,12 @@ without any quotes around them.) <command>renew-timer</command> and
 define T1 and T2 timers that govern when the client will begin the renewal and
 rebind procedures.
 
-<note>From Kea 1.6.0 the lease valid lifetime is extended from a
+<note>Beginning with Kea 1.6.0 the lease valid lifetime is extended from a
 single value to a triplet with minimum, default and maximum values using
 <command>min-valid-lifetime</command>, <command>valid-lifetime</command> and
 <command>max-valid-lifetime</command>. When the client does not specify
 a lifetime the default value is used, when it specifies using a DHCP option
-code 51 this value is used if it is not lesser than the  minimum (in this case
+code 51 this value is used if it is not less than the minimum (in this case
 the minimum is returned) or greater than the maximum (in this case the
 maximum is used).</note>
 
index b332b9a5ebc713ef1aa31129d31a268d04a65c0a..e7dd879cc47de418a830c2b25a337eab5ef93cfc 100644 (file)
@@ -2056,11 +2056,11 @@ should include options from the new option space:
       by combination of configuration parameters, two of which have already been
       mentioned.
       </para><para>
-      From Kea 1.6.0 lease preferred and valid lifetime are extended from
+      Beginning with Kea 1.6.0 lease preferred and valid lifetime are extended from
       single values to triplets with minimum, default and maximum values using:
       <itemizedlist>
         <listitem>
-         <simpara><command>min-preferred-lifetime</command> - specifies the minimal preferred lifetime (optional).
+         <simpara><command>min-preferred-lifetime</command> - specifies the minimum preferred lifetime (optional).
           </simpara>
         </listitem>
         <listitem>
@@ -2068,11 +2068,11 @@ should include options from the new option space:
           </simpara>
         </listitem>
         <listitem>
-         <simpara><command>max-preferred-lifetime</command> - specifies the maximal preferred lifetime (optional).
+         <simpara><command>max-preferred-lifetime</command> - specifies the maximum preferred lifetime (optional).
           </simpara>
         </listitem>
         <listitem>
-         <simpara><command>min-valid-lifetime</command> - specifies the minimal valid lifetime (optional).
+         <simpara><command>min-valid-lifetime</command> - specifies the minimum valid lifetime (optional).
           </simpara>
         </listitem>
         <listitem>
@@ -2080,14 +2080,14 @@ should include options from the new option space:
           </simpara>
         </listitem>
         <listitem>
-         <simpara><command>max-valid-lifetime</command> - specifies the maximal valid lifetime (optional).
+         <simpara><command>max-valid-lifetime</command> - specifies the maximum valid lifetime (optional).
           </simpara>
         </listitem>
       </itemizedlist>
       When the client does not specify lifetimes the default is used. When
       it specifies a lifetime using IAADDR or IAPREFIX sub option with not
       zero values these values are used when they are between configured
-      minimal (lower values are round up) and maximal (larger values are
+      minimum (lower values are round up) and maximum (larger values are
       round down) bounds.
       </para><para>
       To send specific, fixed values use the following two parameters:
index 319408b1dbf37e9f396c1dab6d458513fa5b89c6..69723b41f89fdafc5a58ea1721858569e7b1a50d 100644 (file)
@@ -727,9 +727,9 @@ public:
     /// @param t2 expected rebind-timer value
     /// @param valid expected valid-lifetime value
     /// @param min_valid expected min-valid-lifetime value
-    ///        (0 (default) means same than valid)
+    ///        (0 (default) means same as valid)
     /// @param max_valid expected max-valid-lifetime value
-    ///        (0 (default) means same than valid)
+    ///        (0 (default) means same as valid)
     /// @return the subnet that was examined
     Subnet4Ptr
     checkSubnet(const Subnet4Collection& col, std::string subnet,
index 994efae6b41fb582b7f3bfec911b450ba9d7c1b9..62662f000acf1925103680457bdde25dbee0e337 100644 (file)
@@ -451,13 +451,13 @@ public:
     /// @param preferred expected preferred-lifetime value
     /// @param valid expected valid-lifetime value
     /// @param min_preferred expected min-preferred-lifetime value
-    ///        (0 (default) means same than preferred)
+    ///        (0 (default) means same as preferred)
     /// @param max_preferred expected max-preferred-lifetime value
-    ///        (0 (default) means same than preferred)
+    ///        (0 (default) means same as preferred)
     /// @param min_valid expected min-valid-lifetime value
-    ///        (0 (default) means same than valid)
+    ///        (0 (default) means same as valid)
     /// @param max_valid expected max-valid-lifetime value
-    ///        (0 (default) means same than valid)
+    ///        (0 (default) means same as valid)
     /// @return the subnet that was examined
     Subnet6Ptr
     checkSubnet(const Subnet6Collection& col, std::string subnet,
index e269dbf0c70260d4695df1dd2551c996da24dfb0..1a3392d7aa6510e1096c68acf59df1fe74f5f153 100644 (file)
@@ -121,7 +121,7 @@ public:
     ///
     /// @param triplet Triplet value from which the binding should be created.
     /// @return Pointer to a null binding if the triplet is "unspecified" or
-    /// the max value is the same than the default value, or a pointer to
+    /// the max value is the same as the default value, or a pointer to
     /// a binding representing 32-bit unsigned integer value from the max
     /// value otherwise.
     static db::MySqlBindingPtr createMaxBinding(const Triplet<uint32_t>& triplet);
@@ -130,7 +130,7 @@ public:
     ///
     /// @param triplet Triplet value from which the binding should be created.
     /// @return Pointer to a null binding if the triplet is "unspecified" or
-    /// the min value is the same than the default value, or a pointer to
+    /// the min value is the same as the default value, or a pointer to
     /// a binding representing 32-bit unsigned integer value from the min
     /// value otherwise.
     static db::MySqlBindingPtr createMinBinding(const Triplet<uint32_t>& triplet);
index 5573c3403a4cf70c17d251e9765515acd2e2278e..fc44a25b8b48ac466ce701708208642b862ff8e8 100644 (file)
@@ -1620,6 +1620,8 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx,
     // address, lease type and prefixlen (0) stay the same
     expired->iaid_ = ctx.currentIA().iaid_;
     expired->duid_ = ctx.duid_;
+    // Use subnet's preferred triplet to conditionally determine
+    // preferred lifetime based on hint
     if (!ctx.currentIA().hints_.empty() &&
         ctx.currentIA().hints_[0].getPreferred()) {
         uint32_t preferred = ctx.currentIA().hints_[0].getPreferred();
@@ -1627,6 +1629,8 @@ AllocEngine::reuseExpiredLease(Lease6Ptr& expired, ClientContext6& ctx,
     } else {
         expired->preferred_lft_ = ctx.subnet_->getPreferred();
     }
+    // Use subnet's valid triplet to conditionally determine
+    // valid lifetime based on hint
     if (!ctx.currentIA().hints_.empty() &&
         ctx.currentIA().hints_[0].getValid()) {
         uint32_t valid = ctx.currentIA().hints_[0].getValid();
index 7e6c4196ffd4b17f64388111844a84a93bfc2068..fee5e23e274b6b5511b9ccb87c439ff24f155877 100644 (file)
@@ -289,8 +289,10 @@ public:
         ///
         /// @param address the address or prefix
         /// @param prefix_len the prefix length (128 for addresses)
-        /// @param preferred the optional preferred lifetime
-        /// @param valid the optional valid lifetime
+        /// @param preferred the optional preferred lifetime,
+        /// defaults to 0, meaning not specified
+        /// @param valid the optional valid lifetime,
+        /// defaults to 0, meaning not specified
         Resource(const isc::asiolink::IOAddress& address,
                  const uint8_t prefix_len,
                  const uint32_t preferred = 0,
index 8a234f52d9a0376f72471efffeb76acf35458146..4dcc8941329caae792f5bbd936f6870823d35535 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the End User License
 // Agreement. See COPYING file in the premium/ directory.
@@ -33,7 +33,7 @@ public:
 
     /// @brief Remove a host from the cache.
     ///
-    /// Does the same than @c del, @c del4 or @c del6 but with
+    /// Does the same as @c del, @c del4 or @c del6 but with
     /// a more uniform interface and a different purpose.
     ///
     /// @note A pointer to a copy does not remove the object.
index 03de5094204bac22795f5b146243a64816efa036..dea0f702c48fe349da04e14e3b8cc192b0d69fd7 100644 (file)
@@ -173,11 +173,11 @@ Network::toElement() const {
     if (!valid_.unspecified()) {
         map->set("valid-lifetime",
                  Element::create(static_cast<long long>(valid_.get())));
-        if (valid_.get() != valid_.getMin()) {
+        if (valid_.getMin() < valid_.get()) {
             map->set("min-valid-lifetime",
                      Element::create(static_cast<long long>(valid_.getMin())));
         }
-        if (valid_.get() != valid_.getMax()) {
+        if (valid_.getMax() > valid_.get()) {
             map->set("max-valid-lifetime",
                      Element::create(static_cast<long long>(valid_.getMax())));
         }
@@ -301,11 +301,11 @@ Network6::toElement() const {
     if (!preferred_.unspecified()) {
         map->set("preferred-lifetime",
                  Element::create(static_cast<long long>(preferred_.get())));
-        if (preferred_.get() != preferred_.getMin()) {
+        if (preferred_.getMin() < preferred_.get()) {
             map->set("min-preferred-lifetime",
                      Element::create(static_cast<long long>(preferred_.getMin())));
         }
-        if (preferred_.get() != preferred_.getMax()) {
+        if (preferred_.getMax() > preferred_.get()) {
             map->set("max-preferred-lifetime",
                      Element::create(static_cast<long long>(preferred_.getMax())));
         }
index a93e963e713fc5d4dae90c269877dfd85ef3633f..ddf314e1b7fb412116cb1f60bdf90bfcb86d18a2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2019 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
@@ -678,7 +678,7 @@ TEST(TranslatorBasicTest, list) {
     EXPECT_NO_THROW(xpath = t_obj->getNext(iter));
     EXPECT_TRUE(xpath.empty());
 
-    // Not found: same than empty because sr_get_items_iter() translates
+    // Not found: same as empty because sr_get_items_iter() translates
     // SR_ERR_NOT_FOUND by SR_ERR_OK...
 }