]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2866] Checkpoint
authorFrancis Dupont <fdupont@isc.org>
Mon, 5 Jun 2023 20:00:01 +0000 (22:00 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 26 Jun 2023 12:24:42 +0000 (14:24 +0200)
src/lib/dhcpsrv/dhcpsrv_messages.cc
src/lib/dhcpsrv/dhcpsrv_messages.h
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/subnet.cc

index 3b47fcf4d4c7a6637d230e84cd0823449c467841..958d80ba2ef329c5db0b10fb77fc6903fd1d2a99 100644 (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
 };
 
index 0786c21e957d9fe67de974f1e0d414d98a7d27a0..2363852b79c47a033c97072fac359efa04f6e339 100644 (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
index 75de2ecaa7a92fda97d51f05dba6fd9c8d025a56..9c7adadb4041e937fbc0f01e1430c83b7265dc72 100644 (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.
index 247ae1b9986f6d6c73686bb701692b32a6f5cb22..6ace21ae2b41d63a87641b1f398022a4bc7dcbe3 100644 (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,