Commit 495cd829 authored by Francis Dupont's avatar Francis Dupont
Browse files

[295-min-max-lease-time-configuration-options] Addressed easy comments

parent e738ffc4
......@@ -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>
......
......@@ -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:
......
......@@ -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,
......
......@@ -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,
......
......@@ -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);
......
......@@ -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();
......
......@@ -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,
......
// 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.
......
......@@ -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())));
}
......
// 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...
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment