]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4309] Checkpoint
authorFrancis Dupont <fdupont@isc.org>
Fri, 10 Jul 2026 06:59:16 +0000 (08:59 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 21 Jul 2026 16:08:45 +0000 (18:08 +0200)
34 files changed:
doc/examples/kea4/hooks-radius.json
doc/examples/kea4/mysql-reservations.json
doc/examples/kea4/pgsql-reservations.json
doc/examples/kea6/mysql-reservations.json
doc/examples/kea6/pgsql-reservations.json
doc/examples/template-power-user-home/info.md
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
doc/sphinx/arm/hooks-host-cmds.rst
doc/sphinx/config-examples.rst
doc/sphinx/kea-messages.rst
src/bin/dhcp4/dhcp4_messages.cc
src/bin/dhcp4/dhcp4_messages.h
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/parser_context.cc
src/bin/dhcp4/parser_context.h
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp6/dhcp6_messages.cc
src/bin/dhcp6/dhcp6_messages.h
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/parser_context.cc
src/bin/dhcp6/parser_context.h
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/bin/keactrl/kea-dhcp4.conf.pre
src/bin/keactrl/kea-dhcp6.conf.pre
src/hooks/dhcp/host_cmds/host_cmds.h
src/hooks/dhcp/host_cmds/tests/host_cmds_unittest.cc
src/lib/database/dbaccess_parser.h
src/lib/dhcpsrv/host_mgr.cc
src/lib/dhcpsrv/hosts_messages.mes
src/lib/dhcpsrv/tests/host_mgr_unittest.cc
src/lib/testutils/dhcp_test_lib.sh.in

index 01edfe00e7d04d577d4ac32bd72aa3c871039c5e..c4883166a1c2b401319278afce52521c9526e591 100644 (file)
@@ -78,7 +78,7 @@
     "type": "memfile"
   },
 
-  // Note there is hosts-database defined. RADIUS and Host Cache libraries
+  // Note there is hosts-databases defined. RADIUS and Host Cache libraries
   // will create them dynamically.
 
   // RADIUS uses flex-id reservations, so restrict Kea to use flex-id only.
index e3a9a248950908da53c2e75b146ac64ef63606a9..4093eac593b6aa3c7dc55a3bc558bdc611481bfa 100644 (file)
@@ -55,7 +55,7 @@
 // reservations list, within the subnet (configuration file). If there are
 // no reservations there, the server will try to retrieve reservations
 // from this database.
-  "hosts-database": {
+  "hosts-databases": [ {
     "type": "mysql",
     "reconnect-wait-time": 3000, // expressed in ms
     "max-reconnect-tries": 3,
@@ -68,7 +68,7 @@
     "cert-file": "my-cert",
     "key-file": "my-key",
     "cipher-list": "AES"
-  },
+  } ],
 // Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
 // store host reservations in the MySQL Host Database Backend.
 // Specify the host backend hook library location.
index 144a8382954c6ee05615505c6c95908dfa2fafc1..99d652ad6f7a120b942b10b3a2fe220b3141df13 100644 (file)
@@ -54,8 +54,7 @@
 // reservations list, within the subnet (configuration file). If there are
 // no reservations there, the server will try to retrieve reservations
 // from this database.
