]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2866] Changes after review
authorMarcin Siodelski <marcin@isc.org>
Thu, 22 Jun 2023 06:36:11 +0000 (08:36 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 26 Jun 2023 12:26:09 +0000 (14:26 +0200)
- ChangeLog edits
- ARM edits in sections about subnet ids
- Renamed warning message
- Added subnet id to default configurations

ChangeLog
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/bin/keactrl/kea-dhcp4.conf.pre
src/bin/keactrl/kea-dhcp6.conf.pre
src/lib/dhcpsrv/dhcpsrv_messages.cc
src/lib/dhcpsrv/dhcpsrv_messages.h
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/subnet.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc

index 70cc53264383016b59cf09f0b3e8516060ed7009..01ee8a8772131201f7fd2abea38b518b348c1502 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,8 @@
 2157.  [func]*         fdupont
-       As the first step to remove the unnumbered / auto-generate
-       subnet identifier feature added a warning issued when a
-       subnet is configured with a zero or without an identifer
-       ("id" entry).
-       (Gitlab 2866)
+       Added a warning issued when the configuration contains subnets
+       without explicit subnet identifiers (without "id" entry). The
+       auto-generated subnet identifiers are now deprecated.
+       (Gitlab #2866)
 
 2156.  [func]          razvan
        Added an optional 'pool-id' parameter that can be used to enable
index 0ef885fcd0be803ad6102a7e9a8adbbe4b1a18ce..6532941ba65928e3a5e1a4f4f1ac96f47ea55f5f 100644 (file)
@@ -1175,10 +1175,11 @@ IPv4 Subnet Identifier
 
 The subnet identifier (subnet ID) is a unique number associated with a particular
 subnet. In principle, it is used to associate clients' leases with their
-respective subnets. When a subnet identifier is not specified for a
-subnet being configured, it is automatically assigned by the
-configuration mechanism. The identifiers are assigned starting at 1 and are
-monotonically increased for each subsequent subnet: 1, 2, 3, ....
+respective subnets. The server configuration should contain unique and stable
+identifiers for all subnets. When a subnet identifier is not specified for a
+subnet, it is automatically assigned by the configuration mechanism. The identifiers
+are assigned starting at 1 and are monotonically increased for each subsequent
+subnet: 1, 2, 3, ....
 
 If there are multiple subnets configured with auto-generated identifiers
 and one of them is removed, the subnet identifiers may be renumbered.
@@ -1186,8 +1187,14 @@ For example: if there are four subnets and the third is removed, the
 last subnet will be assigned the identifier that the third subnet had
 before removal. As a result, the leases stored in the lease database for
 subnet 3 are now associated with subnet 4, something that may have
-unexpected consequences. The only remedy for this issue at present is to
-manually specify a unique identifier for each subnet.
+unexpected consequences. It is one of the reasons why auto-generated subnet
+identifiers are deprecated starting from Kea version 2.4.0.
+
+.. note::
+
+   The auto-generation of the subnet identifiers will be removed in a future
+   release. Starting from Kea 2.4.0, a subnet without an ``id`` entry
+   or with the zero value raises a warning at the configuration time.
 
 .. note::
 
@@ -1212,12 +1219,6 @@ This identifier will not change for this subnet unless the ``id``
 parameter is removed or set to 0. The value of 0 forces auto-generation
 of the subnet identifier.
 
-.. note::
-
-   The auto-generation of subnet identifier will be removed in a future
-   release. From 2.4.0 a subnet without an ``id`` entry or with the zero
-   value raises a warning at configuration time.
-
 .. _ipv4-subnet-prefix:
 
 IPv4 Subnet Prefix
index b1b94667b6525516c177071056a8c442831d576b..e218a4e042e02d22a5c4846a1891f6d19d0694d1 100644 (file)
@@ -956,10 +956,11 @@ IPv6 Subnet Identifier
 
 The subnet identifier (subnet ID) is a unique number associated with a particular
 subnet. In principle, it is used to associate clients' leases with their
-respective subnets. When a subnet identifier is not specified for a
-subnet being configured, it is automatically assigned by the
-configuration mechanism. The identifiers are assigned starting at 1 and are
-monotonically increased for each subsequent subnet: 1, 2, 3, ....
+respective subnets. The server configuration should contain unique and stable
+identifiers for all subnets. When a subnet identifier is not specified for a
+subnet, it is automatically assigned by the configuration mechanism. The identifiers
+are assigned starting at 1 and are monotonically increased for each subsequent
+subnet: 1, 2, 3, ....
 
 If there are multiple subnets configured with auto-generated identifiers
 and one of them is removed, the subnet identifiers may be renumbered.
@@ -967,8 +968,14 @@ For example: if there are four subnets and the third is removed, the
 last subnet will be assigned the identifier that the third subnet had
 before removal. As a result, the leases stored in the lease database for
 subnet 3 are now associated with subnet 4, something that may have
-unexpected consequences. The only remedy for this issue at present is to
-manually specify a unique identifier for each subnet.
+unexpected consequences. It is one of the reasons why auto-generated subnet
+identifiers are deprecated starting from Kea version 2.4.0.
+
+.. note::
+
+   The auto-generation of the subnet identifiers will be removed in a future
+   release. Starting from Kea 2.4.0, a subnet without an ``id`` entry
+   or with the zero value raises a warning at the configuration time.
 
 .. note::
 
@@ -993,12 +1000,6 @@ This identifier will not change for this subnet unless the ``id``
 parameter is removed or set to 0. The value of 0 forces auto-generation
 of the subnet identifier.
 
-.. note::
-
-   The auto-generation of subnet identifier will be removed in a future
-   release. From 2.4.0 a subnet without an ``id`` entry or with the zero
-   value raises a warning at configuration time.
-
 .. _ipv6-subnet-prefix:
 
 IPv6 Subnet Prefix
index 47f66eb08c94ac730cd18f4d459d9a945662caee..6edb8a14c70d319688ea0a3afbb45c249425ca0e 100644 (file)
         {
             // This defines the whole subnet. Kea will use this information to
             // determine where the clients are connected. This is the whole
-            // subnet in your network. This is mandatory parameter for each
-            // subnet.
+            // subnet in your network.
+
+            // Subnet identifier should be unique for each subnet.
+            "id": 1,
+
+            // This is mandatory parameter for each subnet.
             "subnet": "192.0.2.0/24",
 
             // Pools define the actual part of your subnet that is governed
index acb10a363b19c4ec192ab8218a9921f8d40daa6d..b167e1ffe0282df92753f54a830b3525798c2255 100644 (file)
         {
             // This defines the whole subnet. Kea will use this information to
             // determine where the clients are connected. This is the whole
-            // subnet in your network. This is mandatory parameter for each
-            // subnet.
+            // subnet in your network.
+
+            // Subnet identifier should be unique for each subnet.
+            "id": 1,
+
+            // This is mandatory parameter for each subnet.
             "subnet": "2001:db8:1::/64",
 
             // Pools define the actual part of your subnet that is governed
index 958d80ba2ef329c5db0b10fb77fc6903fd1d2a99..07df920a27f891614df10505159709137b70b97b 100644 (file)
@@ -54,6 +54,7 @@ extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_ADDRESS = "DHCPSRV_CFGMGR_US
 extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_ALLOCATOR = "DHCPSRV_CFGMGR_USE_ALLOCATOR";
 extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_UNICAST = "DHCPSRV_CFGMGR_USE_UNICAST";
 extern const isc::log::MessageID DHCPSRV_CLOSE_DB = "DHCPSRV_CLOSE_DB";
+extern const isc::log::MessageID DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID = "DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID";
 extern const isc::log::MessageID DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL = "DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL";
 extern const isc::log::MessageID DHCPSRV_DEPRECATED = "DHCPSRV_DEPRECATED";
 extern const isc::log::MessageID DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET = "DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET";
@@ -279,7 +280,6 @@ 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
@@ -334,6 +334,7 @@ const char* values[] = {
     "DHCPSRV_CFGMGR_USE_ALLOCATOR", "using the %1 allocator for %2 leases in subnet %3",
     "DHCPSRV_CFGMGR_USE_UNICAST", "listening on unicast address %1, on interface %2",
     "DHCPSRV_CLOSE_DB", "closing currently open %1 database",
+    "DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID", "a subnet was configured without an id: %1",
     "DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL", "ddns-ttl-percent %1 of lease lifetime %2 is too small, ignoring it",
     "DHCPSRV_DEPRECATED", "This configuration is using a deprecated feature: %1",
     "DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET", "received bad DHCPv4o6 packet: %1",
@@ -559,7 +560,6 @@ 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 2363852b79c47a033c97072fac359efa04f6e339..0f4f6340eaa16b2c40473ecd163481163bac147b 100644 (file)
@@ -55,6 +55,7 @@ extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_ADDRESS;
 extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_ALLOCATOR;
 extern const isc::log::MessageID DHCPSRV_CFGMGR_USE_UNICAST;
 extern const isc::log::MessageID DHCPSRV_CLOSE_DB;
+extern const isc::log::MessageID DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID;
 extern const isc::log::MessageID DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL;
 extern const isc::log::MessageID DHCPSRV_DEPRECATED;
 extern const isc::log::MessageID DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET;
@@ -280,7 +281,6 @@ 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 9c7adadb4041e937fbc0f01e1430c83b7265dc72..4c58a5eb1fe4f045ff070c2186a73debc76d2247 100644 (file)
@@ -280,6 +280,13 @@ the database access parameters are changed: in the latter case, the
 server closes the currently open database, and opens a database using
 the new parameters.
 
+% DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID a subnet was configured without an id: %1
+A warning message issued when a subnet was configured with a zero or without
+an id, causing the server to auto-generate it. Using auto-generated subnet
+ids is now deprecated. Each configured subnet should have an explicit subnet id
+specified with the "id" entry. The sole argument of this warning message contains
+a subnet prefix.
+
 % DHCPSRV_DDNS_TTL_PERCENT_TOO_SMALL ddns-ttl-percent %1 of lease lifetime %2 is too small, ignoring it
 A debug message issued when the DDNS TTL value calculated using the
 ddns-ttl-percent is zero.  Kea will ignore the value and calculate
@@ -1393,6 +1400,3 @@ indicate an error in the source code, please submit a bug report.
 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 6ace21ae2b41d63a87641b1f398022a4bc7dcbe3..c591ea94b7c242cc59164f1bce0ab398439e7034 100644 (file)
@@ -75,7 +75,7 @@ Subnet::Subnet(const isc::asiolink::IOAddress& prefix, uint8_t 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)
+        LOG_WARN(dhcpsrv_logger, DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID)
             .arg(toText());
     }
     if ((prefix.isV6() && len > 128) ||
index 07752cdb0a71fe9d5a8ecf56e8ce81bea8e50a29..42229d8ee33d5c18e1c0340535dbcd094954dbbc 100644 (file)
@@ -2035,8 +2035,8 @@ TEST_F(SubnetIdTest, unnumbered) {
     EXPECT_EQ("2001:db8:1::/64", subnet3->toText());
 
     // Subnet 1 and 3 are logged.
-    std::string msg = "DHCPSRV_UNNUMBERED_CONFIGURED_SUBNET ";
-    msg += "a subnet was configured unnumbered: ";
+    std::string msg = "DHCPSRV_CONFIGURED_SUBNET_WITHOUT_ID ";
+    msg += "a subnet was configured without an id: ";
     addString(msg + subnet1->toText());
     addString(msg + subnet3->toText());
     EXPECT_TRUE(checkFile());