// 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
// 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
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
.. 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:
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
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
}
}
+\"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:
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";
"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",
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;
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
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"
| statistic_default_sample_age
| dhcp_multi_threading
| ip_reservations_unique
+ | reservations_lookup_first
| compatibility
| parked_packet_limit
| unknown_map_entry
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)));
#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;
using namespace isc::hooks;
using namespace isc::process;
using namespace isc::config;
+using namespace isc::util;
namespace {
// 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
// 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
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);
}
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);
}
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 =
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);
}
if (sanity_checks) {
parameter_name = "sanity-checks";
SanityChecksParser parser;
- parser.parse(*srv_cfg, sanity_checks);
+ parser.parse(*srv_config, sanity_checks);
}
ConstElementPtr expiration_cfg =
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());
}
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.
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);
}
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;
/// 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");
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");
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);
}
}
(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);
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());
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;
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" ],\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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
-// 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
}
}
+\"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:
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";
"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",
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;
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.
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"
| statistic_default_sample_age
| dhcp_multi_threading
| ip_reservations_unique
+ | reservations_lookup_first
| compatibility
| parked_packet_limit
| unknown_map_entry
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)));
#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>
using namespace isc::hooks;
using namespace isc::process;
using namespace isc::config;
+using namespace isc::util;
namespace {
///
/// @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")) {
// 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.
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";
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) {
(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);
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" \"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"
" ],\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"
" \"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"
" \"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"
" \"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"
" \"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"
-// 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
// 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;
{ "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 },
CACHE_THRESHOLD,
CACHE_MAX_AGE,
IP_RESERVATIONS_UNIQUE,
+ RESERVATIONS_LOOKUP_FIRST,
DDNS_UPDATE_ON_RENEW,
DDNS_USE_CONFLICT_RESOLUTION,
PARKED_PACKET_LIMIT,
{ "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 },
{ "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" },
{ "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 },
{ "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" }
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)
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
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()
/// @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
/// 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
/// @{
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.
lease->setContext(orig_context);
if (!orig_context) {
ASSERT_FALSE(lease->getContext());
- }
- else {
+ } else {
ASSERT_TRUE(lease->getContext());
ASSERT_TRUE(orig_context->equals(*(lease->getContext())));
}
// 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
// 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
lease->setContext(orig_context);
if (!orig_context) {
ASSERT_FALSE(lease->getContext());
- }
- else {
+ } else {
ASSERT_TRUE(lease->getContext());
ASSERT_TRUE(orig_context->equals(*(lease->getContext())));
}
// 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
// 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
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) {
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.
// 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));
// 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());
" \"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;
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.
// 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));
// 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());
" \"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;
EXPECT_TRUE(isEquivalent(expected_globals,
cfg_to.getConfiguredGlobals()->toElement()));
-
}
// This test verifies that new list of client classes replaces and old list