-// The database specification can go into one hosts-database entry for
-// backward compatibility or be listed in hosts-databases list.
+// The database specification can be listed in hosts-databases list.
   "hosts-databases": [
     {
        "type": "postgresql",
index 8ee9adde8ddc1bd0ad3dfd8a0806850c91a39acb..a1e867a8ca23f295ce461993411a74e6acb42f57 100644 (file)
@@ -42,7 +42,7 @@
 // reservations list, within the subnet (configuration file). If there are
 // no reservations there, the server will try to retrieve reservations
 // from this database.
-  "hosts-database": {
+  "hosts-databases": [ {
     "type": "mysql",
     "reconnect-wait-time": 3000, // expressed in ms
     "max-reconnect-tries": 3,
@@ -56,7 +56,7 @@
     "cert-file": "my-cert",
     "key-file": "my-key",
     "cipher-list": "AES"
-  },
+  } ],
 // Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
 // store host reservations in the MySQL Host Database Backend.
 // Specify the host backend hook library location.
index 422118b484cc94ceb659a683b8c895650ead3fa2..b849769978aae4d1b48e77de9b259b9733b733fe 100644 (file)
@@ -41,8 +41,7 @@
 // reservations list, within the subnet (configuration file). If there are
 // no reservations there, the server will try to retrieve reservations
 // from this database.
-// The database specification can go into one hosts-database entry for
-// backward compatibility or be listed in hosts-databases list.
+// The database specification canbe listed in hosts-databases list.
   "hosts-databases": [
     {
        "type": "postgresql",
index 3b82d166300c382b09b1f9bd94d240ff030d2a2d..897e3e467074185ead3ac11c22126d63c0d2f575 100644 (file)
@@ -102,7 +102,7 @@ may wish to consider the following changes:
 
 - To expand the local network, adding a MySQL or PostgreSQL database is a popular solution.
   Users can choose to store leases, host reservations, and even most of the configuration
-  in a database. See :ref:`admin` and the ``lease-database``, ``hosts-database``, and
+  in a database. See :ref:`admin` and the ``lease-database``, ``hosts-databases``, and
   ``config-control`` parameters in :ref:`dhcp4`.
 
 - To provide more insight into how the DHCP server operates, Kea's RESTful API can query
index f5fe9156da5da22b9ba2883326d1588d3c558259..9a2560fad80f07375712fafc063963207a7eda50 100644 (file)
@@ -726,14 +726,14 @@ connection to MySQL:
 ::
 
    "Dhcp4": {
-       "hosts-database": {
+       "hosts-databases": [ {
            "type": "mysql",
            "name": "kea",
            "user": "kea",
            "password": "1234",
            "host": "localhost",
            "port": 3306
-       }
+       } ]
    }
 
 Depending on the database configuration, many of the
@@ -767,12 +767,21 @@ DHCPv4 Hosts Database Configuration
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Hosts database configuration is controlled through the
-``Dhcp4``/``hosts-database`` parameters. If enabled, the type of database must
-be set to ``mysql`` or ``postgresql``.
+``Dhcp4``/``hosts-databases`` parameters. If enabled, the type of database must
+be set to a valid type e.g. ``mysql`` or ``postgresql``.
 
 ::
 
-   "Dhcp4": { "hosts-database": { "type": "mysql", ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "type": "mysql", ... } ], ... }
+
+Since the multiple-storage extension the database configurations must be
+placed in a ``hosts-databases`` list.
+
+.. note::
+
+   The previous keyword ``hosts-database`` which takes one database
+   configuration only is deprecated and will be rejected by a future release.
+
 
 Next, the name of the database to hold the reservations must be set;
 this is the name used when the lease database was created (see
@@ -781,28 +790,28 @@ desired database type):
 
 ::
 
-   "Dhcp4": { "hosts-database": { "name": "database-name" , ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "name": "database-name" , ... } ], ... }
 
 If the database is located on a different system than the DHCPv4 server,
 the database host name must also be specified:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "host": remote-host-name, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "host": remote-host-name, ... } ], ... }
 
 Normally, the database is on the same machine as the DHCPv4 server.
 In this case, set the value to the empty string:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "host" : "", ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "host" : "", ... } ], ... }
 
 Should the database use a port different than the default, it may be
 specified as well:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "port" : 12345, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "port" : 12345, ... } ], ... }
 
 The maximum number of times the server automatically attempts to
 reconnect to the host database after connectivity has been lost may be
@@ -810,7 +819,7 @@ specified:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "max-reconnect-tries" : number-of-tries, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "max-reconnect-tries" : number-of-tries, ... } ], ... }
 
 If the server is unable to reconnect to the database after making the
 maximum number of attempts, the server will exit. A value of 0 (the
@@ -824,7 +833,7 @@ be specified:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "reconnect-wait-time" : number-of-milliseconds, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "reconnect-wait-time" : number-of-milliseconds, ... } ], ... }
 
 The default value for MySQL and PostgreSQL is 0, which disables automatic
 recovery and causes the server to exit immediately upon detecting the
@@ -832,7 +841,7 @@ loss of connectivity.
 
 ::
 
-   "Dhcp4": { "hosts-database": { "on-fail" : "stop-retry-exit", ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "on-fail" : "stop-retry-exit", ... } ], ... }
 
 The possible values are:
 
@@ -861,7 +870,7 @@ The possible values are:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "retry-on-startup" : true, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "retry-on-startup" : true, ... } ], ... }
 
 During server startup, the inability to connect to any of the configured
 backends is considered fatal only if ``retry-on-startup`` is set to ``false``
@@ -878,25 +887,17 @@ access the database should be set:
 ::
 
    "Dhcp4": {
-       "hosts-database": {
+       "hosts-databases": [ {
            "user": "user-name",
            "password": "1234",
            ...
-       },
+       } ],
        ...
    }
 
 If there is no password to the account, set the password to the empty
 string ``""``. (This is the default.)
 
-The multiple-storage extension uses a similar syntax; a configuration is
-placed into a ``hosts-databases`` list instead of into a ``hosts-database``
-entry, as in:
-
-::
-
-   "Dhcp4": { "hosts-databases": [ { "type": "mysql", ... }, ... ], ... }
-
 If the same host is configured both in-file and in-database, Kea does not issue a warning,
 as it would if both were specified in the same data source.
 Instead, the host configured in-file has priority over the one configured
@@ -928,7 +929,7 @@ is controlled by the ``readonly`` boolean parameter as follows:
 
 ::
 
