From 069cf5f5f8da56f924580370732f0e8b8d26540c Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Tue, 8 Sep 2015 19:17:32 +0200 Subject: [PATCH] [3966] Addressed review comments. --- src/lib/dhcpsrv/dhcpsrv_messages.mes | 32 +++++++++++------------ src/lib/dhcpsrv/mysql_lease_mgr.cc | 6 ++--- src/lib/dhcpsrv/tests/schema_mysql_copy.h | 12 ++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index b0e87938c9..bbb2373226 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes @@ -231,17 +231,17 @@ A debug message issued when the server is attempting to delete a lease for the specified address from the memory file database for the specified address. -% DHCPSRV_MEMFILE_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed leases expired more than %1 s ago +% DHCPSRV_MEMFILE_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed IPv4 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv4 leases which have expired longer than a specified period of time. -The argument specified the number of seconds since leases' expiration -before they can be removed. +The argument is the amount of time Kea waits after a reclaimed +lease expires before considering its removal. -% DHCPSRV_MEMFILE_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed leases expired more than %1 s ago +% DHCPSRV_MEMFILE_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed IPv6 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv6 leases which have expired longer than a specified period of time. -The argument specified the number of seconds since leases' expiration -before they can be removed. +The argument is the amount of time Kea waits after a reclaimed +lease expires before considering its removal. % DHCPSRV_MEMFILE_DELETE_EXPIRED_RECLAIMED_START starting deletion of %1 expired-reclaimed leases A debug message issued wheb the server has found expired-reclaimed @@ -266,12 +266,12 @@ A debug message issued when the server is attempting to obtain an IPv4 lease from the memory file database for a client with the specified client ID, hardware address and subnet ID. -% DHCPSRV_MEMFILE_GET_EXPIRED4 obtaining expired IPv4 leases with limit %1 +% DHCPSRV_MEMFILE_GET_EXPIRED4 obtaining maximum %1 of expired IPv4 leases A debug message issued when the server is attempting to obtain expired IPv4 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. -% DHCPSRV_MEMFILE_GET_EXPIRED6 obtaining expired IPv6 leases with limit %1 +% DHCPSRV_MEMFILE_GET_EXPIRED6 obtaining maximum %1 of expired IPv6 leases A debug message issued when the server is attempting to obtain expired IPv6 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. @@ -401,17 +401,17 @@ connection including database name and username needed to access it A debug message issued when the server is attempting to delete a lease for the specified address from the MySQL database for the specified address. -% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed leases expired more than %1 s ago +% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4 deleting reclaimed IPv4 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv4 leases which have expired longer than a specified period of time. -The argument specified the number of seconds since leases' expiration -before they can be removed. +The argument is the amount of time Kea waits after a reclaimed +lease expires before considering its removal. -% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed leases expired more than %1 s ago +% DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6 deleting reclaimed IPv6 leases that expired more than %1 seconds ago A debug message issued when the server is removing reclaimed DHCPv6 leases which have expired longer than a specified period of time. -The argument specified the number of seconds since leases' expiration -before they can be removed. +The argument is the amount of time Kea waits after a reclaimed +lease expires before considering its removal. % DHCPSRV_MYSQL_DELETED_EXPIRED_RECLAIMED deleted %1 reclaimed leases from the database A debug message issued when the server has removed a number of reclaimed @@ -431,12 +431,12 @@ A debug message issued when the server is attempting to obtain a set of IPv4 leases from the MySQL database for a client with the specified client identification. -% DHCPSRV_MYSQL_GET_EXPIRED4 obtaining expired IPv4 leases with limit %1 +% DHCPSRV_MYSQL_GET_EXPIRED4 obtaining maximum %1 of expired IPv4 leases A debug message issued when the server is attempting to obtain expired IPv4 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. -% DHCPSRV_MYSQL_GET_EXPIRED6 obtaining expired IPv6 leases with limit %1 +% DHCPSRV_MYSQL_GET_EXPIRED6 obtaining maximum %1 of expired IPv6 leases A debug message issued when the server is attempting to obtain expired IPv6 leases to reclaim them. The maximum number of leases to be retrieved is logged in the message. diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 244fe3e065..cdd82f3c22 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -1378,8 +1378,8 @@ MySqlLeaseMgr::convertToDatabaseTime(const time_t input_time, output_time.hour = time_tm.tm_hour; output_time.minute = time_tm.tm_min; output_time.second = time_tm.tm_sec; - output_time.second_part = 0; // No fractional seconds - output_time.neg = my_bool(0); // Not negative + output_time.second_part = 0; // No fractional seconds + output_time.neg = my_bool(0); // Not negative } void @@ -1389,7 +1389,7 @@ MySqlLeaseMgr::convertToDatabaseTime(const time_t cltt, // Calculate expiry time. Store it in the 64-bit value so as we can detect // overflows. - int64_t expire_time_64 = static_cast(cltt) + + const int64_t expire_time_64 = static_cast(cltt) + static_cast(valid_lifetime); // Even on 64-bit systems MySQL doesn't seem to accept the timestamps diff --git a/src/lib/dhcpsrv/tests/schema_mysql_copy.h b/src/lib/dhcpsrv/tests/schema_mysql_copy.h index c75bef60ae..a36aedca60 100644 --- a/src/lib/dhcpsrv/tests/schema_mysql_copy.h +++ b/src/lib/dhcpsrv/tests/schema_mysql_copy.h @@ -1,4 +1,4 @@ -// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -100,9 +100,9 @@ const char* create_statement[] = { // Schema upgrade to 2.0 starts here. "ALTER TABLE lease6 " - "ADD COLUMN hwaddr varbinary(20)," - "ADD COLUMN hwtype smallint unsigned," - "ADD COLUMN hwaddr_source int unsigned;", + "ADD COLUMN hwaddr varbinary(20)," + "ADD COLUMN hwtype smallint unsigned," + "ADD COLUMN hwaddr_source int unsigned;", // Production schema has lease_hwaddr_source table. It is not used by // kea code and is simply useful for formulating more human readable @@ -127,10 +127,10 @@ const char* create_statement[] = { // Schema upgrade to 4.0 starts here. "ALTER TABLE lease4 " - "ADD COLUMN state INT UNSIGNED DEFAULT 0", + "ADD COLUMN state INT UNSIGNED DEFAULT 0", "ALTER TABLE lease6 " - "ADD COLUMN state INT UNSIGNED DEFAULT 0", + "ADD COLUMN state INT UNSIGNED DEFAULT 0", "CREATE INDEX lease4_by_state_expire ON lease4 (state, expire)", "CREATE INDEX lease6_by_state_expire ON lease6 (state, expire)", -- 2.47.3