2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-04 16:05:17 +00:00

[#2868] Addressed comments

This commit is contained in:
Francis Dupont
2023-05-25 00:09:23 +02:00
parent 02b5540f79
commit 003be31fd3
10 changed files with 85 additions and 81 deletions

View File

@@ -3717,6 +3717,14 @@ MySqlLeaseMgr::getLeases4ByRelayId(const OptionBuffer& relay_id,
const LeasePageSize& page_size,
const time_t& qry_start_time /* = 0 */,
const time_t& qry_end_time /* = 0 */) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_RELAYID4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(idToText(relay_id))
.arg(qry_start_time)
.arg(qry_end_time);
// Expecting IPv4 address.
if (!lower_bound_address.isV4()) {
isc_throw(InvalidAddressFamily, "expected IPv4 address while "
@@ -3737,14 +3745,6 @@ MySqlLeaseMgr::getLeases4ByRelayId(const OptionBuffer& relay_id,
isc_throw(BadValue, "start time must be before end time");
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_RELAYID4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(idToText(relay_id))
.arg(qry_start_time)
.arg(qry_end_time);
// Prepare WHERE clause
size_t bindings = 3;
if (have_qst) {
@@ -3829,6 +3829,14 @@ MySqlLeaseMgr::getLeases4ByRemoteId(const OptionBuffer& remote_id,
const LeasePageSize& page_size,
const time_t& qry_start_time /* = 0 */,
const time_t& qry_end_time /* = 0 */) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_REMOTEID4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(idToText(remote_id))
.arg(qry_start_time)
.arg(qry_end_time);
// Expecting IPv4 address.
if (!lower_bound_address.isV4()) {
isc_throw(InvalidAddressFamily, "expected IPv4 address while "
@@ -3849,14 +3857,6 @@ MySqlLeaseMgr::getLeases4ByRemoteId(const OptionBuffer& remote_id,
isc_throw(BadValue, "start time must be before end time");
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_REMOTEID4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(idToText(remote_id))
.arg(qry_start_time)
.arg(qry_end_time);
// Prepare WHERE clause
size_t bindings = 3;
if (have_qst) {
@@ -4047,6 +4047,13 @@ MySqlLeaseMgr::getLeases6ByLink(const IOAddress& link_addr,
uint8_t link_len,
const IOAddress& lower_bound_address,
const LeasePageSize& page_size) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_LINKADDR6)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(link_addr.toText())
.arg(static_cast<unsigned>(link_len));
// Expecting IPv6 valid prefix and address.
if (!link_addr.isV6()) {
isc_throw(InvalidAddressFamily, "expected IPv6 address while "
@@ -4063,13 +4070,6 @@ MySqlLeaseMgr::getLeases6ByLink(const IOAddress& link_addr,
<< lower_bound_address);
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_LINKADDR6)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText())
.arg(link_addr.toText())
.arg(static_cast<unsigned>(link_len));
Lease6Collection result;
const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
@@ -4181,6 +4181,8 @@ MySqlLeaseMgr::upgradeBinaryAddress6(const LeasePageSize& page_size) {
start_addr = leases.back()->addr_;
for (auto lease : leases) {
try {
// Update to the same lease will fill the new column i.e.
// refresh does the job...
updateLease6(lease);
++updated;
} catch (const NoSuchLease&) {
@@ -4189,7 +4191,7 @@ MySqlLeaseMgr::upgradeBinaryAddress6(const LeasePageSize& page_size) {
continue;
} catch (const std::exception& ex) {
// Something when wrong, for instance extract failed.
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
LOG_ERROR(dhcpsrv_logger,
DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR)
.arg(lease->addr_.toText())
.arg(ex.what());