]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2036] make host reservations lookup before lease lookup configurable
authorRazvan Becheriu <razvan@isc.org>
Thu, 3 Feb 2022 17:41:17 +0000 (19:41 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 4 Feb 2022 14:35:23 +0000 (16:35 +0200)
30 files changed:
doc/examples/kea4/all-keys.json
doc/examples/kea6/all-keys.json
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_messages.cc
src/bin/dhcp4/dhcp4_messages.h
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/tests/get_config_unittest.cc
src/bin/dhcp4/tests/get_config_unittest.cc.skel
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_messages.cc
src/bin/dhcp6/dhcp6_messages.h
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/tests/get_config_unittest.cc
src/bin/dhcp6/tests/get_config_unittest.cc.skel
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/cfg_globals.cc
src/lib/dhcpsrv/cfg_globals.h
src/lib/dhcpsrv/parsers/simple_parser4.cc
src/lib/dhcpsrv/parsers/simple_parser6.cc
src/lib/dhcpsrv/srv_config.cc
src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
src/lib/dhcpsrv/tests/srv_config_unittest.cc

index cff480b595eafa1068a0a9d44fc049f9b3bf2336..a9f0fe78cfe4cc4a2657a8904b0aff8f9b04e397 100644 (file)
         // PostgreSQL backends do support this mode.
         "ip-reservations-unique": true,
 
+        /// Boolean parameter which controls whether host reservations lookup
+        /// should be performed before lease lookup. This parameter has effect
+        /// only when multi-threading is disabled. When multi-threading is
+        /// enabled, host reservations lookup is always performed first to avoid
+        /// lease lookup resource locking.
+        "reservations-lookup-first": true,
+
         // Specifies credentials to access lease database.
         "lease-database": {
             // memfile backend specific parameter specifying the interval
index 8d45fbc07030088e8d7303502240ca90951116b4..d21f6fcf5d156fa34834fb68f47d5aed4b63e058 100644 (file)
         // support this mode.
         "ip-reservations-unique": true,
 
+        /// Boolean parameter which controls whether host reservations lookup
+        /// should be performed before lease lookup. This parameter has effect
+        /// only when multi-threading is disabled. When multi-threading is
+        /// enabled, host reservations lookup is always performed first to avoid
+        /// lease lookup resource locking.
+        "reservations-lookup-first": true,
+
         // Specifies credentials to access lease database.
         "lease-database": {
             // memfile backend specific parameter specifying the interval
index d549c521426c533c6a98ea5da766ccbfdac50fe9..8c1f8aa0b58ad5dccd5f239dcb3d060fd9f71e6d 100644 (file)
@@ -5280,7 +5280,7 @@ IP address within a subnet; this is supported since the Kea 1.9.1
 release as an optional mode of operation, enabled with the
 ``ip-reservations-unique`` global parameter.
 
-``ip-reservations-unique`` is a boolean parameter that defaults to
+The ``ip-reservations-unique`` is a boolean parameter that defaults to
 ``true``, which forbids the specification of more than one reservation
 for the same IP address within a given subnet. Setting this parameter to
 ``false`` allows such reservations to be created both in the Kea configuration
@@ -5347,12 +5347,18 @@ finds multiple reservations for the same IP address.
 .. note::
 
    Currently the Kea server does not verify whether multiple reservations for
-   the same IP address exist in MySQL and/or
-   PostgreSQL host databases when ``ip-reservations-unique`` is updated from
-   ``true`` to ``false``. This may cause issues with lease allocations.
-   The administrator must ensure that there is at most one reservation
-   for each IP address within each subnet, prior to the configuration
-   update.
+   the same IP address exist in MySQL and/or PostgreSQL host databases when
+   ``ip-reservations-unique`` is updated from ``true`` to ``false``. This may
+   cause issues with lease allocations. The administrator must ensure that there
+   is at most one reservation for each IP address within each subnet, prior to
+   the configuration update.
+
+The ``reservations-lookup-first`` is a boolean parameter which controls whether
+host reservations lookup should be performed before lease lookup. This parameter
+has effect only when multi-threading is disabled. When multi-threading is
+enabled, host reservations lookup is always performed first to avoid lease
+lookup resource locking. The ``reservations-lookup-first`` defaults to ``false``
+when multi-threading is disabled.
 
 .. _shared-network4:
 
index 3310bc6cfa5d1216ff12f778936b8225ddf3bf1f..b1839e234b06d944bdc4f3e770f734ed87ecca82 100644 (file)
@@ -4646,7 +4646,7 @@ for the same IPv6 address and/or delegated prefix in a given subnet. This
 is supported since Kea release 1.9.1 as an optional mode of operation
 enabled with the ``ip-reservations-unique`` global parameter.
 
-``ip-reservations-unique`` is a boolean parameter that defaults to
+The ``ip-reservations-unique`` is a boolean parameter that defaults to
 ``true``, which forbids the specification of more than one reservation
 for the same lease in a given subnet. Setting this parameter to ``false``
 allows such reservations to be created both in the Kea configuration
@@ -4722,6 +4722,13 @@ for the same IP address or delegated prefix.
    most one reservation for each IP address and/or delegated prefix
    within each subnet, prior to the configuration update.
 
+The ``reservations-lookup-first`` is a boolean parameter which controls whether
+host reservations lookup should be performed before lease lookup. This parameter
+has effect only when multi-threading is disabled. When multi-threading is
+enabled, host reservations lookup is always performed first to avoid lease
+lookup resource locking. The ``reservations-lookup-first`` defaults to ``false``
+when multi-threading is disabled.
+
 .. _shared-network6:
 
 Shared Networks in DHCPv6
index 31b7ac40afe7f74b700fa9b7fe7e6c98cddb4502..f4bef02ac1cb5b204fe00a5d327fb40ab0c01bab 100644 (file)
@@ -2027,6 +2027,15 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+\"reservations-lookup-first\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::DHCP4:
+        return isc::dhcp::Dhcp4Parser::make_RESERVATIONS_LOOKUP_FIRST(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("reservations-lookup-first", driver.loc_);
+    }
+}
+
 \"compatibility\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::DHCP4:
index 5fe35d6e1237f205e4710c33478d0f893e35b98b..ca296cec1774ec21f655c7ec7a00f23244b99480 100644 (file)
@@ -136,6 +136,7 @@ extern const isc::log::MessageID DHCP4_RELEASE_EXCEPTION = "DHCP4_RELEASE_EXCEPT
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL = "DHCP4_RELEASE_FAIL";
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE = "DHCP4_RELEASE_FAIL_NO_LEASE";
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT = "DHCP4_RELEASE_FAIL_WRONG_CLIENT";
+extern const isc::log::MessageID DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED = "DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED";
 extern const isc::log::MessageID DHCP4_RESERVED_HOSTNAME_ASSIGNED = "DHCP4_RESERVED_HOSTNAME_ASSIGNED";
 extern const isc::log::MessageID DHCP4_RESPONSE_DATA = "DHCP4_RESPONSE_DATA";
 extern const isc::log::MessageID DHCP4_RESPONSE_FQDN_DATA = "DHCP4_RESPONSE_FQDN_DATA";
@@ -294,6 +295,7 @@ const char* values[] = {
     "DHCP4_RELEASE_FAIL", "%1: failed to remove lease for address %2",
     "DHCP4_RELEASE_FAIL_NO_LEASE", "%1: client is trying to release non-existing lease %2",
     "DHCP4_RELEASE_FAIL_WRONG_CLIENT", "%1: client is trying to release the lease %2 which belongs to a different client",
+    "DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED", "Multi-threading is enabled and host reservations lookup is always performed first.",
     "DHCP4_RESERVED_HOSTNAME_ASSIGNED", "%1: server assigned reserved hostname %2",
     "DHCP4_RESPONSE_DATA", "%1: responding with packet %2 (type %3), packet details: %4",
     "DHCP4_RESPONSE_FQDN_DATA", "%1: including FQDN option in the server's response: %2",
index d7ff4219e0828af3dddc7766614374339001cb6e..c4884684e2bb4e2c2039a0536346aa3261f736c7 100644 (file)
@@ -137,6 +137,7 @@ extern const isc::log::MessageID DHCP4_RELEASE_EXCEPTION;
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL;
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL_NO_LEASE;
 extern const isc::log::MessageID DHCP4_RELEASE_FAIL_WRONG_CLIENT;
+extern const isc::log::MessageID DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED;
 extern const isc::log::MessageID DHCP4_RESERVED_HOSTNAME_ASSIGNED;
 extern const isc::log::MessageID DHCP4_RESPONSE_DATA;
 extern const isc::log::MessageID DHCP4_RESPONSE_FQDN_DATA;
index 7c67abdf511c5bee792a05d149ef6ec989837a3d..b996fb05d6967762eeafb604876338edd65197bc 100644 (file)
@@ -485,6 +485,10 @@ lifetime.
 This is a message listing some information about the multi-threading parameters
 with which the server is running.
 
+% DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED Multi-threading is enabled and host reservations lookup is always performed first.
+This is a message informing that host reservations lookup is performed before
+lease lookup when multi-threading is enabled overwriting configured value.
+
 % DHCP4_NCR_CREATE %1: DDNS updates enabled, therefore sending name change requests
 This debug message is issued when the server is starting to send
 name change requests to the D2 module to update records for the client
index 052173cf3e9a528caf00553766f22da7e9691cce..e7b85e746f40c9853f5001bec94e7394c713f8bc 100644 (file)
@@ -240,6 +240,7 @@ using namespace std;
   HOSTNAME_CHAR_SET "hostname-char-set"
   HOSTNAME_CHAR_REPLACEMENT "hostname-char-replacement"
   IP_RESERVATIONS_UNIQUE "ip-reservations-unique"
+  RESERVATIONS_LOOKUP_FIRST "reservations-lookup-first"
 
   LOGGERS "loggers"
   OUTPUT_OPTIONS "output_options"
@@ -541,6 +542,7 @@ global_param: valid_lifetime
             | statistic_default_sample_age
             | dhcp_multi_threading
             | ip_reservations_unique
+            | reservations_lookup_first
             | compatibility
             | parked_packet_limit
             | unknown_map_entry
@@ -762,6 +764,12 @@ ip_reservations_unique: IP_RESERVATIONS_UNIQUE COLON BOOLEAN {
     ctx.stack_.back()->set("ip-reservations-unique", unique);
 };
 
+reservations_lookup_first: RESERVATIONS_LOOKUP_FIRST COLON BOOLEAN {
+    ctx.unique("reservations-lookup-first", ctx.loc2pos(@1));
+    ElementPtr first(new BoolElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("reservations-lookup-first", first);
+};
+
 interfaces_config: INTERFACES_CONFIG {
     ctx.unique("interfaces-config", ctx.loc2pos(@1));
     ElementPtr i(new MapElement(ctx.loc2pos(@1)));
index 26f57fcaf5c4c1c599b1a056d17e1a317fd4f833..457333d65983c3add8b84347b0f2b9399e955011 100644 (file)
@@ -7,6 +7,7 @@
 #include <config.h>
 
 #include <cc/command_interpreter.h>
+#include <config/command_mgr.h>
 #include <database/dbaccess_parser.h>
 #include <database/backend_selector.h>
 #include <database/server_selector.h>
 #include <dhcpsrv/parsers/sanity_checks_parser.h>
 #include <dhcpsrv/host_data_source_factory.h>
 #include <dhcpsrv/timer_mgr.h>
-#include <process/config_ctl_parser.h>
 #include <hooks/hooks_manager.h>
 #include <hooks/hooks_parser.h>
-#include <config/command_mgr.h>
+#include <process/config_ctl_parser.h>
 #include <util/encode/hex.h>
+#include <util/multi_threading_mgr.h>
 #include <util/strutil.h>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
 
+#include <iomanip>
 #include <iostream>
 #include <limits>
-#include <iomanip>
+#include <map>
 #include <netinet/in.h>
 #include <vector>
-#include <map>
 
 using namespace std;
 using namespace isc;
@@ -60,6 +61,7 @@ using namespace isc::asiolink;
 using namespace isc::hooks;
 using namespace isc::process;
 using namespace isc::config;
+using namespace isc::util;
 
 namespace {
 
@@ -359,10 +361,10 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
     // Global parameter name in case of an error.
     string parameter_name;
     ElementPtr mutable_cfg;
-    SrvConfigPtr srv_cfg;
+    SrvConfigPtr srv_config;
     try {
         // Get the staging configuration.
-        srv_cfg = CfgMgr::instance().getStagingCfg();
+        srv_config = CfgMgr::instance().getStagingCfg();
 
         // This is a way to convert ConstElementPtr to ElementPtr.
         // We need a config that can be edited, because we will insert
@@ -373,7 +375,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         // Rule is that a global value overrides the dhcp-ddns value, so
         // we need to do this before we apply global defaults.
         // Note this is done for backward compatibility.
-        srv_cfg->moveDdnsParams(mutable_cfg);
+        srv_config->moveDdnsParams(mutable_cfg);
 
         // Move from reservation mode to new reservations flags.
         // @todo add warning
@@ -395,14 +397,14 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         Dhcp4ConfigParser global_parser;
 
         // Apply global options in the staging config, e.g. ip-reservations-unique
-        global_parser.parseEarly(srv_cfg, mutable_cfg);
+        global_parser.parseEarly(srv_config, mutable_cfg);
 
         // We need definitions first
         ConstElementPtr option_defs = mutable_cfg->get("option-def");
         if (option_defs) {
             parameter_name = "option-def";
             OptionDefListParser parser(AF_INET);
-            CfgOptionDefPtr cfg_option_def = srv_cfg->getCfgOptionDef();
+            CfgOptionDefPtr cfg_option_def = srv_config->getCfgOptionDef();
             parser.parse(cfg_option_def, option_defs);
         }
 
@@ -410,7 +412,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         if (option_datas) {
             parameter_name = "option-data";
             OptionDataListParser parser(AF_INET);
-            CfgOptionPtr cfg_option = srv_cfg->getCfgOption();
+            CfgOptionPtr cfg_option = srv_config->getCfgOption();
             parser.parse(cfg_option, option_datas);
         }
 
@@ -418,21 +420,32 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         if (control_socket) {
             parameter_name = "control-socket";
             ControlSocketParser parser;
-            parser.parse(*srv_cfg, control_socket);
+            parser.parse(*srv_config, control_socket);
         }
 
         ConstElementPtr multi_threading = mutable_cfg->get("multi-threading");
         if (multi_threading) {
             parameter_name = "multi-threading";
             MultiThreadingConfigParser parser;
-            parser.parse(*srv_cfg, multi_threading);
+            parser.parse(*srv_config, multi_threading);
         }
 
+        /// depends on "multi-threading" being enabled, so it must come after.
         ConstElementPtr queue_control = mutable_cfg->get("dhcp-queue-control");
         if (queue_control) {
             parameter_name = "dhcp-queue-control";
             DHCPQueueControlParser parser;
-            srv_cfg->setDHCPQueueControl(parser.parse(queue_control));
+            srv_config->setDHCPQueueControl(parser.parse(queue_control));
+        }
+
+        /// depends on "multi-threading" being enabled, so it must come after.
+        ConstElementPtr reservations_lookup_first = mutable_cfg->get("reservations-lookup-first");
+        if (reservations_lookup_first) {
+            parameter_name = "reservations-lookup-first";
+            if (MultiThreadingMgr::instance().getMode()) {
+                LOG_WARN(dhcp4_logger, DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED);
+            }
+            srv_config->setReservationsLookupFirst(reservations_lookup_first->boolValue());
         }
 
         ConstElementPtr hr_identifiers =
@@ -447,7 +460,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         if (ifaces_config) {
             parameter_name = "interfaces-config";
             IfacesConfigParser parser(AF_INET, check_only);
-            CfgIfacePtr cfg_iface = srv_cfg->getCfgIface();
+            CfgIfacePtr cfg_iface = srv_config->getCfgIface();
             parser.parse(cfg_iface, ifaces_config);
         }
 
@@ -455,7 +468,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         if (sanity_checks) {
             parameter_name = "sanity-checks";
             SanityChecksParser parser;
-            parser.parse(*srv_cfg, sanity_checks);
+            parser.parse(*srv_config, sanity_checks);
         }
 
         ConstElementPtr expiration_cfg =
@@ -473,7 +486,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         if (hooks_libraries) {
             parameter_name = "hooks-libraries";
             HooksLibrariesParser hooks_parser;
-            HooksConfig& libraries = srv_cfg->getHooksConfig();
+            HooksConfig& libraries = srv_config->getHooksConfig();
             hooks_parser.parse(libraries, hooks_libraries);
             libraries.verifyLibraries(hooks_libraries->getPosition());
         }
@@ -497,7 +510,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             ClientClassDefListParser parser;
             ClientClassDictionaryPtr dictionary =
                 parser.parse(client_classes, AF_INET);
-            srv_cfg->setClientClassDictionary(dictionary);
+            srv_config->setClientClassDictionary(dictionary);
         }
 
         // Please move at the end when migration will be finished.
@@ -507,7 +520,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             db::DbAccessParser parser;
             std::string access_string;
             parser.parse(access_string, lease_database);
-            CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+            CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
             cfg_db_access->setLeaseDbAccessString(access_string);
         }
 
@@ -517,14 +530,14 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             db::DbAccessParser parser;
             std::string access_string;
             parser.parse(access_string, hosts_database);
-            CfgDbAccessPtr cfg_db_access = srv_cfg->getCfgDbAccess();
+            CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
             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_cfg->getCfgDbAccess();
+            CfgDbAccessPtr cfg_db_access = srv_config->getCfgDbAccess();
             db::DbAccessParser parser;
             for (auto it : hosts_databases->listValue()) {
                 std::string access_string;
@@ -543,12 +556,12 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             /// add subnets from the CfgSharedNetworks4 into CfgSubnets4
             /// as well.
             SharedNetworks4ListParser parser;
-            CfgSharedNetworks4Ptr cfg = srv_cfg->getCfgSharedNetworks4();
+            CfgSharedNetworks4Ptr cfg = srv_config->getCfgSharedNetworks4();
             parser.parse(cfg, shared_networks);
 
             // We also need to put the subnets it contains into normal
             // subnets list.
-            global_parser.copySubnets4(srv_cfg->getCfgSubnets4(), cfg);
+            global_parser.copySubnets4(srv_config->getCfgSubnets4(), cfg);
         }
 
         ConstElementPtr subnet4 = mutable_cfg->get("subnet4");
@@ -556,7 +569,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             parameter_name = "subnet4";
             Subnets4ListConfigParser subnets_parser;
             // parse() returns number of subnets parsed. We may log it one day.
-            subnets_parser.parse(srv_cfg, subnet4);
+            subnets_parser.parse(srv_config, subnet4);
         }
 
         ConstElementPtr reservations = mutable_cfg->get("reservations");
@@ -566,7 +579,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
             HostReservationsListParser<HostReservationParser4> parser;
             parser.parse(SUBNET_ID_GLOBAL, reservations, hosts);
             for (auto h = hosts.begin(); h != hosts.end(); ++h) {
-                srv_cfg->getCfgHosts()->add(*h);
+                srv_config->getCfgHosts()->add(*h);
             }
         }
 
@@ -669,6 +682,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
                  (config_pair.first == "statistic-default-sample-count") ||
                  (config_pair.first == "statistic-default-sample-age") ||
                  (config_pair.first == "ip-reservations-unique") ||
+                 (config_pair.first == "reservations-lookup-first") ||
                  (config_pair.first == "parked-packet-limit")) {
                 CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
                                                                         config_pair.second);
@@ -690,19 +704,19 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         parameter_name = "<post parsing>";
 
         // Apply global options in the staging config.
-        global_parser.parse(srv_cfg, mutable_cfg);
+        global_parser.parse(srv_config, mutable_cfg);
 
         // This method conducts final sanity checks and tweaks. In particular,
         // it checks that there is no conflict between plain subnets and those
         // defined as part of shared networks.
-        global_parser.sanityChecks(srv_cfg, mutable_cfg);
+        global_parser.sanityChecks(srv_config, mutable_cfg);
 
         // Validate D2 client configuration.
         if (!d2_client_cfg) {
             d2_client_cfg.reset(new D2ClientConfig());
         }
         d2_client_cfg->validateContents();
-        srv_cfg->setD2ClientConfig(d2_client_cfg);
+        srv_config->setD2ClientConfig(d2_client_cfg);
     } catch (const isc::Exception& ex) {
         LOG_ERROR(dhcp4_logger, DHCP4_PARSER_FAIL)
                   .arg(parameter_name).arg(ex.what());
@@ -777,7 +791,7 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
         try {
 
             // If there are config backends, fetch and merge into staging config
-            server.getCBControl()->databaseConfigFetch(srv_cfg,
+            server.getCBControl()->databaseConfigFetch(srv_config,
                                                        CBControlDHCPv4::FetchMode::FETCH_ALL);
         } catch (const isc::Exception& ex) {
             std::ostringstream err;
index 04cf6eeca5a36823f002268984a774f420facc99..4fbb56f289131f51444ab71a471060c245e0d6b8 100644 (file)
@@ -2388,6 +2388,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2467,6 +2468,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"rebind-timer\": 2000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2573,6 +2575,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2682,6 +2685,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2790,6 +2794,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2979,6 +2984,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3168,6 +3174,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3276,6 +3283,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3387,6 +3395,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3498,6 +3507,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3606,6 +3616,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3714,6 +3725,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3851,6 +3863,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3987,6 +4000,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4124,6 +4138,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4262,6 +4277,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4370,6 +4386,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4513,6 +4530,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4629,6 +4647,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4717,6 +4736,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4814,6 +4834,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4902,6 +4923,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4990,6 +5012,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5078,6 +5101,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5166,6 +5190,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5263,6 +5288,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5371,6 +5397,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5523,6 +5550,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5667,6 +5695,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5800,6 +5829,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5917,6 +5947,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6042,6 +6073,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6195,6 +6227,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6320,6 +6353,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6467,6 +6501,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6611,6 +6646,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6735,6 +6771,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6858,6 +6895,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6985,6 +7023,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7093,6 +7132,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7173,6 +7213,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7253,6 +7294,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7361,6 +7403,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7469,6 +7512,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7577,6 +7621,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7685,6 +7730,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7793,6 +7839,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7985,6 +8032,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8108,6 +8156,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8383,6 +8432,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8511,6 +8561,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8797,6 +8848,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": true,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8933,6 +8985,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9011,6 +9064,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9089,6 +9143,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9167,6 +9222,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9247,6 +9303,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9355,6 +9412,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9463,6 +9521,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9571,6 +9630,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9679,6 +9739,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9813,6 +9874,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9940,6 +10002,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10046,6 +10109,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10154,6 +10218,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10263,6 +10328,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10376,6 +10442,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10503,6 +10570,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10653,6 +10721,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10867,6 +10936,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11000,6 +11070,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11173,6 +11244,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11308,6 +11380,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11443,6 +11516,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11521,6 +11595,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -11599,6 +11674,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"parked-packet-limit\": 256,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
index cc4a64a349a1bd85f6ee89f1255118f0ee7b5aa8..a25a5abbbb5cb941326ddcdb6757f697bfb926dd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index afab3c5930737dc88d464306680bbf0bde2fa710..27c7786bbc5a7ff06422f971137e0be46b8507fe 100644 (file)
@@ -2092,6 +2092,15 @@ ControlCharacterFill            [^"\\]|\\["\\/bfnrtu]
     }
 }
 
+\"reservations-lookup-first\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::DHCP6:
+        return isc::dhcp::Dhcp6Parser::make_RESERVATIONS_LOOKUP_FIRST(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("reservations-lookup-first", driver.loc_);
+    }
+}
+
 \"compatibility\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::DHCP6:
index 9d203b96e10ce528bf22a5e516d1280c278b4414..cd2a55a69121e1dda53c2fdfb1137448a5140803 100644 (file)
@@ -140,6 +140,7 @@ extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL = "DHCP6_RELEASE_PD_FAIL"
 extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID = "DHCP6_RELEASE_PD_FAIL_WRONG_DUID";
 extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID = "DHCP6_RELEASE_PD_FAIL_WRONG_IAID";
 extern const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL = "DHCP6_REQUIRED_OPTIONS_CHECK_FAIL";
+extern const isc::log::MessageID DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED = "DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED";
 extern const isc::log::MessageID DHCP6_RESPONSE_DATA = "DHCP6_RESPONSE_DATA";
 extern const isc::log::MessageID DHCP6_SERVER_FAILED = "DHCP6_SERVER_FAILED";
 extern const isc::log::MessageID DHCP6_SHUTDOWN = "DHCP6_SHUTDOWN";
@@ -298,6 +299,7 @@ const char* values[] = {
     "DHCP6_RELEASE_PD_FAIL_WRONG_DUID", "%1: client tried to release prefix %2/%3, but it belongs to another client (duid=%4)",
     "DHCP6_RELEASE_PD_FAIL_WRONG_IAID", "%1: client tried to release prefix %2/%3, but it used wrong IAID (expected %4, but got %5)",
     "DHCP6_REQUIRED_OPTIONS_CHECK_FAIL", "%1 message received from %2 failed the following check: %3",
+    "DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED", "Multi-threading is enabled and host reservations lookup is always performed first.",
     "DHCP6_RESPONSE_DATA", "responding with packet type %1 data is %2",
     "DHCP6_SERVER_FAILED", "server failed: %1",
     "DHCP6_SHUTDOWN", "server shutdown",
index 4325f1274a06c42c44cea8095945b1437ca83456..29189dce11541ceddd08be8ea0b5599f67616171 100644 (file)
@@ -141,6 +141,7 @@ extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL;
 extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_DUID;
 extern const isc::log::MessageID DHCP6_RELEASE_PD_FAIL_WRONG_IAID;
 extern const isc::log::MessageID DHCP6_REQUIRED_OPTIONS_CHECK_FAIL;
+extern const isc::log::MessageID DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED;
 extern const isc::log::MessageID DHCP6_RESPONSE_DATA;
 extern const isc::log::MessageID DHCP6_SERVER_FAILED;
 extern const isc::log::MessageID DHCP6_SHUTDOWN;
index 07b8a0f22e881758bce941dfbdd8d1dfa0d17be2..c65310b78af13ab6a730191a684533de4a284295 100644 (file)
@@ -532,6 +532,10 @@ IAID and validity lifetime.
 This is a message listing some information about the multi-threading parameters
 with which the server is running.
 
+% DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED Multi-threading is enabled and host reservations lookup is always performed first.
+This is a message informing that host reservations lookup is performed before
+lease lookup when multi-threading is enabled overwriting configured value.
+
 % DHCP6_NOT_RUNNING IPv6 DHCP server is not running
 A warning message is issued when an attempt is made to shut down the
 IPv6 DHCP server but it is not running.
index 4490915c6bef093ab1e77b4db2ee715bb908a478..51567265c35126f2f4e2b9bc6d21aa06d574709d 100644 (file)
@@ -247,6 +247,7 @@ using namespace std;
   HOSTNAME_CHAR_SET "hostname-char-set"
   HOSTNAME_CHAR_REPLACEMENT "hostname-char-replacement"
   IP_RESERVATIONS_UNIQUE "ip-reservations-unique"
+  RESERVATIONS_LOOKUP_FIRST "reservations-lookup-first"
 
   LOGGERS "loggers"
   OUTPUT_OPTIONS "output_options"
@@ -550,6 +551,7 @@ global_param: data_directory
             | statistic_default_sample_age
             | dhcp_multi_threading
             | ip_reservations_unique
+            | reservations_lookup_first
             | compatibility
             | parked_packet_limit
             | unknown_map_entry
@@ -780,6 +782,12 @@ ip_reservations_unique: IP_RESERVATIONS_UNIQUE COLON BOOLEAN {
     ctx.stack_.back()->set("ip-reservations-unique", unique);
 };
 
+reservations_lookup_first: RESERVATIONS_LOOKUP_FIRST COLON BOOLEAN {
+    ctx.unique("reservations-lookup-first", ctx.loc2pos(@1));
+    ElementPtr first(new BoolElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("reservations-lookup-first", first);
+};
+
 interfaces_config: INTERFACES_CONFIG {
     ctx.unique("interfaces-config", ctx.loc2pos(@1));
     ElementPtr i(new MapElement(ctx.loc2pos(@1)));
index 35d271bd6a893bc52f212484652265b4e5935aec..b6156cbdb685aebe0cc9fedb37d432940aefe4a5 100644 (file)
 #include <cc/command_interpreter.h>
 #include <config/command_mgr.h>
 #include <database/dbaccess_parser.h>
-#include <dhcp/libdhcp++.h>
 #include <dhcp6/json_config_parser.h>
 #include <dhcp6/dhcp6_log.h>
 #include <dhcp6/dhcp6_srv.h>
+#include <dhcp/libdhcp++.h>
 #include <dhcp/iface_mgr.h>
 #include <dhcpsrv/cb_ctl_dhcp4.h>
 #include <dhcpsrv/cfg_option.h>
 #include <dhcpsrv/cfgmgr.h>
 #include <dhcpsrv/db_type.h>
-#include <dhcpsrv/pool.h>
-#include <dhcpsrv/subnet.h>
-#include <dhcpsrv/timer_mgr.h>
-#include <util/triplet.h>
 #include <dhcpsrv/parsers/client_class_def_parser.h>
 #include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <dhcpsrv/parsers/duid_config_parser.h>
 #include <dhcpsrv/parsers/shared_networks_list_parser.h>
 #include <dhcpsrv/parsers/sanity_checks_parser.h>
 #include <dhcpsrv/host_data_source_factory.h>
+#include <dhcpsrv/pool.h>
+#include <dhcpsrv/subnet.h>
+#include <dhcpsrv/timer_mgr.h>
 #include <hooks/hooks_manager.h>
 #include <hooks/hooks_parser.h>
 #include <log/logger_support.h>
 #include <process/config_ctl_parser.h>
-
 #include <util/encode/hex.h>
+#include <util/multi_threading_mgr.h>
 #include <util/strutil.h>
+#include <util/triplet.h>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
@@ -68,6 +68,7 @@ using namespace isc::asiolink;
 using namespace isc::hooks;
 using namespace isc::process;
 using namespace isc::config;
+using namespace isc::util;
 
 namespace {
 
@@ -176,7 +177,7 @@ public:
     ///
     /// @throw DhcpConfigError if parameters are missing or
     /// or having incorrect values.
-    void parse(const SrvConfigPtr& srv_config, const ConstElementPtr& global) {
+    void parse(const SrvConfigPtr& cfg, const ConstElementPtr& global) {
 
         // Set the data directory for server id file.
         if (global->contains("data-directory")) {
@@ -187,21 +188,21 @@ public:
         // Set the probation period for decline handling.
         uint32_t probation_period =
             getUint32(global, "decline-probation-period");
-        srv_config->setDeclinePeriod(probation_period);
+        cfg->setDeclinePeriod(probation_period);
 
         // Set the DHCPv4-over-DHCPv6 interserver port.
         uint16_t dhcp4o6_port = getUint16(global, "dhcp4o6-port");
-        srv_config->setDhcp4o6Port(dhcp4o6_port);
+        cfg->setDhcp4o6Port(dhcp4o6_port);
 
         // Set the global user context.
         ConstElementPtr user_context = global->get("user-context");
         if (user_context) {
-            srv_config->setContext(user_context);
+            cfg->setContext(user_context);
         }
 
         // Set the server's logical name
         std::string server_tag = getString(global, "server-tag");
-        srv_config->setServerTag(server_tag);
+        cfg->setServerTag(server_tag);
     }
 
     /// @brief Sets global parameters before other parameters are parsed.
@@ -547,6 +548,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
             parser.parse(*srv_config, multi_threading);
         }
 
+        /// depends on "multi-threading" being enabled, so it must come after.
         ConstElementPtr queue_control = mutable_cfg->get("dhcp-queue-control");
         if (queue_control) {
             parameter_name = "dhcp-queue-control";
@@ -554,6 +556,16 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
             srv_config->setDHCPQueueControl(parser.parse(queue_control));
         }
 
+        /// depends on "multi-threading" being enabled, so it must come after.
+        ConstElementPtr reservations_lookup_first = mutable_cfg->get("reservations-lookup-first");
+        if (reservations_lookup_first) {
+            parameter_name = "reservations-lookup-first";
+            if (MultiThreadingMgr::instance().getMode()) {
+                LOG_WARN(dhcp6_logger, DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED);
+            }
+            srv_config->setReservationsLookupFirst(reservations_lookup_first->boolValue());
+        }
+
         ConstElementPtr hr_identifiers =
             mutable_cfg->get("host-reservation-identifiers");
         if (hr_identifiers) {
@@ -804,6 +816,7 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
                  (config_pair.first == "statistic-default-sample-count") ||
                  (config_pair.first == "statistic-default-sample-age") ||
                  (config_pair.first == "ip-reservations-unique") ||
+                 (config_pair.first == "reservations-lookup-first") ||
                  (config_pair.first == "parked-packet-limit")) {
                 CfgMgr::instance().getStagingCfg()->addConfiguredGlobal(config_pair.first,
                                                                         config_pair.second);
index 719717d545c74a2bf169cca23417e872c342a905..aa0a7fd4fa59cb4c01b557ec810fe64c77076950 100644 (file)
@@ -2111,6 +2111,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2200,6 +2201,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2315,6 +2317,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2517,6 +2520,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2719,6 +2723,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -2925,6 +2930,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3040,6 +3046,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3156,6 +3163,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3272,6 +3280,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3424,6 +3433,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3539,6 +3549,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3656,6 +3667,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3775,6 +3787,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -3909,6 +3922,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4034,6 +4048,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4127,6 +4142,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4229,6 +4245,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4322,6 +4339,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4415,6 +4433,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4517,6 +4536,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4632,6 +4652,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4791,6 +4812,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -4942,6 +4964,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5080,6 +5103,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5195,6 +5219,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5357,6 +5382,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5540,6 +5566,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5674,6 +5701,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5789,6 +5817,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5874,6 +5903,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -5959,6 +5989,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6074,6 +6105,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6189,6 +6221,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6394,6 +6427,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6524,6 +6558,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6662,6 +6697,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6777,6 +6813,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -6892,6 +6929,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7007,6 +7045,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7265,6 +7304,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7393,6 +7433,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7478,6 +7519,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7563,6 +7605,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -7868,6 +7911,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": true,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8015,6 +8059,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8098,6 +8143,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8181,6 +8227,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8264,6 +8311,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8347,6 +8395,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8446,6 +8495,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8561,6 +8611,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8676,6 +8727,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8792,6 +8844,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -8913,6 +8966,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9034,6 +9088,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9151,6 +9206,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9269,6 +9325,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9406,6 +9463,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9549,6 +9607,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9782,6 +9841,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -9945,6 +10005,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"renew-timer\": 1000,\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10028,6 +10089,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10111,6 +10173,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
@@ -10210,6 +10273,7 @@ const char* UNPARSED_CONFIGS[] = {
 "        \"relay-supplied-options\": [ \"65\" ],\n"
 "        \"reservations-global\": false,\n"
 "        \"reservations-in-subnet\": true,\n"
+"        \"reservations-lookup-first\": false,\n"
 "        \"reservations-out-of-pool\": false,\n"
 "        \"sanity-checks\": {\n"
 "            \"lease-checks\": \"warn\"\n"
index a782648203cf9300d24e05678460bdb52d7fd44d..44f3f1e6c0e3fce40e8eda942519efa01a643fe4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 3c0e870b1f1a21e88e66409b8b6be7b646e68a00..d04be22b6c11784daf6f3448cfdd1c7c4fec4e4c 100644 (file)
@@ -1021,6 +1021,11 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
     // the reservation. The default is to begin by the lease
     // if the multi-threading is disabled.
     bool check_reservation_first = MultiThreadingMgr::instance().getMode();
+    // If multi-threading is disabled, honor the configured order for host
+    // reservations lookup.
+    if (!check_reservation_first) {
+        check_reservation_first = CfgMgr::instance().getCurrentCfg()->getReservationsLookupFirst();
+    }
 
     uint64_t total_attempts = 0;
 
index 4add30d3033f0f311d060ed5d0ee80919cd78a76..7a2870004debfcda1a4cef50df71e5b6a47bce1a 100644 (file)
@@ -45,6 +45,7 @@ CfgGlobals::nameToIndex = {
     { "cache-threshold", CACHE_THRESHOLD },
     { "cache-max-age", CACHE_MAX_AGE },
     { "ip-reservations-unique", IP_RESERVATIONS_UNIQUE },
+    { "reservations-lookup-first", RESERVATIONS_LOOKUP_FIRST },
     { "ddns-update-on-renew", DDNS_UPDATE_ON_RENEW },
     { "ddns-use-conflict-resolution", DDNS_USE_CONFLICT_RESOLUTION },
     { "parked-packet-limit", PARKED_PACKET_LIMIT },
index 1d8ddc0ad8c155015e10b0f1fd13db8a53c4d4cb..6ea9aabc6798d5cdd1fd7fe37d64a7ce9322c3e3 100644 (file)
@@ -68,6 +68,7 @@ public:
         CACHE_THRESHOLD,
         CACHE_MAX_AGE,
         IP_RESERVATIONS_UNIQUE,
+        RESERVATIONS_LOOKUP_FIRST,
         DDNS_UPDATE_ON_RENEW,
         DDNS_USE_CONFLICT_RESOLUTION,
         PARKED_PACKET_LIMIT,
index 31a849dd814cf0881274dc0e5ad121f80a8fb574..9ef58063945888b92badd262e6da1c30c86307f3 100644 (file)
@@ -93,6 +93,7 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
     { "cache-threshold",                Element::real },
     { "cache-max-age",                  Element::integer },
     { "ip-reservations-unique",         Element::boolean },
+    { "reservations-lookup-first",      Element::boolean },
     { "ddns-update-on-renew",           Element::boolean },
     { "ddns-use-conflict-resolution",   Element::boolean },
     { "compatibility",                  Element::map },
@@ -133,6 +134,7 @@ const SimpleDefaults SimpleParser4::GLOBAL4_DEFAULTS = {
     { "statistic-default-sample-count", Element::integer, "20" },
     { "statistic-default-sample-age",   Element::integer, "0" },
     { "ip-reservations-unique",         Element::boolean, "true" },
+    { "reservations-lookup-first",      Element::boolean, "false" },
     { "ddns-update-on-renew",           Element::boolean, "false" },
     { "ddns-use-conflict-resolution",   Element::boolean, "true" },
     { "parked-packet-limit",            Element::integer, "256" },
index a4252af56e93c7bb3cf5fdce85772da3a9ea9836..e83208201f94718ae585c3af699e529e9cfacb6e 100644 (file)
@@ -94,6 +94,7 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
     { "cache-threshold",                Element::real },
     { "cache-max-age",                  Element::integer },
     { "ip-reservations-unique",         Element::boolean },
+    { "reservations-lookup-first",      Element::boolean },
     { "ddns-update-on-renew",           Element::boolean },
     { "ddns-use-conflict-resolution",   Element::boolean },
     { "compatibility",                  Element::map },
@@ -129,6 +130,7 @@ const SimpleDefaults SimpleParser6::GLOBAL6_DEFAULTS = {
     { "statistic-default-sample-count", Element::integer, "20" },
     { "statistic-default-sample-age",   Element::integer, "0" },
     { "ip-reservations-unique",         Element::boolean, "true" },
+    { "reservations-lookup-first",      Element::boolean, "false" },
     { "ddns-update-on-renew",           Element::boolean, "false" },
     { "ddns-use-conflict-resolution",   Element::boolean, "true" },
     { "parked-packet-limit",            Element::integer, "256" }
index 2836338e4f262626c9650367fc6fbd79ee8fcb63..44b4be5672fb66267ba7f54277f537915e6dbc6d 100644 (file)
@@ -46,9 +46,8 @@ SrvConfig::SrvConfig()
       class_dictionary_(new ClientClassDictionary()),
       decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
       d2_client_config_(new D2ClientConfig()),
-      configured_globals_(new CfgGlobals()),
-      cfg_consist_(new CfgConsistency()),
-      lenient_option_parsing_(false) {
+      configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
+      lenient_option_parsing_(false), reservations_lookup_first_(false) {
 }
 
 SrvConfig::SrvConfig(const uint32_t sequence)
@@ -65,9 +64,8 @@ SrvConfig::SrvConfig(const uint32_t sequence)
       class_dictionary_(new ClientClassDictionary()),
       decline_timer_(0), echo_v4_client_id_(true), dhcp4o6_port_(0),
       d2_client_config_(new D2ClientConfig()),
-      configured_globals_(new CfgGlobals()),
-      cfg_consist_(new CfgConsistency()),
-      lenient_option_parsing_(false) {
+      configured_globals_(new CfgGlobals()), cfg_consist_(new CfgConsistency()),
+      lenient_option_parsing_(false), reservations_lookup_first_(false) {
 }
 
 std::string
@@ -266,6 +264,8 @@ SrvConfig::mergeGlobals(SrvConfig& other) {
                 setServerTag(element->stringValue());
             } else if (name == "ip-reservations-unique") {
                 setIPReservationsUnique(element->boolValue());
+            } else if (name == "reservations-lookup-first") {
+                setReservationsLookupFirst(element->boolValue());
             }
         } catch(const std::exception& ex) {
             isc_throw (BadValue, "Invalid value:" << element->str()
index 4e7fd416547ba1521e531db0f978ab6f36f38c10..9049252153eb4c89a8472a19683bd7babcfeb385 100644 (file)
@@ -795,7 +795,7 @@ public:
 
     /// @brief Sets DHCP4o6 IPC port
     ///
-    /// DHCPv4-over-DHCPv6 uses a UDP socket for interserver communication,
+    /// DHCPv4-over-DHCPv6 uses a UDP socket for inter-server communication,
     /// this socket is bound and connected to this port and port + 1
     ///
     /// @param port port and port + 1 to use
@@ -946,6 +946,24 @@ public:
     /// or disallowed to specify multiple hosts with the same IP reservation.
     void setIPReservationsUnique(const bool unique);
 
+    /// @brief Sets whether the server does host reservations lookup before lease
+    /// lookup.
+    ///
+    /// @param first Boolean value indicating if host reservations lookup should
+    /// be performed before lease lookup.
+    void setReservationsLookupFirst(const bool first) {
+        reservations_lookup_first_ = first;
+    }
+
+    /// @brief Returns whether the server does host reservations lookup before
+    /// lease lookup.
+    ///
+    /// @return Boolean value indicating if host reservations lookup should be
+    /// performed before lease lookup.
+    bool getReservationsLookupFirst() const {
+        return (reservations_lookup_first_);
+    }
+
     /// @brief Unparse a configuration object
     ///
     /// @return a pointer to unparsed configuration
@@ -1131,6 +1149,13 @@ private:
     /// @{
     bool lenient_option_parsing_;
     /// @}
+
+    /// @brief Flag which indicates if the server should do host reservations
+    /// lookup before lease lookup. This parameter has effect only when
+    /// multi-threading is disabled. If multi-threading is enabled, host
+    /// reservations lookup is always performed first.
+    /// It default to false then multi-threading is disabled.
+    bool reservations_lookup_first_;
 };
 
 /// @name Pointers to the @c SrvConfig object.
index e6b52405fea93661b4a5d2b9d1f09e01cee3fdc0..999d140dc68d16ecf805ed2b35defcfe83aa4600 100644 (file)
@@ -3609,8 +3609,7 @@ TEST_F(AllocEngine4Test, updateExtendedInfo4) {
         lease->setContext(orig_context);
         if (!orig_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(orig_context->equals(*(lease->getContext())));
         }
@@ -3636,8 +3635,7 @@ TEST_F(AllocEngine4Test, updateExtendedInfo4) {
         // Verify the lease has the expected user context content.
         if (!exp_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(exp_context->equals(*(lease->getContext())))
                 << "expected: " << *(exp_context) << std::endl
@@ -3747,8 +3745,7 @@ TEST_F(AllocEngine4Test, storeExtendedInfoEnabled4) {
         // Verify the lease has the expected user context content.
         if (!exp_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(exp_context->equals(*(lease->getContext())))
                 << "expected: " << *(exp_context) << std::endl
index f833c3a02b840c6b153c7cb512aa905ec86693e3..746ecbcffb8f2b4e8b832b27535626e5cffc5a24 100644 (file)
@@ -4119,8 +4119,7 @@ TEST_F(AllocEngine6ExtendedInfoTest, updateExtendedInfo6) {
         lease->setContext(orig_context);
         if (!orig_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(orig_context->equals(*(lease->getContext())));
         }
@@ -4136,8 +4135,7 @@ TEST_F(AllocEngine6ExtendedInfoTest, updateExtendedInfo6) {
         // Verify the lease has the expected user context content.
         if (!exp_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(exp_context->equals(*(lease->getContext())))
                 << "expected: " << *(exp_context) << std::endl
@@ -4233,8 +4231,7 @@ TEST_F(AllocEngine6ExtendedInfoTest, storeExtendedInfoEnabled6) {
         // Verify the lease has the expected user context content.
         if (!exp_context) {
             ASSERT_FALSE(lease->getContext());
-        }
-        else {
+        } else {
             ASSERT_TRUE(lease->getContext());
             ASSERT_TRUE(exp_context->equals(*(lease->getContext())))
                 << "expected: " << *(exp_context) << std::endl
index 691ec7e11a2fe3880fd8a84704c74a2eb1a8e993..1e90ae916b0e9793a77b75e7cfa723ba578835df 100644 (file)
@@ -309,6 +309,26 @@ TEST_F(SrvConfigTest, echoClientId) {
     EXPECT_TRUE(conf1.getEchoClientId());
 }
 
+// This test verifies that host reservations lookup first flag can be configured.
+TEST_F(SrvConfigTest, reservationsLookupFirst) {
+    SrvConfig conf;
+
+    // Check that the default is false
+    EXPECT_FALSE(conf.getReservationsLookupFirst());
+
+    // Check that it can be modified to true
+    conf.setReservationsLookupFirst(true);
+    EXPECT_TRUE(conf.getReservationsLookupFirst());
+
+    // Check that the default value can be restored
+    conf.setReservationsLookupFirst(false);
+    EXPECT_FALSE(conf.getReservationsLookupFirst());
+
+    // Check the other constructor has the same default
+    SrvConfig conf1(1);
+    EXPECT_FALSE(conf1.getReservationsLookupFirst());
+}
+
 // This test checks if entire configuration can be copied and that the sequence
 // number is not affected.
 TEST_F(SrvConfigTest, copy) {
@@ -1029,6 +1049,7 @@ TEST_F(SrvConfigTest, mergeGlobals4) {
     cfg_from.setEchoClientId(true);
     cfg_from.setDhcp4o6Port(888);
     cfg_from.setServerTag("nor_this_server");
+    cfg_from.setReservationsLookupFirst(true);
 
     // Add a configured global ip-reservations-unique. It should be populated
     // to the CfgDbAccess and CfgHosts.
@@ -1037,6 +1058,7 @@ TEST_F(SrvConfigTest, mergeGlobals4) {
     // Add some configured globals:
     cfg_to.addConfiguredGlobal("dhcp4o6-port", Element::create(999));
     cfg_to.addConfiguredGlobal("server-tag", Element::create("use_this_server"));
+    cfg_to.addConfiguredGlobal("reservations-lookup-first", Element::create(true));
 
     // Now let's merge.
     ASSERT_NO_THROW(cfg_to.merge(cfg_from));
@@ -1055,6 +1077,9 @@ TEST_F(SrvConfigTest, mergeGlobals4) {
     //  server-tag port should be the "from" configured value.
     EXPECT_EQ("use_this_server", cfg_to.getServerTag().get());
 
+    //  reservations-lookup-first should be the "from" configured value.
+    EXPECT_TRUE(cfg_to.getReservationsLookupFirst());
+
     // ip-reservations-unique
     EXPECT_FALSE(cfg_to.getCfgDbAccess()->getIPReservationsUnique());
 
@@ -1066,7 +1091,8 @@ TEST_F(SrvConfigTest, mergeGlobals4) {
         "   \"decline-probation-period\": 300,  \n"
         "   \"dhcp4o6-port\": 999,  \n"
         "   \"ip-reservations-unique\": false,  \n"
-        "   \"server-tag\": \"use_this_server\"  \n"
+        "   \"server-tag\": \"use_this_server\",  \n"
+        "   \"reservations-lookup-first\": true"
         "} \n";
 
     ConstElementPtr expected_globals;
@@ -1105,6 +1131,7 @@ TEST_F(SrvConfigTest, mergeGlobals6) {
     cfg_from.setEchoClientId(true);
     cfg_from.setDhcp4o6Port(888);
     cfg_from.setServerTag("nor_this_server");
+    cfg_from.setReservationsLookupFirst(true);
 
     // Add a configured global ip-reservations-unique. It should be populated
     // to the CfgDbAccess and CfgHosts.
@@ -1113,6 +1140,7 @@ TEST_F(SrvConfigTest, mergeGlobals6) {
     // Add some configured globals:
     cfg_to.addConfiguredGlobal("dhcp4o6-port", Element::create(999));
     cfg_to.addConfiguredGlobal("server-tag", Element::create("use_this_server"));
+    cfg_to.addConfiguredGlobal("reservations-lookup-first", Element::create(true));
 
     // Now let's merge.
     ASSERT_NO_THROW(cfg_to.merge(cfg_from));
@@ -1128,6 +1156,9 @@ TEST_F(SrvConfigTest, mergeGlobals6) {
     //  server-tag port should be the "from" configured value.
     EXPECT_EQ("use_this_server", cfg_to.getServerTag().get());
 
+    //  reservations-lookup-first should be the "from" configured value.
+    EXPECT_TRUE(cfg_to.getReservationsLookupFirst());
+
     // ip-reservations-unique
     EXPECT_FALSE(cfg_to.getCfgDbAccess()->getIPReservationsUnique());
 
@@ -1139,7 +1170,8 @@ TEST_F(SrvConfigTest, mergeGlobals6) {
         "   \"decline-probation-period\": 300,  \n"
         "   \"dhcp4o6-port\": 999,  \n"
         "   \"ip-reservations-unique\": false,  \n"
-        "   \"server-tag\": \"use_this_server\"  \n"
+        "   \"server-tag\": \"use_this_server\",  \n"
+        "   \"reservations-lookup-first\": true"
         "} \n";
 
     ConstElementPtr expected_globals;
@@ -1148,7 +1180,6 @@ TEST_F(SrvConfigTest, mergeGlobals6) {
 
     EXPECT_TRUE(isEquivalent(expected_globals,
                              cfg_to.getConfiguredGlobals()->toElement()));
-
 }
 
 // This test verifies that new list of client classes replaces and old list