mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 07:25:18 +00:00
[5651] Guard against invalid address family.
This commit is contained in:
@@ -1943,6 +1943,13 @@ MySqlLeaseMgr::getLeases4() const {
|
||||
Lease4Collection
|
||||
MySqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
|
||||
const LeasePageSize& page_size) const {
|
||||
// Expecting IPv4 address.
|
||||
if (!lower_bound_address.isV4()) {
|
||||
isc_throw(InvalidAddressFamily, "expected IPv4 address while "
|
||||
"retrieving leases from the lease database, got "
|
||||
<< lower_bound_address);
|
||||
}
|
||||
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_PAGE4)
|
||||
.arg(page_size.page_size_)
|
||||
.arg(lower_bound_address.toText());
|
||||
@@ -1973,6 +1980,13 @@ MySqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
|
||||
Lease4Collection
|
||||
MySqlLeaseMgr::getLeases4(const IOAddress& lower_bound_address,
|
||||
const IOAddress& upper_bound_address) const {
|
||||
// Expecting two IPv4 addresses.
|
||||
if (!lower_bound_address.isV4() || !upper_bound_address.isV4()) {
|
||||
isc_throw(InvalidAddressFamily, "expected two IPv4 addresses for "
|
||||
"retrieving a range of leases, got "
|
||||
<< lower_bound_address << " and " << upper_bound_address);
|
||||
}
|
||||
|
||||
if (upper_bound_address < lower_bound_address) {
|
||||
isc_throw(InvalidRange, "upper bound address " << upper_bound_address
|
||||
<< " is lower than lower bound address " << lower_bound_address);
|
||||
@@ -2164,6 +2178,13 @@ MySqlLeaseMgr::getLeases6() const {
|
||||
Lease6Collection
|
||||
MySqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
|
||||
const LeasePageSize& page_size) const {
|
||||
// Expecting IPv6 address.
|
||||
if (!lower_bound_address.isV6()) {
|
||||
isc_throw(InvalidAddressFamily, "expected IPv6 address while "
|
||||
"retrieving leases from the lease database, got "
|
||||
<< lower_bound_address);
|
||||
}
|
||||
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_PAGE6)
|
||||
.arg(page_size.page_size_)
|
||||
.arg(lower_bound_address.toText());
|
||||
@@ -2203,6 +2224,13 @@ MySqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
|
||||
Lease6Collection
|
||||
MySqlLeaseMgr::getLeases6(const IOAddress& lower_bound_address,
|
||||
const IOAddress& upper_bound_address) const {
|
||||
// Expecting two IPv6 addresses.
|
||||
if (!lower_bound_address.isV6() || !upper_bound_address.isV6()) {
|
||||
isc_throw(InvalidAddressFamily, "expected two IPv6 addresses for "
|
||||
"retrieving a range of leases, got "
|
||||
<< lower_bound_address << " and " << upper_bound_address);
|
||||
}
|
||||
|
||||
if (upper_bound_address < lower_bound_address) {
|
||||
isc_throw(InvalidRange, "upper bound address " << upper_bound_address
|
||||
<< " is lower than lower bound address " << lower_bound_address);
|
||||
|
Reference in New Issue
Block a user