-   "Dhcp4": { "hosts-database": { "readonly": true, ... }, ... }
+   "Dhcp4": { "hosts-databases": [ { "readonly": true, ... } ], ... }
 
 Setting this parameter to ``false`` configures the database backend to
 operate in "read-write" mode, which is also the default configuration if
index 56431eb2a26a162c1cf1683570d475d9ff951f11..a2cf6f9707d3d8c50b16fe017cfc92c6fe4da7ad 100644 (file)
@@ -682,14 +682,14 @@ connection to MySQL:
 ::
 
    "Dhcp6": {
-       "hosts-database": {
+       "hosts-databases": [ {
            "type": "mysql",
            "name": "kea",
            "user": "kea",
            "password": "1234",
            "host": "localhost",
            "port": 3306
-       }
+       } ]
    }
 
 Depending on the database configuration, many of the
@@ -723,12 +723,21 @@ DHCPv6 Hosts Database Configuration
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Hosts database configuration is controlled through the
-``Dhcp6``/``hosts-database`` parameters. If enabled, the type of database must
-be set to ``mysql`` or ``postgresql``.
+``Dhcp6``/``hosts-databases`` parameters. If enabled, the type of database must
+be set to a valid type e.g. ``mysql`` or ``postgresql``.
 
 ::
 
-   "Dhcp6": { "hosts-database": { "type": "mysql", ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "type": "mysql", ... } ], ... }
+
+Since the multiple-storage extension the database configurations must be
+placed in a ``hosts-databases`` list.
+
+.. note::
+
+   The previous keyword ``hosts-database`` which takes one database
+   configuration only is deprecated and will be rejected by a future release.
+
 
 Next, the name of the database to hold the reservations must be set;
 this is the name used when the lease database was created (see
@@ -737,28 +746,28 @@ desired database type):
 
 ::
 
-   "Dhcp6": { "hosts-database": { "name": "database-name" , ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "name": "database-name" , ... } ], ... }
 
 If the database is located on a different system than the DHCPv6 server,
 the database host name must also be specified:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "host": remote-host-name, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "host": remote-host-name, ... } ], ... }
 
 Normally, the database is on the same machine as the DHCPv6 server.
 In this case, set the value to the empty string:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "host" : "", ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "host" : "", ... } ], ... }
 
 Should the database use a port different than the default, it may be
 specified as well:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "port" : 12345, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "port" : 12345, ... } ], ... }
 
 The maximum number of times the server automatically attempts to
 reconnect to the host database after connectivity has been lost may be
@@ -766,7 +775,7 @@ specified:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "max-reconnect-tries" : number-of-tries, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "max-reconnect-tries" : number-of-tries, ... } ], ... }
 
 If the server is unable to reconnect to the database after making the
 maximum number of attempts, the server will exit. A value of 0 (the
@@ -780,7 +789,7 @@ be specified:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "reconnect-wait-time" : number-of-milliseconds, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "reconnect-wait-time" : number-of-milliseconds, ... } ], ... }
 
 The default value for MySQL and PostgreSQL is 0, which disables automatic
 recovery and causes the server to exit immediately upon detecting the
@@ -788,7 +797,7 @@ loss of connectivity.
 
 ::
 
-   "Dhcp6": { "hosts-database": { "on-fail" : "stop-retry-exit", ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "on-fail" : "stop-retry-exit", ... } ], ... }
 
 The possible values are:
 
@@ -817,7 +826,7 @@ The possible values are:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "retry-on-startup" : true, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "retry-on-startup" : true, ... } ], ... }
 
 During server startup, the inability to connect to any of the configured
 backends is considered fatal only if ``retry-on-startup`` is set to ``false``
@@ -834,25 +843,17 @@ access the database should be set:
 ::
 
    "Dhcp6": {
-       "hosts-database": {
+       "hosts-databases": [ {
            "user": "user-name",
            "password": "1234",
            ...
-       },
+       } ],
        ...
    }
 
 If there is no password to the account, set the password to the empty
 string ``""``. (This is the default.)
 
-The multiple-storage extension uses a similar syntax; a configuration is
-placed into a ``hosts-databases`` list instead of into a ``hosts-database``
-entry, as in:
-
-::
-
-   "Dhcp6": { "hosts-databases": [ { "type": "mysql", ... }, ... ], ... }
-
 If the same host is configured both in-file and in-database, Kea does not issue a warning,
 as it would if both were specified in the same data source.
 Instead, the host configured in-file has priority over the one configured
@@ -884,7 +885,7 @@ is controlled by the ``readonly`` boolean parameter as follows:
 
 ::
 
-   "Dhcp6": { "hosts-database": { "readonly": true, ... }, ... }
+   "Dhcp6": { "hosts-databases": [ { "readonly": true, ... } ], ... }
 
 Setting this parameter to ``false`` configures the database backend to
 operate in "read-write" mode, which is also the default configuration if
