2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[#2866] Checkpoint

This commit is contained in:
Francis Dupont
2023-06-05 22:00:01 +02:00
committed by Marcin Siodelski
parent 823da39a90
commit 2b169683fe
4 changed files with 13 additions and 0 deletions

View File

@@ -279,6 +279,7 @@ extern const isc::log::MessageID DHCPSRV_TIMERMGR_UNREGISTER_ALL_TIMERS = "DHCPS
extern const isc::log::MessageID DHCPSRV_TIMERMGR_UNREGISTER_TIMER = "DHCPSRV_TIMERMGR_UNREGISTER_TIMER";
extern const isc::log::MessageID DHCPSRV_UNEXPECTED_NAME = "DHCPSRV_UNEXPECTED_NAME";
extern const isc::log::MessageID DHCPSRV_UNKNOWN_DB = "DHCPSRV_UNKNOWN_DB";
extern const isc::log::MessageID DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET = "DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET";
} // namespace dhcp
} // namespace isc
@@ -558,6 +559,7 @@ const char* values[] = {
"DHCPSRV_TIMERMGR_UNREGISTER_TIMER", "unregistering timer: %1",
"DHCPSRV_UNEXPECTED_NAME", "database access parameters passed through '%1', expected 'lease-database'",
"DHCPSRV_UNKNOWN_DB", "unknown database type: %1",
"DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET", "a subnet was configured unnumbered: %1",
NULL
};

View File

@@ -280,6 +280,7 @@ extern const isc::log::MessageID DHCPSRV_TIMERMGR_UNREGISTER_ALL_TIMERS;
extern const isc::log::MessageID DHCPSRV_TIMERMGR_UNREGISTER_TIMER;
extern const isc::log::MessageID DHCPSRV_UNEXPECTED_NAME;
extern const isc::log::MessageID DHCPSRV_UNKNOWN_DB;
extern const isc::log::MessageID DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET;
} // namespace dhcp
} // namespace isc

View File

@@ -1392,3 +1392,7 @@ indicate an error in the source code, please submit a bug report.
% DHCPSRV_UNKNOWN_DB unknown database type: %1
The database access string specified a database type (given in the
message) that is unknown to the software. This is a configuration error.
% DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET a subnet was configured unnumbered: %1
A warning message issued when a subnet was configured with a zero or without
an id. The prefix of the subnet is displayed.

View File

@@ -9,6 +9,7 @@
#include <asiolink/io_address.h>
#include <asiolink/addr_utilities.h>
#include <dhcp/option_space.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <dhcpsrv/flq_allocation_state.h>
#include <dhcpsrv/flq_allocator.h>
#include <dhcpsrv/iterative_allocation_state.h>
@@ -72,6 +73,11 @@ Subnet::Subnet(const isc::asiolink::IOAddress& prefix, uint8_t len,
: id_(id == 0 ? generateNextID() : id), prefix_(prefix),
prefix_len_(len),
shared_network_name_() {
if ((id == 0) && (id_ == 1)) {
// Emit a warning on the first auto-numbered subnet.
LOG_WARN(dhcpsrv_logger, DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET)
.arg(toText());
}
if ((prefix.isV6() && len > 128) ||
(prefix.isV4() && len > 32)) {
isc_throw(BadValue,