"MYSQL_LB_SFLQ_CREATE_POOL6", "creating shared-flq pool for address range %1 - %2, type %3, delegated length: %4, subnet id %5, recreate %6, capacity %7",
"MYSQL_LB_SFLQ_PICK_LEASE4", "picking a free lease from address range %1 - %2",
"MYSQL_LB_SFLQ_PICK_LEASE6", "picking a free lease from address range %1 - %2",
- "MYSQL_LB_SFLQ_POOL4_DELETE", "delete the V4 SFLQ pool with start address %1 and end address %2, forece = %3",
+ "MYSQL_LB_SFLQ_POOL4_DELETE", "delete the V4 SFLQ pool with start address %1 and end address %2, force = %3",
"MYSQL_LB_SFLQ_POOL4_GET_ALL", "fetch all V4 SFLQ pools",
"MYSQL_LB_SFLQ_POOL4_GET_BY_RANGE", "fetch all V4 SFLQ pools that overlap the range %1 and %2",
"MYSQL_LB_SFLQ_POOL4_GET_BY_SUBNET", "fetch all V4 SFLQ pools for subnet-id %1",
- "MYSQL_LB_SFLQ_POOL6_DELETE", "delete the V6 SFLQ pool with start address %1 and end address %2, forece = %3",
+ "MYSQL_LB_SFLQ_POOL6_DELETE", "delete the V6 SFLQ pool with start address %1 and end address %2, force = %3",
"MYSQL_LB_SFLQ_POOL6_GET_ALL", "fetch all V6 SFLQ pools",
"MYSQL_LB_SFLQ_POOL6_GET_BY_RANGE", "fetch all V6 SFLQ pools that overlap the range %1 and %2",
"MYSQL_LB_SFLQ_POOL6_GET_BY_SUBNET", "fetch all V6 SFLQ pools for subnet-id %1",
This debug message is issued when the server asks the lease back end for
the v4 SFLQ pool that overlap the given address range.
-% MYSQL_LB_SFLQ_POOL4_DELETE delete the V4 SFLQ pool with start address %1 and end address %2, forece = %3
+% MYSQL_LB_SFLQ_POOL4_DELETE delete the V4 SFLQ pool with start address %1 and end address %2, force = %3
Logged at debug log level 50.
This debug message is issued when the server asks the lease back to delete
the v4 SFLQ pool (and it's free lease data) that match the given start and end
This debug message is issued when the server asks the lease back end for
the v6 SFLQ pool that overlap the given address range.
-% MYSQL_LB_SFLQ_POOL6_DELETE delete the V6 SFLQ pool with start address %1 and end address %2, forece = %3
+% MYSQL_LB_SFLQ_POOL6_DELETE delete the V6 SFLQ pool with start address %1 and end address %2, force = %3
Logged at debug log level 50.
This debug message is issued when the server asks the lease back to delete
the v6 SFLQ pool (and it's free lease data) that match the given start and end
" LEFT JOIN free_lease4 AS f "
" ON f.address >= q.start_address AND f.address <= q.end_address "
" GROUP BY q.id "
- " ORDER BY q.subnet_id, q.start_address"},
+ " ORDER BY q.subnet_id ASC, q.start_address ASC"},
{MySqlLeaseMgr::SFLQ_POOL4_GET_BY_SUBNET,
"SELECT q.id, q.subnet_id, 3 as lease_type, "
MYSQL_BIND obind[1];
memset(obind, 0, sizeof(obind));
- char b_addr_buffer[45];
+ char b_addr_buffer[POOL_ADDRESS6_BUF_LENGTH];
unsigned long b_addr_length = sizeof(b_addr_buffer);
obind[0].buffer_type = MYSQL_TYPE_STRING;
obind[0].buffer = reinterpret_cast<char*>(b_addr_buffer);
.arg(subnet_id);
MySqlBindingCollection in_bindings = {
- MySqlBinding::createInteger<int64_t>(subnet_id)
+ MySqlBinding::createInteger<int32_t>(subnet_id)
};
return (sflqPoolGetCommon(SFLQ_POOL4_GET_BY_SUBNET, in_bindings));
SflqPoolInfoCollectionPtr pools(new SflqPoolInfoCollection());
ctx->conn_.selectQuery(stindex, where_bindings, out_bindings,
- [this, &pools]
+ [&pools]
(MySqlBindingCollection& out_bindings) {
SflqPoolInfoPtr info(new SflqPoolInfo());
/// @brief Delete the SFLQ V4 pool that matches a start and end address.
///
/// Deletes the flq_pool4 entry along with its free_lease4 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// @brief Delete the SFLQ V6 pool that matches a start and end address.
///
/// Deletes the flq_pool6 entry along with its free_lease6 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// @param stindex index of the SQL statement to execute.
/// @param where_bindings input bindings holding the where clause parameter
/// values (if any)
- /// @param family protocl family AF_INET or AF_INET6
+ /// @param family protocol family AF_INET or AF_INET6
///
/// @return A collection of the SFLQ V4 pools.
SflqPoolInfoCollectionPtr sflqPoolGetCommon(StatementIndex stindex,
/// @param start_address start address of the pool to delete.
/// @param end_address end address of the pool to delete.
/// @param force overrides check for overlapping pools when true.
- /// @param family protocl family AF_INET or AF_INET6
+ /// @param family protocol family AF_INET or AF_INET6
///
/// @return True a pool was deleted.
/// @throw InvalidOperation if force is false and overlapping pools are
"PGSQL_LB_SFLQ_CREATE_POOL6", "creating shared-flq pool for address range %1 - %2, type %3, delegated length: %4, subnet id %5, recreate %6, capacity %7",
"PGSQL_LB_SFLQ_PICK_LEASE4", "picking a free lease from address range %1 - %2",
"PGSQL_LB_SFLQ_PICK_LEASE6", "picking a free lease from address range %1 - %2",
- "PGSQL_LB_SFLQ_POOL4_DELETE", "delete the V4 SFLQ pool with start address %1 and end address %2, forece = %3",
+ "PGSQL_LB_SFLQ_POOL4_DELETE", "delete the V4 SFLQ pool with start address %1 and end address %2, force = %3",
"PGSQL_LB_SFLQ_POOL4_GET_ALL", "fetch all V4 SFLQ pools",
"PGSQL_LB_SFLQ_POOL4_GET_BY_RANGE", "fetch all V4 SFLQ pools that overlap the range %1 and %2",
"PGSQL_LB_SFLQ_POOL4_GET_BY_SUBNET", "fetch all V4 SFLQ pools for subnet-id %1",
- "PGSQL_LB_SFLQ_POOL6_DELETE", "delete the V6 SFLQ pool with start address %1 and end address %2, forece = %3",
+ "PGSQL_LB_SFLQ_POOL6_DELETE", "delete the V6 SFLQ pool with start address %1 and end address %2, force = %3",
"PGSQL_LB_SFLQ_POOL6_GET_ALL", "fetch all V6 SFLQ pools",
"PGSQL_LB_SFLQ_POOL6_GET_BY_RANGE", "fetch all V6 SFLQ pools that overlap the range %1 and %2",
"PGSQL_LB_SFLQ_POOL6_GET_BY_SUBNET", "fetch all V6 SFLQ pools for subnet-id %1",
This debug message is issued when the server asks the lease back end for
the v4 SFLQ pool that overlap the given address range.
-% PGSQL_LB_SFLQ_POOL4_DELETE delete the V4 SFLQ pool with start address %1 and end address %2, forece = %3
+% PGSQL_LB_SFLQ_POOL4_DELETE delete the V4 SFLQ pool with start address %1 and end address %2, force = %3
Logged at debug log level 50.
This debug message is issued when the server asks the lease back to delete
the v4 SFLQ pool (and it's free lease data) that match the given start and end
This debug message is issued when the server asks the lease back end for
the v6 SFLQ pool that overlap the given address range.
-% PGSQL_LB_SFLQ_POOL6_DELETE delete the V6 SFLQ pool with start address %1 and end address %2, forece = %3
+% PGSQL_LB_SFLQ_POOL6_DELETE delete the V6 SFLQ pool with start address %1 and end address %2, force = %3
Logged at debug log level 50.
This debug message is issued when the server asks the lease back to delete
the v6 SFLQ pool (and it's free lease data) that match the given start and end
"sflqDeleteLease6",
"SELECT sflqDeleteLease6(cast($1 as inet), $2)" },
- // SFLQ_SFLQ_POOL4_GET_ALL
+ // SFLQ_POOL4_GET_ALL
{ 0, { },
"sflqPool4GetAll",
"SELECT q.id, q.subnet_id, 3 as lease_type, "
" LEFT JOIN free_lease4 AS f "
" ON f.address >= q.start_address AND f.address <= q.end_address "
" GROUP BY q.id "
- " ORDER BY q.subnet_id, q.start_address"},
+ " ORDER BY q.subnet_id ASC, q.start_address ASC"},
- // SFLQ_SFLQ_POOL4_GET_BY_SUBNET
+ // SFLQ_POOL4_GET_BY_SUBNET
{ 1, { OID_INT8 },
"sflqPool4GetBySubnet",
"SELECT q.id, q.subnet_id, 3 as lease_type, "
" ON f.address >= q.start_address AND f.address <= q.end_address "
" WHERE q.subnet_id = $1 "
" GROUP BY q.id "
- " ORDER BY q.subnet_id, q.start_address"},
+ " ORDER BY q.subnet_id ASC, q.start_address ASC"},
// SFLQ_POOL4_GET_BY_RANGE
{ 2, { OID_INT8, OID_INT8 },
" USING deleted_pool p "
" WHERE f.address BETWEEN p.start_address AND p.end_address"},
- // SFLQ_SFLQ_POOL6_GET_ALL
+ // SFLQ_POOL6_GET_ALL
{ 0, { },
"sflqPool6GetAll",
"SELECT q.id, q.subnet_id, q.lease_type, "
" GROUP BY q.id "
" ORDER BY q.subnet_id ASC, inetToBytea(q.start_address) ASC "},
- // SFLQ_SFLQ_POOL6_GET_BY_SUBNET
+ // SFLQ_POOL6_GET_BY_SUBNET
{ 1, { OID_INT8 },
"sflqPool6GetBySubnet",
"SELECT q.id, q.subnet_id, q.lease_type, "
.arg(recreate)
.arg(capacity);
} catch (const std::exception& ex) {
- isc_throw(BadValue, "PgqlLeasMgr::sflqCreateFlqPool4 " << ex.what());
+ isc_throw(BadValue, "PgSqlLeaseMgr::sflqCreateFlqPool4 " << ex.what());
}
// Get a context
/// @brief Delete the SFLQ V4 pool that matches a start and end address.
///
/// Deletes the flq_pool4 entry along with its free_lease4 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// @brief Delete the SFLQ V6 pool that matches a start and end address.
///
/// Deletes the flq_pool6 entry along with its free_lease6 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// @param stindex index of the SQL statement to execute.
/// @param where_bindings input bindings holding the where clause parameter
/// values (if any)
- /// @param family protocl family AF_INET or AF_INET6
+ /// @param family protocol family AF_INET or AF_INET6
///
/// @return A collection of the SFLQ V4 pools.
SflqPoolInfoCollectionPtr sflqPoolGetCommon(const StatementIndex& stindex,
/// @param start_address start address of the pool to delete.
/// @param end_address end address of the pool to delete.
/// @param force overrides check for overlapping pools when true.
- /// @param family protocl family AF_INET or AF_INET6
+ /// @param family protocol family AF_INET or AF_INET6
///
/// @return True a pool was deleted.
/// @throw InvalidOperation if force is false and overlapping pools are
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/lease_mgr.h>
#include <dhcpsrv/sflq_allocator.h>
+#include <dhcpsrv/subnet_id.h>
#include <exceptions/exceptions.h>
#include <stats/stats_mgr.h>
#include <util/encode/encode.h>
start_address_(IOAddress::IPV4_ZERO_ADDRESS()),
end_address_(IOAddress::IPV4_ZERO_ADDRESS()),
delegated_len_(128),
- subnet_id_(0),
+ subnet_id_(SUBNET_ID_UNUSED),
free_leases_(0),
created_ts_(),
modified_ts_() {
SflqPoolInfoCollectionPtr
LeaseMgr::sflqPool6Get(asiolink::IOAddress, asiolink::IOAddress) {
- isc_throw(NotImplemented, "LeaseMgr::sflqPool6Get(IOAdress,IOAddress) called");
+ isc_throw(NotImplemented, "LeaseMgr::sflqPool6Get(IOAddress,IOAddress) called");
}
bool
/// @brief Delete the SFLQ V4 pool that matches a start and end address.
///
/// Deletes the flq_pool4 entry along with its free_lease4 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// @brief Delete the SFLQ V6 pool that matches a start and end address.
///
/// Deletes the flq_pool6 entry along with its free_lease6 data.
- /// Fails If there are multiple pools that overalap the given range
+ /// Fails If there are multiple pools that overlap the given range
/// unless force is true.
///
/// @param start_address start address of the pool to delete.
/// This allocator is part of the Shared Free Lease Queue (SFLQ) Allocation
/// scheme. The concept is similar to FLQ Allocation but rather than the
/// creating and maintaining free lease data locally, it is created and
-/// maintained in the lease back end (MySql and PosgreSQL only) where it
-/// can be shared by other servers.
+/// maintained in the lease back end where it can be shared by other
+/// servers.
///
/// Th allocator relies on stored procedures in the lease back end to
/// return free leases for a given IP address range (i.e. pool). This can
test_pool->subnet_id_, false));
}
- // Fetching all pools should find none.
+ // Fetching all pools should find all three.
ASSERT_NO_THROW_LOG(pool_infos = lmptr_->sflqPool4GetAll());
ASSERT_TRUE(pool_infos);
ASSERT_EQ(3, pool_infos->size());
test_pool->subnet_id_, false));
}
- // Fetching all pools should find none.
+ // Fetching all pools should find all three.
ASSERT_NO_THROW_LOG(pool_infos = lmptr_->sflqPool6GetAll());
ASSERT_TRUE(pool_infos);
ASSERT_EQ(3, pool_infos->size());
lmptr_->sflqCreateFlqPool4(start_address, end_address, false));
});
- usleep(1000);
thread th2([this, &ret2, start_address, end_address]() {
ASSERT_NO_THROW_LOG(ret2 =
lmptr_->sflqCreateFlqPool4(start_address, end_address, false));
/// equal to their rhs counterparts. Asserts if they are not "equal".
///
/// @param lhs left-side instance to compare
- /// @param rhs reft-side instance to compare
+ /// @param rhs right-side instance to compare
/// @param lineno source line of invocation (pass in __LINE__)
void checkPoolInfos(const SflqPoolInfo& lhs, const SflqPoolInfo& rhs, int lineno);