Commit e064013b authored by Francis Dupont's avatar Francis Dupont

[#897] Addressed final comments and added a ChangeLog entry

parent b1fb6811
1695. [func] fdupont
Added support of BOOTP leases with infinite valid lifetime.
This includes representation of such leases in MySQL and
PostgreSQL databases which the expire date can be a 32 bit
integer.
(Gitlan #897)
1694. [doc] marcin
Described the usage of the ha-heartbeat command to check the
states of the HA enabled DHCP servers.
......
......@@ -2330,7 +2330,7 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) {
}
}
/// @todo: Take care of the fact that the valid lifetime can be infinite.
/// @todo This logic to be modified if we decide to support infinite lease times.
void
Dhcpv4Srv::setTeeTimes(const Lease4Ptr& lease, const Subnet4Ptr& subnet, Pkt4Ptr resp) {
......
......@@ -3984,7 +3984,7 @@ void Dhcpv6Srv::discardPackets() {
HooksManager::clearParkingLots();
}
/// @todo: Take care of the fact that the valid lifetime can be infinite.
/// @todo This logic to be modified if we decide to support infinite lease times.
void
Dhcpv6Srv::setTeeTimes(uint32_t preferred_lft, const Subnet6Ptr& subnet, Option6IAPtr& resp) {
// Default T2 time to zero.
......
......@@ -494,11 +494,11 @@ public:
bind_array.add(valid_lifetime_str_);
// Avoid overflow
uint32_t valid_lft = lease_->valid_lft_;
if (valid_lft == Lease::INFINITY_LFT) {
if (lease_->valid_lft_ == Lease::INFINITY_LFT) {
expire_str_ = convertToDatabaseTime(lease->cltt_, 0);
} else {
expire_str_ = convertToDatabaseTime(lease->cltt_, valid_lft);
expire_str_ = convertToDatabaseTime(lease->cltt_,
lease_->valid_lft_);
}
bind_array.add(expire_str_);
......@@ -555,11 +555,10 @@ public:
getColumnValue(r, row , SUBNET_ID_COL, subnet_id_);
// Recover from overflow
uint32_t valid_lft = valid_lifetime_;
if (valid_lft == Lease::INFINITY_LFT) {
if (valid_lifetime_ == Lease::INFINITY_LFT) {
cltt_ = expire_;
} else {
cltt_ = expire_ - valid_lft;
cltt_ = expire_ - valid_lifetime_;
}
getColumnValue(r, row, FQDN_FWD_COL, fqdn_fwd_);
......@@ -737,11 +736,11 @@ public:
bind_array.add(valid_lifetime_str_);
// Avoid overflow
uint32_t valid_lft = lease_->valid_lft_;
if (valid_lft == Lease::INFINITY_LFT) {
if (lease_->valid_lft_ == Lease::INFINITY_LFT) {
expire_str_ = convertToDatabaseTime(lease->cltt_, 0);
} else {
expire_str_ = convertToDatabaseTime(lease->cltt_, valid_lft);
expire_str_ = convertToDatabaseTime(lease->cltt_,
lease_->valid_lft_);
}
bind_array.add(expire_str_);
......@@ -849,11 +848,10 @@ public:
EXPIRE_COL));
// Recover from overflow
uint32_t valid_lft = valid_lifetime_;
if (valid_lft == Lease::INFINITY_LFT) {
if (valid_lifetime_ == Lease::INFINITY_LFT) {
cltt_ = expire_;
} else {
cltt_ = expire_ - valid_lft;
cltt_ = expire_ - valid_lifetime_;
}
getColumnValue(r, row , SUBNET_ID_COL, subnet_id_);
......
......@@ -627,8 +627,8 @@ TEST_F(CqlLeaseMgrTest, getExpiredLeases4) {
/// @brief Checks that DHCPv4 leases with infinite valid lifetime
/// will never expire.
TEST_F(CqlLeaseMgrTest, getNeverExpiredLeases4) {
testGetNeverExpiredLeases4();
TEST_F(CqlLeaseMgrTest, infiniteAreNotExpired4) {
testInfiniteAreNotExpired4();
}
/// @brief Check that expired reclaimed DHCPv4 leases are removed.
......@@ -782,8 +782,8 @@ TEST_F(CqlLeaseMgrTest, getExpiredLeases6) {
/// @brief Checks that DHCPv6 leases with infinite valid lifetime
/// will never expire.
TEST_F(CqlLeaseMgrTest, getNeverExpiredLeases6) {
testGetNeverExpiredLeases6();
TEST_F(CqlLeaseMgrTest, infiniteAreNotExpired6) {
testInfiniteAreNotExpired6();
}
/// @brief Check that expired reclaimed DHCPv6 leases are removed.
......
......@@ -2253,7 +2253,7 @@ GenericLeaseMgrTest::testGetExpiredLeases6() {
}
void
GenericLeaseMgrTest::testGetNeverExpiredLeases4() {
GenericLeaseMgrTest::testInfiniteAreNotExpired4() {
// Get the leases to be used for the test.
vector<Lease4Ptr> leases = createLeases4();
Lease4Ptr lease = leases[1];
......@@ -2274,7 +2274,7 @@ GenericLeaseMgrTest::testGetNeverExpiredLeases4() {
}
void
GenericLeaseMgrTest::testGetNeverExpiredLeases6() {
GenericLeaseMgrTest::testInfiniteAreNotExpired6() {
// Get the leases to be used for the test.
vector<Lease6Ptr> leases = createLeases6();
Lease6Ptr lease = leases[1];
......
......@@ -355,11 +355,11 @@ public:
/// @brief Checks that DHCPv4 leases with infinite valid lifetime
/// will never expire.
void testGetNeverExpiredLeases4();
void testInfiniteAreNotExpired4();
/// @brief Checks that DHCPv6 leases with infinite valid lifetime
/// will never expire.
void testGetNeverExpiredLeases6();
void testInfiniteAreNotExpired6();
/// @brief Checks that declined IPv4 leases that have expired can be retrieved.
///
......
......@@ -593,8 +593,8 @@ TEST_F(MySqlLeaseMgrTest, getExpiredLeases4MultiThreading) {
/// @brief Checks that DHCPv4 leases with infinite valid lifetime
/// will never expire.
TEST_F(MySqlLeaseMgrTest, getNeverExpiredLeases4) {
testGetNeverExpiredLeases4();
TEST_F(MySqlLeaseMgrTest, infiniteAreNotExpired4) {
testInfiniteAreNotExpired4();
}
/// @brief Check that expired reclaimed DHCPv4 leases are removed.
......@@ -858,8 +858,8 @@ TEST_F(MySqlLeaseMgrTest, getExpiredLeases6MultiThreading) {
/// @brief Checks that DHCPv6 leases with infinite valid lifetime
/// will never expire.
TEST_F(MySqlLeaseMgrTest, getNeverExpiredLeases6) {
testGetNeverExpiredLeases6();
TEST_F(MySqlLeaseMgrTest, infiniteAreNotExpired6) {
testInfiniteAreNotExpired6();
}
/// @brief Check that expired reclaimed DHCPv6 leases are removed.
......
......@@ -547,8 +547,8 @@ TEST_F(PgSqlLeaseMgrTest, getExpiredLeases4MultiThreading) {
/// @brief Checks that DHCPv4 leases with infinite valid lifetime
/// will never expire.
TEST_F(PgSqlLeaseMgrTest, getNeverExpiredLeases4) {
testGetNeverExpiredLeases4();
TEST_F(PgSqlLeaseMgrTest, infiniteAreNotExpired4) {
testInfiniteAreNotExpired4();
}
/// @brief Check that expired reclaimed DHCPv4 leases are removed.
......@@ -812,8 +812,8 @@ TEST_F(PgSqlLeaseMgrTest, getExpiredLeases6MultiThreading) {
/// @brief Checks that DHCPv6 leases with infinite valid lifetime
/// will never expire.
TEST_F(PgSqlLeaseMgrTest, getNeverExpiredLeases6) {
testGetNeverExpiredLeases6();
TEST_F(PgSqlLeaseMgrTest, infiniteAreNotExpired6) {
testInfiniteAreNotExpired6();
}
/// @brief Check that expired reclaimed DHCPv6 leases are removed.
......
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