index f5b8b04d23a3a17e9d9640f35f42471c79615189..8a734b66b0b5f568736194c5fb97c6d25fa810e2 100644 (file)
@@ -1054,7 +1054,7 @@ or
 
    {
        "result": 1,
-       "text": "Unable to delete a host because there is no hosts-database configured."
+       "text": "Unable to delete a host because there is no hosts-databases configured."
    }
 
 The command accepts the ``operation-target`` argument. By default, it removes
index 7a512bb305501f7804da1ae24659c9796c525e0d..f2a76e1aa633fd8d90842f6b2789289c7a5bb029 100644 (file)
@@ -7741,7 +7741,7 @@ kea4/hooks-radius.json
         "type": "memfile"
       },
 
-      // Note there is hosts-database defined. RADIUS and Host Cache libraries
+      // Note there is hosts-databases defined. RADIUS and Host Cache libraries
       // will create them dynamically.
 
       // RADIUS uses flex-id reservations, so restrict Kea to use flex-id only.
@@ -8408,7 +8408,7 @@ kea4/mysql-reservations.json
     // reservations list, within the subnet (configuration file). If there are
     // no reservations there, the server will try to retrieve reservations
     // from this database.
-      "hosts-database": {
+      "hosts-databases": [ {
         "type": "mysql",
         "reconnect-wait-time": 3000, // expressed in ms
         "max-reconnect-tries": 3,
@@ -8421,7 +8421,7 @@ kea4/mysql-reservations.json
         "cert-file": "my-cert",
         "key-file": "my-key",
         "cipher-list": "AES"
-      },
+      } ],
     // Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
     // store host reservations in the MySQL Host Database Backend.
     // Specify the host backend hook library location.
@@ -8529,8 +8529,7 @@ kea4/pgsql-reservations.json
     // reservations list, within the subnet (configuration file). If there are
     // no reservations there, the server will try to retrieve reservations
     // from this database.
