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

[#2869] After rebase fixes

This commit is contained in:
Francis Dupont
2023-07-04 20:36:47 +02:00
parent e460e0c947
commit b6d63f7d30
17 changed files with 35 additions and 151 deletions

View File

@@ -774,10 +774,6 @@ ControlledDhcpv6Srv::commandStatusGetHandler(const string&,
status->set("extended-info-tables",
Element::create(LeaseMgrFactory::instance().getExtendedInfoTablesEnabled()));
status->set("by-relay-id-table-size",
Element::create(static_cast<long long>(LeaseMgrFactory::instance().byRelayId6size())));
status->set("by-remote-id-table-size",
Element::create(static_cast<long long>(LeaseMgrFactory::instance().byRemoteId6size())));
// Iterate through the interfaces and get all the errors.
ElementPtr socket_errors(Element::createList());

View File

@@ -1098,14 +1098,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) {
ASSERT_TRUE(found_extended_info_tables);
EXPECT_FALSE(found_extended_info_tables->boolValue());
auto found_by_relay_id_table_size = arguments->get("by-relay-id-table-size");
ASSERT_TRUE(found_by_relay_id_table_size);
EXPECT_LE(0, found_by_relay_id_table_size->intValue());
auto found_by_remote_id_table_size = arguments->get("by-remote-id-table-size");
ASSERT_TRUE(found_by_remote_id_table_size);
EXPECT_LE(0, found_by_remote_id_table_size->intValue());
MultiThreadingMgr::instance().setMode(true);
MultiThreadingMgr::instance().setThreadPoolSize(4);
MultiThreadingMgr::instance().setPacketQueueSize(64);

View File

@@ -196,9 +196,6 @@ extern const isc::log::MessageID DHCPSRV_MYSQL_START_TRANSACTION = "DHCPSRV_MYSQ
extern const isc::log::MessageID DHCPSRV_MYSQL_TLS_CIPHER = "DHCPSRV_MYSQL_TLS_CIPHER";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPDATE_ADDR4 = "DHCPSRV_MYSQL_UPDATE_ADDR4";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPDATE_ADDR6 = "DHCPSRV_MYSQL_UPDATE_ADDR6";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6 = "DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR = "DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_PAGE = "DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_PAGE";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4 = "DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_ERROR = "DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_ERROR";
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_PAGE = "DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_PAGE";
@@ -259,9 +256,6 @@ extern const isc::log::MessageID DHCPSRV_PGSQL_START_TRANSACTION = "DHCPSRV_PGSQ
extern const isc::log::MessageID DHCPSRV_PGSQL_TLS_SUPPORT = "DHCPSRV_PGSQL_TLS_SUPPORT";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR4 = "DHCPSRV_PGSQL_UPDATE_ADDR4";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR6 = "DHCPSRV_PGSQL_UPDATE_ADDR6";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6 = "DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_ERROR = "DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_ERROR";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_PAGE = "DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_PAGE";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4 = "DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_ERROR = "DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_ERROR";
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_PAGE = "DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_PAGE";
@@ -486,9 +480,6 @@ const char* values[] = {
"DHCPSRV_MYSQL_TLS_CIPHER", "TLS cipher: %1",
"DHCPSRV_MYSQL_UPDATE_ADDR4", "updating IPv4 lease for address %1",
"DHCPSRV_MYSQL_UPDATE_ADDR6", "updating IPv6 lease for address %1, lease type %2",
"DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6", "upgrading IPv6 leases done in %1 pages with %2 updated leases",
"DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR", "upgrading binary address for IPv6 lease at %1 failed with %2",
"DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_PAGE", "upgrading IPv6 lease binary addresses at page %1 starting at %2 (updated %3)",
"DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4", "upgrading IPv4 leases done in %1 pages with %2 updated leases",
"DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_ERROR", "upgrading extending info for IPv4 lease at %1 failed with %2",
"DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_PAGE", "upgrading IPv4 lease extended info at page %1 starting at %2 (updated %3)",
@@ -549,9 +540,6 @@ const char* values[] = {
"DHCPSRV_PGSQL_TLS_SUPPORT", "Attempt to configure TLS: %1",
"DHCPSRV_PGSQL_UPDATE_ADDR4", "updating IPv4 lease for address %1",
"DHCPSRV_PGSQL_UPDATE_ADDR6", "updating IPv6 lease for address %1, lease type %2",
"DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6", "upgrading IPv6 leases done in %1 pages with %2 updated leases",
"DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_ERROR", "upgrading binary address for IPv6 lease at %1 failed with %2",
"DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_PAGE", "upgrading IPv6 lease binary addresses at page %1 starting at %2 (updated %3)",
"DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4", "upgrading IPv4 leases done in %1 pages with %2 updated leases",
"DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_ERROR", "upgrading extending info for IPv4 lease at %1 failed with %2",
"DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_PAGE", "upgrading IPv4 lease extended info at page %1 starting at %2 (updated %3)",

View File

@@ -197,9 +197,6 @@ extern const isc::log::MessageID DHCPSRV_MYSQL_START_TRANSACTION;
extern const isc::log::MessageID DHCPSRV_MYSQL_TLS_CIPHER;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPDATE_ADDR4;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPDATE_ADDR6;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_PAGE;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_ERROR;
extern const isc::log::MessageID DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4_PAGE;
@@ -260,9 +257,6 @@ extern const isc::log::MessageID DHCPSRV_PGSQL_START_TRANSACTION;
extern const isc::log::MessageID DHCPSRV_PGSQL_TLS_SUPPORT;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR4;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPDATE_ADDR6;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_ERROR;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_PAGE;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_ERROR;
extern const isc::log::MessageID DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4_PAGE;

View File

@@ -995,19 +995,6 @@ lease from the MySQL database for the specified address.
A debug message issued when the server is attempting to update IPv6
lease from the MySQL database for the specified address.
% DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6 upgrading IPv6 leases done in %1 pages with %2 updated leases
The server upgraded binary addresses. The number of pages and the
final count of updated leases are displayed.
% DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_ERROR upgrading binary address for IPv6 lease at %1 failed with %2
An error message issued when the server failed to upgrade a binary address.
The address of the lease and the error message are displayed.
% DHCPSRV_MYSQL_UPGRADE_BINARY_ADDRESS6_PAGE upgrading IPv6 lease binary addresses at page %1 starting at %2 (updated %3)
A debug message issued when the server upgrades IPv6 lease binary addresses.
The page number and started address, and the count of already updated leases
are displayed.
% DHCPSRV_MYSQL_UPGRADE_EXTENDED_INFO4 upgrading IPv4 leases done in %1 pages with %2 updated leases
The server upgraded extended info. The number of pages and the final count of
updated leases are displayed.
@@ -1291,19 +1278,6 @@ lease from the PostgreSQL database for the specified address.
A debug message issued when the server is attempting to update IPv6
lease from the PostgreSQL database for the specified address.
% DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6 upgrading IPv6 leases done in %1 pages with %2 updated leases
The server upgraded binary addresses. The number of pages and the
final count of updated leases are displayed.
% DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_ERROR upgrading binary address for IPv6 lease at %1 failed with %2
An error message issued when the server failed to upgrade a binary address.
The address of the lease and the error message are displayed.
% DHCPSRV_PGSQL_UPGRADE_BINARY_ADDRESS6_PAGE upgrading IPv6 lease binary addresses at page %1 starting at %2 (updated %3)
A debug message issued when the server upgrades IPv6 lease binary addresses.
The page number and started address, and the count of already updated leases
are displayed.
% DHCPSRV_PGSQL_UPGRADE_EXTENDED_INFO4 upgrading IPv4 leases done in %1 pages with %2 updated leases
The server upgraded extended info. The number of pages and the final count of
updated leases are displayed.

View File

@@ -1040,14 +1040,6 @@ public:
extended_info_tables_enabled_ = enabled;
}
/// @brief Build extended info v6 tables.
///
/// @param update Update extended info in database.
/// @param current specify whether to use current (true) or staging
/// (false) config.
/// @return The number of updates in the database or 0.
virtual size_t buildExtendedInfoTables6(bool update, bool current) = 0;
/// @brief Upgrade extended info (v6).
///
/// On SQL backends for all leases with a not null user context.

View File

@@ -3457,16 +3457,6 @@ Memfile_LeaseMgr::buildExtendedInfoTables6() {
.arg(processed);
}
size_t
Memfile_LeaseMgr::buildExtendedInfoTables6(bool update, bool current) {
if (MultiThreadingMgr::instance().getMode()) {
std::lock_guard<std::mutex> lock(*mutex_);
return (buildExtendedInfoTables6Internal(update, current));
} else {
return (buildExtendedInfoTables6Internal(update, current));
}
}
size_t
Memfile_LeaseMgr::upgradeExtendedInfo6(const LeasePageSize& /* page_size */) {
return (0);

View File

@@ -1416,14 +1416,6 @@ public:
/// @return The number of updates in the database or 0.
size_t extractExtendedInfo4(bool update, bool current);
/// @brief Build extended info v6 tables.
///
/// @param update Update extended info in database.
/// @param current specify whether to use current (true) or staging
/// (false) config.
/// @return The number of updates in the database or 0.
virtual size_t buildExtendedInfoTables6(bool update, bool current) override;
/// @brief Upgrade extended info (v6).
///
/// @param page_size The page size used for retrieval.

View File

@@ -4540,12 +4540,15 @@ MySqlLeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
memset(inbind, 0, sizeof(inbind));
// Bind the lease address.
std::string addr_data = addr.toText();
unsigned long addr_size = addr_data.size();
inbind[0].buffer_type = MYSQL_TYPE_STRING;
inbind[0].buffer = const_cast<char*>(addr_data.c_str());
inbind[0].buffer_length = addr_size;
inbind[0].length = &addr_size;
std::vector<uint8_t>addr_bytes = addr.toBytes();
unsigned long addr_length = addr_bytes.size();
if (addr_length != 16) {
isc_throw(DbOperationError, "lease6 address is not 16 bytes long");
}
inbind[0].buffer_type = MYSQL_TYPE_BLOB;
inbind[0].buffer = reinterpret_cast<char*>(&addr_bytes[0]);
inbind[0].buffer_length = addr_length;
inbind[0].length = &addr_length;
// Get the lease.
Lease6Ptr lease;
@@ -4706,12 +4709,15 @@ MySqlLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
memset(inbind, 0, sizeof(inbind));
// Bind the lease address.
std::string addr_data = addr.toText();
unsigned long addr_size = addr_data.size();
inbind[0].buffer_type = MYSQL_TYPE_STRING;
inbind[0].buffer = const_cast<char*>(addr_data.c_str());
inbind[0].buffer_length = addr_size;
inbind[0].length = &addr_size;
std::vector<uint8_t>addr_bytes = addr.toBytes();
unsigned long addr_length = addr_bytes.size();
if (addr_length != 16) {
isc_throw(DbOperationError, "lease6 address is not 16 bytes long");
}
inbind[0].buffer_type = MYSQL_TYPE_BLOB;
inbind[0].buffer = reinterpret_cast<char*>(&addr_bytes[0]);
inbind[0].buffer_length = addr_length;
inbind[0].length = &addr_length;
// Get the lease.
Lease6Ptr lease;
@@ -4808,12 +4814,6 @@ MySqlLeaseMgr::getLeases6ByLink(const IOAddress& link_addr,
return (result);
}
size_t
MySqlLeaseMgr::buildExtendedInfoTables6(bool /* update */, bool /* current */) {
isc_throw(isc::NotImplemented,
"MySqlLeaseMgr::buildExtendedInfoTables6 not implemented");
}
size_t
MySqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
auto check = CfgMgr::instance().getCurrentCfg()->
@@ -4839,14 +4839,15 @@ MySqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
memset(inbind, 0, sizeof(inbind));
// Bind start address.
std::string start_addr_str = "";
if (!start_addr.isV6Zero()) {
start_addr_str = start_addr.toText();
std::vector<uint8_t>start_addr_bytes = start_addr.toBytes();
if (start_addr_bytes.size() != 16) {
isc_throw(DbOperationError, "start address is not 16 bytes long");
}
unsigned long start_addr_size = start_addr_str.size();
inbind[0].buffer_type = MYSQL_TYPE_STRING;
inbind[0].buffer = const_cast<char*>(start_addr_str.c_str());
inbind[0].buffer_length = start_addr_size;
unsigned long start_addr_size = 16;
inbind[0].buffer_type = MYSQL_TYPE_BLOB;
inbind[0].buffer = reinterpret_cast<char*>(&start_addr_bytes[0]);
inbind[0].buffer_length = 16;
inbind[0].length = &start_addr_size;
// Bind page size value.

View File

@@ -1177,14 +1177,6 @@ public:
/// @return The number of updates in the database.
virtual size_t upgradeExtendedInfo4(const LeasePageSize& page_size) override;
/// @brief Build extended info v6 tables.
///
/// @param update Update extended info in database.
/// @param current specify whether to use current (true) or staging
/// (false) config.
/// @return The number of updates in the database or 0.
virtual size_t buildExtendedInfoTables6(bool update, bool current) override;
/// @brief Upgrade extended info (v6).
///
/// All leases with a not null user context.

View File

@@ -321,7 +321,7 @@ PgSqlTaggedStatement tagged_statements[] = {
"hwaddr, hwtype, hwaddr_source, "
"state, user_context, pool_id "
"FROM lease6 "
"WHERE address = $1" },
"WHERE address = cast($1 as inet)" },
// GET_LEASE6_DUID_IAID
{ 3, { OID_BYTEA, OID_INT8, OID_INT2 },
@@ -3810,12 +3810,6 @@ PgSqlLeaseMgr::getLeases6ByLink(const IOAddress& link_addr,
return (result);
}
size_t
PgSqlLeaseMgr::buildExtendedInfoTables6(bool /* update */, bool /* current */) {
isc_throw(isc::NotImplemented,
"PgSqlLeaseMgr::buildExtendedInfoTables6 not implemented");
}
size_t
PgSqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
auto check = CfgMgr::instance().getCurrentCfg()->
@@ -3840,10 +3834,7 @@ PgSqlLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& page_size) {
PsqlBindArray bind_array;
// Bind start address.
std::string start_addr_str = "0";
if (!start_addr.isV6Zero()) {
start_addr_str = start_addr.toText();
}
std::string start_addr_str = start_addr.toText();
bind_array.add(start_addr_str);
// Bind page size value.

View File

@@ -1131,14 +1131,6 @@ public:
/// @return The number of updates in the database.
virtual size_t upgradeExtendedInfo4(const LeasePageSize& page_size) override;
/// @brief Build extended info v6 tables.
///
/// @param update Update extended info in database.
/// @param current specify whether to use current (true) or staging
/// (false) config.
/// @return The number of updates in the database or 0.
virtual size_t buildExtendedInfoTables6(bool update, bool current) override;
/// @brief Upgrade extended info (v6).
///
/// All leases with a not null user context.

View File

@@ -203,9 +203,9 @@ TEST(MySqlOpenTest, OpenDatabase) {
// Check for extended info tables.
const char* EX_INFO = "extended-info-tables=true";
EXPECT_THROW(LeaseMgrFactory::create(connectionString(
MYSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, EX_INFO)),
NotImplemented);
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
MYSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, EX_INFO)));
LeaseMgrFactory::destroy();
// Tidy up after the test
destroyMySQLSchema(true);

View File

@@ -211,9 +211,9 @@ TEST(PgSqlOpenTest, OpenDatabase) {
// Check for extended info tables.
const char* EX_INFO = "extended-info-tables=true";
EXPECT_THROW(LeaseMgrFactory::create(connectionString(
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, EX_INFO)),
NotImplemented);
EXPECT_NO_THROW(LeaseMgrFactory::create(connectionString(
PGSQL_VALID_TYPE, VALID_NAME, VALID_HOST, VALID_USER, VALID_PASSWORD, EX_INFO)));
LeaseMgrFactory::destroy();
// Tidy up after the test
destroyPgSQLSchema();

View File

@@ -296,12 +296,6 @@ ConcreteLeaseMgr::upgradeExtendedInfo4(const LeasePageSize& /* page_size */) {
return (0);
}
size_t
ConcreteLeaseMgr::buildExtendedInfoTables6(bool /* update */,
bool /* current */) {
isc_throw(isc::NotImplemented, "ConcreteLeaseMgr:buildExtendedInfoTables6 not implemented");
}
size_t
ConcreteLeaseMgr::upgradeExtendedInfo6(const LeasePageSize& /* page_size */) {
return (0);

View File

@@ -381,10 +381,6 @@ public:
virtual size_t
upgradeExtendedInfo4(const LeasePageSize& /* page_size */) override;
/// @brief Stub implementation.
virtual size_t buildExtendedInfoTables6(bool /* update */,
bool /* current */) override;
/// @brief Stub implementation.
virtual size_t
upgradeExtendedInfo6(const LeasePageSize& /* page_size */) override;

View File

@@ -1,6 +1,6 @@
{
"access": "write",
"avail": "2.3.9",
"avail": "2.5.0",
"brief": [
"This command sanitizes extended info of all IPv6 leases and rebuilds when they are enabled relay and remote ID tables in the SQL lease database."
],