summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2023-06-05 22:00:01 +0200
committerMarcin Siodelski <marcin@isc.org>2023-06-26 14:24:42 +0200
commit2b169683fee948fd8f5a6a086b58837532c2731e (patch)
tree941bcb9d91ea0ca9cb852b3ec6e547f5d4d157d3
parent[#2866] Checkpoint: updated examples and arm (diff)
downloadkea-2b169683fee948fd8f5a6a086b58837532c2731e.tar.xz
kea-2b169683fee948fd8f5a6a086b58837532c2731e.zip
[#2866] Checkpoint
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.cc2
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.h1
-rw-r--r--src/lib/dhcpsrv/dhcpsrv_messages.mes4
-rw-r--r--src/lib/dhcpsrv/subnet.cc6
4 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.cc b/src/lib/dhcpsrv/dhcpsrv_messages.cc
index 3b47fcf4d4..958d80ba2e 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.cc
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.cc
@@ -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
};
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.h b/src/lib/dhcpsrv/dhcpsrv_messages.h
index 0786c21e95..2363852b79 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.h
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.h
@@ -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
diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes
index 75de2ecaa7..9c7adadb40 100644
--- a/src/lib/dhcpsrv/dhcpsrv_messages.mes
+++ b/src/lib/dhcpsrv/dhcpsrv_messages.mes
@@ -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.
diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc
index 247ae1b998..6ace21ae2b 100644
--- a/src/lib/dhcpsrv/subnet.cc
+++ b/src/lib/dhcpsrv/subnet.cc
@@ -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,