-    // The database specification can go into one hosts-database entry for
-    // backward compatibility or be listed in hosts-databases list.
+    // The database specification can be listed in hosts-databases list.
       "hosts-databases": [
         {
            "type": "postgresql",
@@ -16711,7 +16710,7 @@ kea6/mysql-reservations.json
     // reservations list, within the subnet (configuration file). If there are
     // no reservations there, the server will try to retrieve reservations
     // from this database.
-      "hosts-database": {
+      "hosts-databases": [ {
         "type": "mysql",
         "reconnect-wait-time": 3000, // expressed in ms
         "max-reconnect-tries": 3,
@@ -16725,7 +16724,7 @@ kea6/mysql-reservations.json
         "cert-file": "my-cert",
         "key-file": "my-key",
         "cipher-list": "AES"
-      },
+      } ],
     // Since Kea.2.7.4, the libdhcp_mysql.so hook library must be loaded in order to
     // store host reservations in the MySQL Host Database Backend.
     // Specify the host backend hook library location.
@@ -16830,8 +16829,7 @@ kea6/pgsql-reservations.json
     // reservations list, within the subnet (configuration file). If there are
     // no reservations there, the server will try to retrieve reservations
     // from this database.
-    // The database specification can go into one hosts-database entry for
-    // backward compatibility or be listed in hosts-databases list.
+    // The database specification can be listed in hosts-databases list.
       "hosts-databases": [
         {
            "type": "postgresql",
index 4fa0946cccaf57bb9fb61979e8b0e1778f565a8c..cbd6759724f1a7fc166c0dfb7e6803a83f2fe012 100644 (file)
@@ -15012,7 +15012,7 @@ HOSTS_BACKENDS_REGISTERED
     the following host backend types are available: %1
 
 This informational message lists all possible host backends that could
-be used in hosts-database[s].
+be used in hosts-databases.
 
 HOSTS_BACKEND_DEREGISTER
 ========================
index d78af41d34f67e3bcf437cd6882cc4a5348573b4..fe1378bf886f39cfe410d0dce8a7717a84f62537 100644 (file)
@@ -33,6 +33,7 @@ extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_PROCESS = "DHCP4_CLIENT_H
 extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_SCRUBBED_EMPTY = "DHCP4_CLIENT_HOSTNAME_SCRUBBED_EMPTY";
 extern const isc::log::MessageID DHCP4_CLIENT_NAME_PROC_FAIL = "DHCP4_CLIENT_NAME_PROC_FAIL";
 extern const isc::log::MessageID DHCP4_CONFIG_COMPLETE = "DHCP4_CONFIG_COMPLETE";
+extern const isc::log::MessageID DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED = "DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED";
 extern const isc::log::MessageID DHCP4_CONFIG_LOAD_FAIL = "DHCP4_CONFIG_LOAD_FAIL";
 extern const isc::log::MessageID DHCP4_CONFIG_PACKET_QUEUE = "DHCP4_CONFIG_PACKET_QUEUE";
 extern const isc::log::MessageID DHCP4_CONFIG_RECEIVED = "DHCP4_CONFIG_RECEIVED";
@@ -222,6 +223,7 @@ const char* values[] = {
     "DHCP4_CLIENT_HOSTNAME_SCRUBBED_EMPTY", "%1: sanitizing client's Hostname option '%2' yielded an empty string",
     "DHCP4_CLIENT_NAME_PROC_FAIL", "%1: failed to process the fqdn or hostname sent by a client: %2",
     "DHCP4_CONFIG_COMPLETE", "DHCPv4 server has completed configuration: %1",
+    "DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED", "the \"host-database\" keyword will be deprecated",
     "DHCP4_CONFIG_LOAD_FAIL", "configuration error using file: %1, reason: %2",
     "DHCP4_CONFIG_PACKET_QUEUE", "DHCPv4 packet queue info after configuration: %1",
     "DHCP4_CONFIG_RECEIVED", "received configuration %1",
index eb1a6195386bba62d592b0da7bbefa7d2d5fe272..ab8669a31b294a670a2cd1c92f68e427fd39b709 100644 (file)
@@ -34,6 +34,7 @@ extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_PROCESS;
 extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_SCRUBBED_EMPTY;
 extern const isc::log::MessageID DHCP4_CLIENT_NAME_PROC_FAIL;
 extern const isc::log::MessageID DHCP4_CONFIG_COMPLETE;
+extern const isc::log::MessageID DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED;
 extern const isc::log::MessageID DHCP4_CONFIG_LOAD_FAIL;
 extern const isc::log::MessageID DHCP4_CONFIG_PACKET_QUEUE;
 extern const isc::log::MessageID DHCP4_CONFIG_RECEIVED;
index 50afa34ef1103fe12988e2c96ca2f0ebf803955e..e63612bd491133c5b87053f5e00141e0bcde5354 100644 (file)
@@ -192,6 +192,12 @@ new configuration. It is output during server startup, and when an updated
 configuration is committed by the administrator.  Additional information
 may be provided.
 
+% DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED the "host-database" keyword will be deprecated
+This warning message indicates the configuration still use
+the "hosts-database", a keyword which is deprecated and will
+be rejected by a future release,. Please use "hosts-databases" instead
+and put the database configuration into a list.
+
 % DHCP4_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
 This error message indicates that the DHCPv4 configuration has failed.
 If this is an initial configuration (during server's startup) the server
index 3399670d3f8a25065f036350447efcb8bbf4fe05..8170fca320a6d6d6aeb7f76d11add906b4b7c435 100644 (file)
@@ -532,8 +532,14 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
         }
 
         ConstElementPtr hosts_database = mutable_cfg->get("hosts-database");
+        ConstElementPtr hosts_databases = mutable_cfg->get("hosts-databases");
         if (hosts_database) {
             parameter_name = "hosts-database";
+            LOG_WARN(dhcp4_logger, DHCP4_CONFIG_HOSTS_DATABASE_DEPRECATED);
+            if (hosts_databases) {
+                isc_throw(DhcpConfigError, "can't use hosts-database and "
+                          << "hosts-databases at the same time");
+            }
             db::DbAccessParser parser;
             std::string access_string;
             parser.parse(access_string, hosts_database);
@@ -541,7 +547,6 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
             cfg_db_access->setHostDbAccessString(access_string);
         }
 
-        ConstElementPtr hosts_databases = mutable_cfg->get("hosts-databases");
         if (hosts_databases) {
             parameter_name = "hosts-databases";
             CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
index 7b3dc546a1d50d65652149cf62fa520c1e78bd43..36ddd5a3d8576e6eabc313ce0d437c1192b26a6b 100644 (file)
@@ -163,7 +163,7 @@ Parser4Context::contextName() {
     case LEASE_DATABASE:
         return ("lease-database");
     case HOSTS_DATABASE:
-        return ("hosts-database");
+        return ("hosts-databases");
     case DATABASE_ON_FAIL:
         return ("database-on-fail");
     case SSL_MODE:
index 9e39ecec41d8cb865513edcdb1639cc6d85197ec..5c9113b8181ceab19c6f8e8bbe500d94addc2346 100644 (file)
@@ -252,7 +252,7 @@ public:
         /// Used while parsing Dhcp4/lease-database structures.
         LEASE_DATABASE,
 
-        /// Used while parsing Dhcp4/hosts-database[s] structures.
+        /// Used while parsing Dhcp4/hosts-databases structures.
         HOSTS_DATABASE,
 
         /// Used while parsing Dhcp4/*-database/on-fail.
index f143131381331a23f2062a174e2f9e548cb74a60..6a7959187ded5d88db910b6d9273bea92ca198e7 100644 (file)
@@ -97,12 +97,12 @@ const char* CONFIGS[] = {
     "{ \"interfaces-config\": {"
         "    \"interfaces\": [ \"*\" ]"
         "},"
-        "\"hosts-database\": {"
+        "\"hosts-database\": {"
         "    \"type\": \"mysql\","
         "    \"name\": \"keatest\","
         "    \"user\": \"keatest\","
         "    \"password\": \"keatest\""
-        "},"
+        "} ],"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet4\": [ { "
index 679b2e60211dc0c0d5943306c6366869a3888a85..db27681bc803f30666bb7fc247c9688ba4bbd15e 100644 (file)
@@ -31,6 +31,7 @@ extern const isc::log::MessageID DHCP6_CLASS_ASSIGNED = "DHCP6_CLASS_ASSIGNED";
 extern const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED = "DHCP6_CLASS_UNCONFIGURED";
 extern const isc::log::MessageID DHCP6_CLIENT_FQDN_SCRUBBED_EMPTY = "DHCP6_CLIENT_FQDN_SCRUBBED_EMPTY";
 extern const isc::log::MessageID DHCP6_CONFIG_COMPLETE = "DHCP6_CONFIG_COMPLETE";
+extern const isc::log::MessageID DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED = "DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED";
 extern const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL = "DHCP6_CONFIG_LOAD_FAIL";
 extern const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE = "DHCP6_CONFIG_PACKET_QUEUE";
 extern const isc::log::MessageID DHCP6_CONFIG_RECEIVED = "DHCP6_CONFIG_RECEIVED";
@@ -216,6 +217,7 @@ const char* values[] = {
     "DHCP6_CLASS_UNCONFIGURED", "%1: client packet belongs to an unconfigured class: %2",
     "DHCP6_CLIENT_FQDN_SCRUBBED_EMPTY", "%1: sanitizing client's FQDN option '%2' yielded an empty string",
     "DHCP6_CONFIG_COMPLETE", "DHCPv6 server has completed configuration: %1",
+    "DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED", "the \"host-database\" keyword will be deprecated",
     "DHCP6_CONFIG_LOAD_FAIL", "configuration error using file: %1, reason: %2",
     "DHCP6_CONFIG_PACKET_QUEUE", "DHCPv6 packet queue info after configuration: %1",
     "DHCP6_CONFIG_RECEIVED", "received configuration: %1",
index 75b569b020bacdb26080741899dbee255159217a..f34bd61fbf7228dc219a25171bac3b221c83f0d3 100644 (file)
@@ -32,6 +32,7 @@ extern const isc::log::MessageID DHCP6_CLASS_ASSIGNED;
 extern const isc::log::MessageID DHCP6_CLASS_UNCONFIGURED;
 extern const isc::log::MessageID DHCP6_CLIENT_FQDN_SCRUBBED_EMPTY;
 extern const isc::log::MessageID DHCP6_CONFIG_COMPLETE;
+extern const isc::log::MessageID DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED;
 extern const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL;
 extern const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE;
 extern const isc::log::MessageID DHCP6_CONFIG_RECEIVED;
index 18e9c78dc0ffa22486a3e64aee80f4755e8cba26..bf62e31d7daeba358160153956218bcbc5582afe 100644 (file)
@@ -167,6 +167,12 @@ new configuration. it is output during server startup, and when an updated
 configuration is committed by the administrator.  Additional information
 may be provided.
 
+% DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED the "host-database" keyword will be deprecated
+This warning message indicates the configuration still use
+the "hosts-database", a keyword which is deprecated and will
+be rejected by a future release,. Please use "hosts-databases" instead
+and put the database configuration into a list.
+
 % DHCP6_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2
 This error message indicates that the DHCPv6 configuration has failed.
 If this is an initial configuration (during server's startup) the server
index 35691341e70f7a62ef2fa96fb8f4af368f5f129d..3303501433310fdce01a8c851d150073117ab0ad 100644 (file)
@@ -642,8 +642,14 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
         }
 
         ConstElementPtr hosts_database = mutable_cfg->get("hosts-database");
+        ConstElementPtr hosts_databases = mutable_cfg->get("hosts-databases");
         if (hosts_database) {
             parameter_name = "hosts-database";
+            LOG_WARN(dhcp6_logger, DHCP6_CONFIG_HOSTS_DATABASE_DEPRECATED);
+            if (hosts_databases) {
+                isc_throw(DhcpConfigError, "can't use hosts-database and "
+                          << "hosts-databases at the same time");
+            }
             db::DbAccessParser parser;
             std::string access_string;
             parser.parse(access_string, hosts_database);
@@ -651,7 +657,6 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
             cfg_db_access->setHostDbAccessString(access_string);
         }
 
-        ConstElementPtr hosts_databases = mutable_cfg->get("hosts-databases");
         if (hosts_databases) {
             parameter_name = "hosts-databases";
             CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
index ef673f4324357d4965bf39063bd03840d474b551..068d3853974b1708519afe529a22db9d7ce3b64f 100644 (file)
@@ -158,7 +158,7 @@ Parser6Context::contextName() {
     case LEASE_DATABASE:
         return ("lease-database");
     case HOSTS_DATABASE:
-        return ("hosts-database");
+        return ("hosts-databases");
     case DATABASE_ON_FAIL:
         return ("database-on-fail");
     case SSL_MODE:
index 9546da8ceda6c68047a205f5af1d45e3c4799aff..dad0f91899eb418dba2d14933359bb986d93f5c9 100644 (file)
@@ -249,7 +249,7 @@ public:
         /// Used while parsing Dhcp6/lease-database structures.
         LEASE_DATABASE,
 
-        /// Used while parsing Dhcp6/hosts-database[s] structures.
+        /// Used while parsing Dhcp6/hosts-databases structures.
         HOSTS_DATABASE,
 
         /// Used while parsing Dhcp6/*-database/on-fail.
index 1accd06f04838314c19a267c2205c0970fbac361..504b6ec4216a824d7c77a2b8279fe482bbf8d362 100644 (file)
@@ -104,12 +104,12 @@ const char* CONFIGS[] = {
     "{ \"interfaces-config\": {"
     "  \"interfaces\": [ \"*\" ]"
     "},"
-    "\"hosts-database\": {"
+    "\"hosts-database\": {"
     "    \"type\": \"mysql\","
     "    \"name\": \"keatest\","
     "    \"user\": \"keatest\","
     "    \"password\": \"keatest\""
-    "},"
+    "} ],"
     "\"preferred-lifetime\": 3000,"
     "\"rebind-timer\": 2000, "
     "\"renew-timer\": 1000, "
index 5f1c8e4537d4bd6fe6e72f8351be1cff6d5e7e1a..a0e01da3b6f05a034270675a7e576223d2091641 100644 (file)
     // small or you have few reservations, it's probably easier to keep them
     // in the configuration file. If your network is large, it's usually better
     // to use database for it. To enable it, uncomment the following:
-    // "hosts-database": {
+    // "hosts-databases": [ {
     //     "type": "mysql",
     //     "name": "kea",
     //     "user": "kea",
     //     "password": "1234",
     //     "host": "localhost",
     //     "port": 3306
-    // },
+    // } ],
     // See Section 7.2.3 "Hosts storage" for details.
 
     // Setup reclamation of the expired leases and leases affinity.
index d4702dc68bde1b9fced98cf72b1aaaab36ee1601..8ddfa1f5a6e3adfd6c3a696207ccd65333299210 100644 (file)
     // small or you have few reservations, it's probably easier to keep them
     // in the configuration file. If your network is large, it's usually better
     // to use database for it. To enable it, uncomment the following:
-    // "hosts-database": {
+    // "hosts-databases": [ {
     //     "type": "mysql",
     //     "name": "kea",
     //     "user": "kea",
     //     "password": "1234",
     //     "host": "localhost",
     //     "port": 3306
-    // },
+    // } ],
     // See Section 8.2.3 "Hosts storage" for details.
 
     // Setup reclamation of the expired leases and leases affinity.
index 3f37534b3790fa42d348acbb5a52058e85d5c37f..bb244bdda8ab73d7b30599bb920b1283de4070f8 100644 (file)
@@ -133,7 +133,7 @@ public:
     /// argument accordingly.
     ///
     /// Note: for this operation to work while the operation-target was set to
-    /// ALTERNATE_SOURCES, hosts-database must be specified in your
+    /// ALTERNATE_SOURCES, hosts-databases must be specified in your
     /// configuration file (or from code point of view, alternate_source_
     /// must be set in HostMgr).
     ///
index c356771cb5a63266347d8e37ad3fa0a061a92eba..82cd04fddc0fa939a8b854d35f301b7b921e1b0f 100644 (file)
@@ -1800,7 +1800,7 @@ TEST_F(HostCmdsTest, reservationDelIdNotSubnet) {
 }
 
 // Checks that properly formed reservation-del(subnet-id, addr) will not work if
-// there is no hosts-database configured and the operation target is default.
+// there is no hosts-databases configured and the operation target is default.
 TEST_F(HostCmdsTest, reservationDelNoHostsDatabaseDefaultSource) {
     // Now send the command.
     string cmd =
@@ -1812,13 +1812,13 @@ TEST_F(HostCmdsTest, reservationDelNoHostsDatabaseDefaultSource) {
         "    }\n"
         "}";
     string exp_rsp = "Unable to delete a host because there is no "
-                     "hosts-database configured.";
+                     "hosts-databases configured.";
 
     testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp);
 }
 
 // Checks that properly formed reservation-del(subnet-id, addr) will work if
-// there is no hosts-database configured but the operation target is memory
+// there is no hosts-databases configured but the operation target is memory
 // source.
 TEST_F(HostCmdsTest, reservationDelNoHostsDatabaseMemorySource) {
     // Now send the command.
index 30a4ec9163ddefbcb6ccb17cb20b34d2b7030e4d..f7d737f224f8c377d3d22234739511cc4015dec8 100644 (file)
@@ -20,8 +20,8 @@ namespace db {
 /// @brief Parse Database Parameters
 ///
 /// This class is the parser for the database configuration.  This is a
-/// map under the top-level "lease-database", "hosts-database" and
-/// "config-database" elements, and comprises a map of strings.
+/// map under the top-level "lease-database", "hosts-databases" and
+/// "config-databases" elements, and comprises a map of strings.
 class DbAccessParser: public isc::data::SimpleParser {
 public:
     /// @brief Constructor
index c57eae451576cc92f24f779d62e9eadd39128cfe..7b83cb6e786d43276d6169a193c3d4f5660fedc8 100644 (file)
@@ -770,7 +770,7 @@ HostMgr::add(const HostPtr& host, const HostMgrOperationTarget target) {
         // Don't throw if all targets were selected.
         if (alternate_sources_.empty() && !(target & HostMgrOperationTarget::PRIMARY_SOURCE)) {
             isc_throw(NoHostDataSourceManager, "Unable to add new host because there is "
-                    "no hosts-database configured.");
+                    "no hosts-databases configured.");
 
         }
 
@@ -803,7 +803,7 @@ HostMgr::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr,
         // Don't throw if all targets were selected.
         if (alternate_sources_.empty() && !(target & HostMgrOperationTarget::PRIMARY_SOURCE)) {
             isc_throw(NoHostDataSourceManager, "Unable to delete a host because there is "
-                    "no hosts-database configured.");
+                    "no hosts-databases configured.");
         }
 
         for (auto const& source : alternate_sources_) {
@@ -837,7 +837,7 @@ HostMgr::del4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_
         // Don't throw if all targets were selected.
         if (alternate_sources_.empty() && !(target & HostMgrOperationTarget::PRIMARY_SOURCE)) {
             isc_throw(NoHostDataSourceManager, "Unable to delete a host because there is "
-                    "no hosts-database configured.");
+                    "no hosts-databases configured.");
         }
 
         for (auto const& source : alternate_sources_) {
@@ -874,7 +874,7 @@ HostMgr::del6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_
         // Don't throw if all targets were selected.
         if (alternate_sources_.empty() && !(target & HostMgrOperationTarget::PRIMARY_SOURCE)) {
             isc_throw(NoHostDataSourceManager, "Unable to delete a host because there is "
-                    "no hosts-database configured.");
+                    "no hosts-databases configured.");
         }
 
         for (auto const& source : alternate_sources_) {
@@ -904,7 +904,7 @@ HostMgr::update(HostPtr const& host, const HostMgrOperationTarget target) {
         // Don't throw if all targets were selected.
         if (alternate_sources_.empty() && !(target & HostMgrOperationTarget::PRIMARY_SOURCE)) {
             isc_throw(NoHostDataSourceManager,
-                    "Unable to update existing host because there is no hosts-database configured.");
+                    "Unable to update existing host because there is no hosts-databases configured.");
         }
 
         for (HostDataSourcePtr const& source : alternate_sources_) {
index 1ee349e647194c42e867cab8f604f0f5190d277e..7b7c6d2182fed4ac86c8e363445b3cdb9f5ca075 100644 (file)
@@ -8,7 +8,7 @@ $NAMESPACE isc::dhcp
 
 % HOSTS_BACKENDS_REGISTERED the following host backend types are available: %1
 This informational message lists all possible host backends that could
-be used in hosts-database[s].
+be used in hosts-databases.
 
 % HOSTS_BACKEND_DEREGISTER deregistered host backend type: %1
 Logged at debug log level 40.
index 28ed24ee7803e4faecf06126017b616cd440f95a..edca78c595dbd70f1c1b0ee4ced1e9b5665f262c 100644 (file)
@@ -200,9 +200,9 @@ TEST_F(HostMgrTest, noDataSource) {
     HostPtr host(new Host(hwaddrs_[0]->toText(false), "hw-address",
                           SubnetID(1), SUBNET_ID_UNUSED, IOAddress("192.0.2.5")));
     EXPECT_THROW_MSG(HostMgr::instance().add(host), NoHostDataSourceManager,
-                     "Unable to add new host because there is no hosts-database configured.");
+                     "Unable to add new host because there is no hosts-databases configured.");
     EXPECT_THROW_MSG(HostMgr::instance().update(host), NoHostDataSourceManager,
-                     "Unable to update existing host because there is no hosts-database "
+                     "Unable to update existing host because there is no hosts-databases "
                      "configured.");
 }
 
index 4fb61c919cad36c277b3a909b46b5bb74285c359..e39f3fb810f8db509d86b252523e95f2f0a16040 100755 (executable)
@@ -1161,11 +1161,11 @@ kea_dhcp_config() {
         }
       }
     ],
-    "hosts-database": {
+    "hosts-databases": [ {
       "password": "sensitive",
       "type": "mysql",
       "user": "keatest"
-    },
+    } ],
     "lease-database": {
       "password": "sensitive",
       "type": "mysql",