// lease is returned as it was "cached".
"cache-max-age": 1000,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Subnet-level value of the renew timer.
"renew-timer": 30,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and
- // "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"capacity": 64
},
- // Fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// lease is returned as it was "cached".
"cache-max-age": 1000,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Subnet-level value of the renew timer.
"renew-timer": 30,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and
- // "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"capacity": 64
},
- // Fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// This directive tells Kea that reservations are global. Note that this
// can also be specified at shared network and/or subnet level.
-// "reservation-mode": "global",
-// It is replaced by the "reservations-global", "reservations-in-subnet", and
-// "reservations-out-of-pool" parameters.
// Specify whether the server should look up global reservations.
"reservations-global": true,
// to the dynamic pool. Kea is able to handle this case, but it is not
// recommended from a performance perspective, as Kea would not only need to
// check if a given address is free, but also whether it is reserved.
-// To avoid this check, one can change reservation-mode to out-of-pool, rather
-// than 'all'. If a subnet does not have reservations at all, the reservation
-// lookup can be skipped altogether (reservation-mode is set to 'disabled').
-// The reservation-mode has been replaced by reservations-global,
-// reservations-in-subnet and reservations-out-of-pool.
+// To avoid this check, one can set "reservations-out-of-pool", beside
+// the "reservations-in-subnet". If a subnet does not have reservations at all,
+// the reservation lookup can be skipped altogether by disabling
+// "reservations-in-subnet".
// Note that the second reservation is for an address which is within the
// range of the pool of the dynamically allocated address. The server will
"interface": "eth0",
// This directive tells Kea that reservations may be made both in-pool
// and out-of-pool. For improved performance, you may move all reservations
- // out of the dynamic pool and change reservation-mode to "out-of-pool".
+ // out of the dynamic pool and set "reservations-out-of-pool".
// Kea will then be able to skip querying for host reservations when
// assigning leases from dynamic pool.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global", "reservations-in-subnet"
- // and "reservations-out-of-pool" parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Timer values can be overridden here.
"renew-timer": 100,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"ip-addresses": [ "0.0.0.0" ]
},
"renew-timer": 10,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Specify whether the server should look up in-subnet reservations.
"pools": [ ],
"rebind-timer": 20,
"renew-timer": 10,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Specify whether the server should look up in-subnet reservations.
// lease is returned as it was "cached".
"cache-max-age": 1000,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Subnet-level renew timer.
"renew-timer": 30,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and
- // "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"capacity": 64
},
- // Fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// lease is returned as it was "cached".
"cache-max-age": 1000,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Subnet-level renew timer.
"renew-timer": 30,
- // Enumeration specifying the server's mode of operation when it
- // fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and
- // "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"capacity": 64
},
- // Fetches host reservations.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool" parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
// This directive tells Kea that reservations are global. Note that this
// can also be specified at shared network and/or subnet level.
-// "reservation-mode": "global",
-// It is replaced by the "reservations-global", "reservations-in-subnet", and
-// "reservations-out-of-pool" parameters.
// Specify whether the server should look up global reservations.
"reservations-global": true,
// This directive tells Kea that reservations may be made both in-pool
// and out-of-pool. For improved performance, you may move all reservations
- // out of the dynamic pool and change reservation-mode to "out-of-pool".
+ // out of the dynamic pool and set "reservations-out-of-pool".
// Kea will then be able to skip querying for host reservations when
// assigning leases from dynamic pool.
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global", "reservations-in-subnet"
- // and "reservations-out-of-pool" parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
},
"renew-timer": 100,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
-
// Specify whether the server should look up global reservations.
"reservations-global": false,
"ip-addresses": [ "2001:db8:1::123" ]
},
"renew-timer": 10,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Specify whether the server should look up in-subnet reservations.
"ip-addresses": [ "3000::1" ]
},
"renew-timer": 10,
- // "reservation-mode": "all",
- // It is replaced by the "reservations-global",
- // "reservations-in-subnet", and "reservations-out-of-pool"
- // parameters.
// Specify whether the server should look up global reservations.
"reservations-global": false,
// Specify whether the server should look up in-subnet reservations.
Some of those checks may be unnecessary in certain deployments, and not
performing them may improve performance. The Kea server provides the
-``reservation-mode`` configuration parameter to select the types of
+``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` configuration parameters to select the types of
reservations allowed for a particular subnet. Each reservation type has
different constraints for the checks to be performed by the server when
-allocating or renewing a lease for the client. Although ``reservation-mode``
-was deprecated in Kea 1.9.1, it is still available; the allowed values are:
-
-- ``all`` - enables both in-pool and out-of-pool host reservation
- types. This setting is the default value, and is the safest and most
- flexible. However, as all checks are conducted, it is also the slowest.
- It does not check against global reservations.
-
-- ``out-of-pool`` - allows only out-of-pool host reservations. With
- this setting in place, the server assumes that all host
- reservations are for addresses that do not belong to the dynamic
- pool. Therefore, it can skip the reservation checks when dealing with
- in-pool addresses, thus improving performance. Do not use this mode
- if any reservations use in-pool addresses. Caution is advised
- when using this setting; Kea does not sanity-check the reservations
- against ``reservation-mode`` and misconfiguration may cause problems.
-
-- ``global`` - allows only global host reservations. With this setting
- in place, the server searches for reservations for a client only
- among the defined global reservations. If an address is specified,
- the server skips the reservation checks carried out in
- other modes, thus improving performance. Caution is advised when
- using this setting; Kea does not sanity-check reservations when
- ``global`` is set, and misconfiguration may cause problems.
-
-- ``disabled`` - host reservation support is disabled. As there are no
- reservations, the server skips all checks. Any reservations
- defined are completely ignored. As checks are skipped, the
- server may operate faster in this mode.
-
-Since Kea 1.9.1, the ``reservation-mode`` parameter is replaced by the
-``reservations-global``, ``reservations-in-subnet``, and
-``reservations-out-of-pool`` flags.
-The flags can be activated independently and can produce various combinations,
-some of which were not supported by the deprecated ``reservation-mode``.
-
-The ``reservation-mode`` parameter can be specified at:
-
-- global level: ``.Dhcp4["reservation-mode"]`` (lowest priority: gets overridden
+allocating or renewing a lease for the client.
+
+Configuration flags are:
+
+- ``reservations-in-subnet`` - enables in-pool host reservation types. This
+ setting is the default value, and is the safest and most flexible. However,
+ as all checks are conducted, it is also the slowest. It does not check
+ against global reservations.
+
+- ``reservations-out-of-pool`` - allows only out-of-pool host reservations.
+ With this setting in place, the server assumes that all host reservations are
+ for addresses that do not belong to the dynamic pool. Therefore, it can skip
+ the reservation checks when dealing with in-pool addresses, thus improving
+ performance. Do not use this mode if any reservations use in-pool addresses.
+ Caution is advised when using this setting; Kea does not sanity-check the
+ reservations against ``reservations-out-of-pool`` and misconfiguration may
+ cause problems.
+
+- ``reservations-global`` - allows global host reservations. With this setting
+ in place, the server searches for reservations for a client among the defined
+ global reservations. If an address is specified, the server skips the
+ reservation checks carried out in other modes, thus improving performance.
+ Caution is advised when using this setting; Kea does not sanity-check the
+ reservations when ``reservations-global`` is set, and misconfiguration may
+ cause problems.
+
+Note: disabling all flags disables host reservation support. As there are no
+ reservations, the server skips all checks. Any reservations defined are
+ completely ignored. As checks are skipped, the server may operate faster in
+ this mode.
+
+Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` flags are suported.
+
+The ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` parameters can be specified at:
+
+- global level: ``.Dhcp4["reservations-global"]`` (lowest priority: gets overridden
by all others)
-- subnet level: ``.Dhcp4.subnet4[]["reservation-mode"]`` (low priority)
+- subnet level: ``.Dhcp4.subnet4[]["reservations-in-subnet"]`` (low priority)
-- shared-network level: ``.Dhcp4["shared-networks"][]["reservation-mode"]``
+- shared-network level: ``.Dhcp4["shared-networks"][]["reservations-out-of-pool"]``
(high priority)
- shared-network subnet-level:
- ``.Dhcp4["shared-networks"][].subnet4[]["reservation-mode"]`` (highest
+ ``.Dhcp4["shared-networks"][].subnet4[]["reservations-out-of-pool"]`` (highest
priority: overrides all others)
-To decide which ``reservation-mode`` to choose, the
-following decision diagram may be useful:
+To decide which flags to use, the following decision diagram may be useful:
::
| | | |
| yes| no| |
| | | V
- +----------------+ +--> "all"
+ +----------------+ +--> "in-subnet"
An example configuration that disables reservations looks as follows:
"pool": "192.0.2.10-192.0.2.100"
}
],
- "reservation-mode": "disabled",
+ "reservations-global": false,
+ "reservations-in-subnet": false,
"subnet": "192.0.2.0/24"
}
]
{
"Dhcp4": {
- "reservation-mode": "global",
+ "reservations-global": true,
"reservations": [
{
"hostname": "host-one",
the respective reservations from inside the dynamic pools (if any) can be
dynamically assigned to any client.
-The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``disabled`` configuration corresponds to:
.. code-block:: json
}
}
-The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``global``configuration using ``reservations-global`` corresponds to:
.. code-block:: json
}
}
-The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``out-of-pool`` configuration using ``reservations-out-of-pool`` corresponds to:
.. code-block:: json
}
}
-And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
+And the ``in-subnet`` configuration using ``reservations-in-subnet`` corresponds to:
.. code-block:: json
}
}
-To activate both ``global`` and ``all``, the following combination can be used:
+To activate both ``global`` and ``in-subnet``, the following combination can be used:
.. code-block:: json
Some of those checks may be unnecessary in certain deployments, and not
performing them may improve performance. The Kea server provides the
-``reservation-mode`` configuration parameter to select the types of
+``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` configuration parameters to select the types of
reservations allowed for a particular subnet. Each reservation type has
different constraints for the checks to be performed by the server when
-allocating or renewing a lease for the client. Allowed values are:
-
-- ``all`` - enables both in-pool and out-of-pool host reservation
- types. This setting is the default value, and is the safest and most
- flexible. However, as all checks are conducted, it is also the slowest.
- It does not check against global reservations.
-
-- ``out-of-pool`` - allows only out-of-pool host reservations. With
- this setting in place, the server assumes that all host
- reservations are for addresses that do not belong to the dynamic
- pool. Therefore, it can skip the reservation checks when dealing with
- in-pool addresses, thus improving performance. Do not use this mode
- if any reservations use in-pool addresses. Caution is advised
- when using this setting; Kea does not sanity-check the reservations
- against ``reservation-mode`` and misconfiguration may cause problems.
-
-- ``global`` - allows only global host reservations. With this setting
- in place, the server searches for reservations for a client only
- among the defined global reservations. If an address is specified,
- the server skips the reservation checks carried out in
- other modes, thus improving performance. Caution is advised when
- using this setting; Kea does not sanity-check the reservations when
- ``global`` is set, and misconfiguration may cause problems.
-
-- ``disabled`` - host reservation support is disabled. As there are no
- reservations, the server skips all checks. Any reservations
- defined are completely ignored. As checks are skipped, the
- server may operate faster in this mode.
-
-Since Kea 1.9.1, the ``reservation-mode`` parameter is replaced by the
-``reservations-global``, ``reservations-in-subnet`` and
-``reservations-out-of-pool`` flags.
-The flags can be activated independently and can produce various combinations,
-some of them being unsupported by the deprecated ``reservation-mode``.
-
-The ``reservation-mode`` parameter can be specified at:
-
-- global level: ``.Dhcp6["reservation-mode"]`` (lowest priority: gets overridden
+allocating or renewing a lease for the client.
+
+Configuration flags are:
+
+- ``reservations-in-subnet`` - enables in-pool host reservation types. This
+ setting is the default value, and is the safest and most flexible. However,
+ as all checks are conducted, it is also the slowest. It does not check
+ against global reservations.
+
+- ``reservations-out-of-pool`` - allows only out-of-pool host reservations.
+ With this setting in place, the server assumes that all host reservations are
+ for addresses that do not belong to the dynamic pool. Therefore, it can skip
+ the reservation checks when dealing with in-pool addresses, thus improving
+ performance. Do not use this mode if any reservations use in-pool addresses.
+ Caution is advised when using this setting; Kea does not sanity-check the
+ reservations against ``reservations-out-of-pool`` and misconfiguration may
+ cause problems.
+
+- ``reservations-global`` - allows global host reservations. With this setting
+ in place, the server searches for reservations for a client among the defined
+ global reservations. If an address is specified, the server skips the
+ reservation checks carried out in other modes, thus improving performance.
+ Caution is advised when using this setting; Kea does not sanity-check the
+ reservations when ``reservations-global`` is set, and misconfiguration may
+ cause problems.
+
+Note: disabling all flags disables host reservation support. As there are no
+ reservations, the server skips all checks. Any reservations defined are
+ completely ignored. As checks are skipped, the server may operate faster in
+ this mode.
+
+Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` flags are suported.
+
+The ``reservations-global``, ``reservations-in-subnet`` and
+``reservations-out-of-pool`` parameters can be specified at:
+
+- global level: ``.Dhcp6["reservations-global"]`` (lowest priority: gets overridden
by all others)
-- subnet level: ``.Dhcp6.subnet6[]["reservation-mode"]`` (low priority)
+- subnet level: ``.Dhcp6.subnet6[]["reservations-in-subnet"]`` (low priority)
-- shared-network level: ``.Dhcp6["shared-networks"][]["reservation-mode"]``
+- shared-network level: ``.Dhcp6["shared-networks"][]["reservations-out-of-pool"]``
(high priority)
- shared-network subnet-level:
- ``.Dhcp6["shared-networks"][].subnet6[]["reservation-mode"]`` (highest
+ ``.Dhcp6["shared-networks"][].subnet6[]["reservations-out-of-pool"]`` (highest
priority: overrides all others)
-To decide which ``"reservation-mode"`` to choose, the
-following decision diagram may be useful:
+To decide which flags to use, the following decision diagram may be useful:
::
| | | |
| yes| no| |
| | | V
- +----------------+ +--> "all"
+ +----------------+ +--> "in-subnet"
An example configuration that disables reservations looks as follows:
"pool": "2001:db8:1::-2001:db8:1::100"
}
],
- "reservation-mode": "disabled",
+ "reservations-global": false,
+ "reservations-in-subnet": false,
"subnet": "2001:db8:1::/64"
}
]
{
"Dhcp6": {
- "reservation-mode": "global",
+ "reservations-global": true,
"reservations": [
{
"duid": "00:03:00:01:11:22:33:44:55:66",
the respective reservations from inside the dynamic pools (if any) can be
dynamically assigned to any client.
-The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``disabled`` configuration corresponds to:
.. code-block:: json
}
}
-The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``global``configuration using ``reservations-global`` corresponds to:
.. code-block:: json
}
}
-The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds to:
+The ``out-of-pool`` configuration using ``reservations-out-of-pool`` corresponds to:
.. code-block:: json
}
}
-And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
+And the ``in-subnet`` configuration using ``reservations-in-subnet`` corresponds to:
.. code-block:: json
}
}
-To activate both ``global`` and ``all``, the following combination can be used:
+To activate both ``global`` and ``in-subnet``, the following combination can be used:
.. code-block:: json
"ip-address": "0.0.0.0"
},
"renew-timer": 60,
- # "reservation-mode": "all",
- # It is replaced by the "reservations-global",
- # "reservations-in-subnet", and "reservations-out-of-pool"
- # parameters.
# Specify if the server should look up global reservations.
"reservations-global": false,
# Specify if the server should look up in-subnet reservations.
}
}
-\"reservation-mode\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::DHCP4:
- case isc::dhcp::Parser4Context::SUBNET4:
- case isc::dhcp::Parser4Context::SHARED_NETWORK:
- return isc::dhcp::Dhcp4Parser::make_RESERVATION_MODE(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("reservation-mode", driver.loc_);
- }
-}
-
-\"disabled\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("disabled", driver.loc_);
- }
-}
-
-\"off\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("off", driver.loc_);
- }
-}
-
-\"out-of-pool\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp4Parser::make_OUT_OF_POOL(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("out-of-pool", driver.loc_);
- }
-}
-
-\"global\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp4Parser::make_GLOBAL(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("global", driver.loc_);
- }
-}
-
-\"all\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser4Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp4Parser::make_ALL(driver.loc_);
- default:
- return isc::dhcp::Dhcp4Parser::make_STRING("all", driver.loc_);
- }
-}
-
\"reservations-global\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4:
SUBNET "subnet"
INTERFACE "interface"
ID "id"
- RESERVATION_MODE "reservation-mode"
- DISABLED "disabled"
- OUT_OF_POOL "out-of-pool"
- GLOBAL "global"
- ALL "all"
RESERVATIONS_GLOBAL "reservations-global"
RESERVATIONS_IN_SUBNET "reservations-in-subnet"
RESERVATIONS_OUT_OF_POOL "reservations-out-of-pool"
%type <ElementPtr> outbound_interface_value
%type <ElementPtr> db_type
%type <ElementPtr> on_fail_mode
-%type <ElementPtr> hr_mode
%type <ElementPtr> ncr_protocol_value
%type <ElementPtr> ddns_replace_client_name_value
%type <ElementPtr> ddns_conflict_resolution_mode_value
| reservations
| config_control
| server_tag
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
| client_class
| require_client_classes
| reservations
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
ctx.stack_.back()->set("reservations-out-of-pool", b);
};
-reservation_mode: RESERVATION_MODE {
- ctx.unique("reservation-mode", ctx.loc2pos(@1));
- ctx.enter(ctx.RESERVATION_MODE);
-} COLON hr_mode {
- ctx.stack_.back()->set("reservation-mode", $4);
- ctx.leave();
-};
-
-hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
- | OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
- | GLOBAL { $$ = ElementPtr(new StringElement("global", ctx.loc2pos(@1))); }
- | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
- ;
-
id: ID COLON INTEGER {
ctx.unique("id", ctx.loc2pos(@1));
ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
| server_hostname
| boot_file_name
| relay
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
// default values and will insert derived values as well.
mutable_cfg = boost::const_pointer_cast<Element>(config_set);
- // Move from reservation mode to new reservations flags.
- // @todo add warning
- BaseNetworkParser::moveReservationMode(mutable_cfg);
-
// Set all default values if not specified by the user.
SimpleParser4::setAllDefaults(mutable_cfg);
(config_pair.first == "server-hostname") ||
(config_pair.first == "boot-file-name") ||
(config_pair.first == "server-tag") ||
- (config_pair.first == "reservation-mode") ||
(config_pair.first == "reservations-global") ||
(config_pair.first == "reservations-in-subnet") ||
(config_pair.first == "reservations-out-of-pool") ||
return ("hooks-libraries");
case SUBNET4:
return ("subnet4");
- case RESERVATION_MODE:
- return ("reservation-mode");
case OPTION_DEF:
return ("option-def");
case OPTION_DATA:
/// Used while parsing shared-networks structures.
SHARED_NETWORK,
- /// Used while parsing Dhcp4/reservation-mode.
- RESERVATION_MODE,
-
/// Used while parsing Dhcp4/option-def structures.
OPTION_DEF,
loadFile(sample_dir + "reservations.json", sample_json);
loadFile(sample_dir + "all-keys-netconf.json", sample_json);
KeywordSet sample_keys = {
- "hosts-database",
- "reservation-mode"
+ "hosts-database"
};
// Recursively extract keywords.
static void (*extract)(ConstElementPtr, KeywordSet&) =
}
}
-\"reservation-mode\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::DHCP6:
- case isc::dhcp::Parser6Context::SUBNET6:
- case isc::dhcp::Parser6Context::SHARED_NETWORK:
- return isc::dhcp::Dhcp6Parser::make_RESERVATION_MODE(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("reservation-mode", driver.loc_);
- }
-}
-
-\"disabled\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("disabled", driver.loc_);
- }
-}
-
-\"off\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("off", driver.loc_);
- }
-}
-
-\"out-of-pool\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp6Parser::make_OUT_OF_POOL(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("out-of-pool", driver.loc_);
- }
-}
-
-\"global\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp6Parser::make_GLOBAL(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("global", driver.loc_);
- }
-}
-
-\"all\" {
- switch(driver.ctx_) {
- case isc::dhcp::Parser6Context::RESERVATION_MODE:
- return isc::dhcp::Dhcp6Parser::make_ALL(driver.loc_);
- default:
- return isc::dhcp::Dhcp6Parser::make_STRING("all", driver.loc_);
- }
-}
-
\"reservations-global\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6:
INTERFACE_ID "interface-id"
ID "id"
RAPID_COMMIT "rapid-commit"
- RESERVATION_MODE "reservation-mode"
- DISABLED "disabled"
- OUT_OF_POOL "out-of-pool"
- GLOBAL "global"
- ALL "all"
RESERVATIONS_GLOBAL "reservations-global"
RESERVATIONS_IN_SUBNET "reservations-in-subnet"
RESERVATIONS_OUT_OF_POOL "reservations-out-of-pool"
%type <ElementPtr> map_value
%type <ElementPtr> db_type
%type <ElementPtr> on_fail_mode
-%type <ElementPtr> hr_mode
%type <ElementPtr> duid_type
%type <ElementPtr> ncr_protocol_value
%type <ElementPtr> ddns_replace_client_name_value
| reservations
| config_control
| server_tag
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
| client_class
| require_client_classes
| reservations
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
ctx.stack_.back()->set("reservations-out-of-pool", b);
};
-reservation_mode: RESERVATION_MODE {
- ctx.unique("reservation-mode", ctx.loc2pos(@1));
- ctx.enter(ctx.RESERVATION_MODE);
-} COLON hr_mode {
- ctx.stack_.back()->set("reservation-mode", $4);
- ctx.leave();
-};
-
-hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
- | OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
- | GLOBAL { $$ = ElementPtr(new StringElement("global", ctx.loc2pos(@1))); }
- | ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
- ;
-
id: ID COLON INTEGER {
ctx.unique("id", ctx.loc2pos(@1));
ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
| rebind_timer
| option_data_list
| relay
- | reservation_mode
| reservations_global
| reservations_in_subnet
| reservations_out_of_pool
// default values and will insert derived values as well.
mutable_cfg = boost::const_pointer_cast<Element>(config_set);
- // Move from reservation mode to new reservations flags.
- // @todo add warning
- BaseNetworkParser::moveReservationMode(mutable_cfg);
-
// Set all default values if not specified by the user.
SimpleParser6::setAllDefaults(mutable_cfg);
(config_pair.first == "decline-probation-period") ||
(config_pair.first == "dhcp4o6-port") ||
(config_pair.first == "server-tag") ||
- (config_pair.first == "reservation-mode") ||
(config_pair.first == "reservations-global") ||
(config_pair.first == "reservations-in-subnet") ||
(config_pair.first == "reservations-out-of-pool") ||
return ("hooks-libraries");
case SUBNET6:
return ("subnet6");
- case RESERVATION_MODE:
- return ("reservation-mode");
case OPTION_DEF:
return ("option-def");
case OPTION_DATA:
/// Used while parsing shared-networks structures.
SHARED_NETWORK,
- /// Used while parsing Dhcp6/reservation-mode.
- RESERVATION_MODE,
-
/// Used while parsing Dhcp6/option-def structures.
OPTION_DEF,
loadFile(sample_dir + "reservations.json", sample_json);
loadFile(sample_dir + "all-keys-netconf.json", sample_json);
KeywordSet sample_keys = {
- "hosts-database",
- "reservation-mode"
+ "hosts-database"
};
// Recursively extract keywords.
static void (*extract)(ConstElementPtr, KeywordSet&) =
{ "dhcp4o6-port", DHCP4O6_PORT },
{ "comment", COMMENT },
{ "server-tag", SERVER_TAG },
- { "reservation-mode", RESERVATION_MODE },
{ "reservations-global", RESERVATIONS_GLOBAL },
{ "reservations-in-subnet", RESERVATIONS_IN_SUBNET },
{ "reservations-out-of-pool", RESERVATIONS_OUT_OF_POOL },
DHCP4O6_PORT,
COMMENT,
SERVER_TAG,
- RESERVATION_MODE,
RESERVATIONS_GLOBAL,
RESERVATIONS_IN_SUBNET,
RESERVATIONS_OUT_OF_POOL,
namespace isc {
namespace dhcp {
-void
-BaseNetworkParser::moveReservationMode(ElementPtr config) {
- if (!config->contains("reservation-mode")) {
- return;
- }
- if (config->contains("reservations-global") ||
- config->contains("reservations-in-subnet") ||
- config->contains("reservations-out-of-pool")) {
- isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
- " and one of 'reservations-global', 'reservations-in-subnet'"
- " or 'reservations-out-of-pool' parameters");
- }
- std::string hr_mode = getString(config, "reservation-mode");
- if ((hr_mode == "disabled") || (hr_mode == "off")) {
- config->set("reservations-global", Element::create(false));
- config->set("reservations-in-subnet", Element::create(false));
- } else if (hr_mode == "out-of-pool") {
- config->set("reservations-global", Element::create(false));
- config->set("reservations-in-subnet", Element::create(true));
- config->set("reservations-out-of-pool", Element::create(true));
- } else if (hr_mode == "global") {
- config->set("reservations-global", Element::create(true));
- config->set("reservations-in-subnet", Element::create(false));
- } else if (hr_mode == "all") {
- config->set("reservations-global", Element::create(false));
- config->set("reservations-in-subnet", Element::create(true));
- config->set("reservations-out-of-pool", Element::create(false));
- } else {
- isc_throw(DhcpConfigError, "invalid reservation-mode parameter: '"
- << hr_mode << "' ("
- << getPosition("reservation-mode", config) << ")");
- }
- config->remove("reservation-mode");
-}
-
-void
-BaseNetworkParser::moveReservationMode(CfgGlobalsPtr config) {
- if (!config->get(CfgGlobals::RESERVATION_MODE)) {
- return;
- }
- if (config->get(CfgGlobals::RESERVATIONS_GLOBAL) ||
- config->get(CfgGlobals::RESERVATIONS_IN_SUBNET) ||
- config->get(CfgGlobals::RESERVATIONS_OUT_OF_POOL)) {
- isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
- " and one of 'reservations-global', 'reservations-in-subnet'"
- " or 'reservations-out-of-pool' parameters");
- }
- std::string hr_mode = config->get(CfgGlobals::RESERVATION_MODE)->stringValue();
- if ((hr_mode == "disabled") || (hr_mode == "off")) {
- config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
- config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(false));
- } else if (hr_mode == "out-of-pool") {
- config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
- config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(true));
- config->set(CfgGlobals::RESERVATIONS_OUT_OF_POOL, Element::create(true));
- } else if (hr_mode == "global") {
- config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(true));
- config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(false));
- } else if (hr_mode == "all") {
- config->set(CfgGlobals::RESERVATIONS_GLOBAL, Element::create(false));
- config->set(CfgGlobals::RESERVATIONS_IN_SUBNET, Element::create(true));
- config->set("reservations-out-of-pool", Element::create(false));
- } else {
- isc_throw(DhcpConfigError, "invalid reservation-mode parameter: '"
- << hr_mode << "' ("
- << config->get(CfgGlobals::RESERVATION_MODE)->getPosition()
- << ")");
- }
- config->set(CfgGlobals::RESERVATION_MODE, ConstElementPtr());
-}
-
void
BaseNetworkParser::parseCommon(const ConstElementPtr& network_data,
NetworkPtr& network) {
/// @brief Common configuration parser for shared networks
/// and subnets.
class BaseNetworkParser : public data::SimpleParser {
-public:
-
- /// @brief Moves deprecated reservation-mode parameter to
- /// new reservations flags.
- ///
- /// @param config [in/out] configuration to alter.
- /// @throw DhcpConfigError on error e.g. when both reservation-mode
- /// and a flag are specified.
- static void moveReservationMode(isc::data::ElementPtr config);
-
- /// @brief Moves deprecated reservation-mode parameter to
- /// new reservations flags.
- ///
- /// @param config [in/out] global parameters to alter.
- /// @throw DhcpConfigError on error e.g. when both reservation-mode
- /// and a flag are specified.
- static void moveReservationMode(CfgGlobalsPtr config);
-
protected:
/// @brief Parses common parameters
subnet_id);
subnet_ = subnet4;
- // Move from reservation mode to new reservations flags.
ElementPtr mutable_params;
mutable_params = boost::const_pointer_cast<Element>(params);
- // @todo add warning
- BaseNetworkParser::moveReservationMode(mutable_params);
// Parse parameters common to all Network derivations.
NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet4);
subnet_id);
subnet_ = subnet6;
- // Move from reservation mode to new reservations flags.
ElementPtr mutable_params;
mutable_params = boost::const_pointer_cast<Element>(params);
- // @todo add warning
- BaseNetworkParser::moveReservationMode(mutable_params);
// Parse parameters common to all Network derivations.
NetworkPtr network = boost::dynamic_pointer_cast<Network>(subnet_);
std::string name = getString(shared_network_data, "name");
shared_network.reset(new SharedNetwork4(name));
- // Move from reservation mode to new reservations flags.
ElementPtr mutable_params;
mutable_params = boost::const_pointer_cast<Element>(shared_network_data);
- BaseNetworkParser::moveReservationMode(mutable_params);
// Parse parameters common to all Network derivations.
NetworkPtr network = boost::dynamic_pointer_cast<Network>(shared_network);
std::string name = getString(shared_network_data, "name");
shared_network.reset(new SharedNetwork6(name));
- // Move from reservation mode to new reservations flags.
ElementPtr mutable_params;
mutable_params = boost::const_pointer_cast<Element>(shared_network_data);
- BaseNetworkParser::moveReservationMode(mutable_params);
// Parse parameters common to all Network derivations.
NetworkPtr network = boost::dynamic_pointer_cast<Network>(shared_network);
{ "reservations", Element::list },
{ "config-control", Element::map },
{ "server-tag", Element::string },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
/// Note: When updating this array, please also update SHARED_SUBNET4_DEFAULTS
/// below. In most cases, those two should be kept in sync, except cases
/// where a parameter can be derived from shared-networks, but is not
-/// defined on global level. Currently there are two such parameters:
-/// interface and reservation-mode
+/// defined on global level. Currently there in only one such parameter:
+/// interface.
const SimpleDefaults SimpleParser4::SUBNET4_DEFAULTS = {
{ "interface", Element::string, "" },
{ "client-class", Element::string, "" },
/// @brief This table defines default values for each IPv4 subnet that is
/// part of a shared network
///
-/// This is mostly the same as @ref SUBNET4_DEFAULTS, except two parameters
+/// This is mostly the same as @ref SUBNET4_DEFAULTS, except one parameter
/// that can be derived from shared-network, but cannot from global scope.
-/// Those are: interface and reservation-mode.
+/// This is: interface.
const SimpleDefaults SimpleParser4::SHARED_SUBNET4_DEFAULTS = {
{ "4o6-interface", Element::string, "" },
{ "4o6-interface-id", Element::string, "" },
{ "server-hostname", Element::string },
{ "boot-file-name", Element::string },
{ "relay", Element::map },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
{ "reservations", Element::list },
{ "config-control", Element::map },
{ "server-tag", Element::string },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
{ "client-class", Element::string },
{ "require-client-classes", Element::list },
{ "reservations", Element::list },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
{ "rebind-timer", Element::integer },
{ "option-data", Element::list },
{ "relay", Element::map },
- { "reservation-mode", Element::string },
{ "reservations-global", Element::boolean },
{ "reservations-in-subnet", Element::boolean },
{ "reservations-out-of-pool", Element::boolean },
void
SrvConfig::mergeGlobals(SrvConfig& other) {
auto config_set = getConfiguredGlobals();
- // If the deprecated reservation-mode is found in database, overwrite other
- // reservation flags so there is no conflict when merging to new flags.
- if (other.getConfiguredGlobal(CfgGlobals::RESERVATION_MODE)) {
- config_set->set(CfgGlobals::RESERVATIONS_GLOBAL, ConstElementPtr());
- config_set->set(CfgGlobals::RESERVATIONS_IN_SUBNET, ConstElementPtr());
- config_set->set(CfgGlobals::RESERVATIONS_OUT_OF_POOL, ConstElementPtr());
- }
// Iterate over the "other" globals, adding/overwriting them into
// this config's list of globals.
for (auto const& other_global : other.getConfiguredGlobals()->valuesMap()) {
addConfiguredGlobal(other_global.first, other_global.second);
}
- // Merge the reservation-mode to new reservation flags.
- BaseNetworkParser::moveReservationMode(config_set);
-
// A handful of values are stored as members in SrvConfig. So we'll
// iterate over the merged globals, setting appropriate members.
for (auto const& merged_global : getConfiguredGlobals()->valuesMap()) {
EXPECT_NO_THROW(net4_child->getSiaddr());
}
-/// @brief Test fixture class for testing @c moveReservationMode.
-class NetworkReservationTest : public ::testing::Test {
-public:
-
- /// @brief Move test error case.
- ///
- /// Error cases of @ref BaseNetworkParser::moveReservationMode.
- ///
- /// @param config String with the config to test.
- /// @param expected String with the expected error message.
- void TestError(const std::string& config, const std::string& expected) {
- ElementPtr cfg;
- ASSERT_NO_THROW(cfg = Element::fromJSON(config))
- << "bad config, test broken";
-
- ElementPtr copy = isc::data::copy(cfg);
-
- EXPECT_THROW_MSG(BaseNetworkParser::moveReservationMode(cfg),
- DhcpConfigError, expected);
-
- ASSERT_TRUE(copy->equals(*cfg));
- }
-
- /// @brief Move test case.
- ///
- /// Test cases of @ref BaseNetworkParser::moveReservationMode.
- ///
- /// @param config String with the config to test.
- /// @param expected String with the config after move.
- void TestMove(const std::string& config, const std::string& expected) {
- ElementPtr cfg;
- ASSERT_NO_THROW(cfg = Element::fromJSON(config))
- << "bad config, test broken";
-
- EXPECT_NO_THROW(BaseNetworkParser::moveReservationMode(cfg));
-
- EXPECT_EQ(expected, cfg->str());
- }
-};
-
-/// @brief Test @ref BaseNetworkParser::moveReservationMode error cases.
-TEST_F(NetworkReservationTest, errors) {
- // Conflicts.
- std::string config = "{\n"
- "\"reservation-mode\": \"all\",\n"
- "\"reservations-global\": true\n"
- "}";
- std::string expected = "invalid use of both 'reservation-mode'"
- " and one of 'reservations-global', 'reservations-in-subnet'"
- " or 'reservations-out-of-pool' parameters";
- TestError(config, expected);
-
- config = "{\n"
- "\"reservation-mode\": \"all\",\n"
- "\"reservations-in-subnet\": true\n"
- "}";
- TestError(config, expected);
-
- config = "{\n"
- "\"reservation-mode\": \"all\",\n"
- "\"reservations-out-of-pool\": false\n"
- "}";
- TestError(config, expected);
-
- // Unknown mode.
- config = "{\n"
- "\"reservation-mode\": \"foo\"\n"
- "}";
- expected = "invalid reservation-mode parameter: 'foo' (<string>:2:21)";
- TestError(config, expected);
-}
-
-/// @brief Test @ref BaseNetworkParser::moveReservationMode.
-TEST_F(NetworkReservationTest, move) {
- // No-ops.
- std::string config = "{\n"
- "}";
- std::string expected = "{ "
- " }";
- TestMove(config, expected);
-
- config = "{\n"
- "\"reservations-global\": true\n"
- "}";
- expected = "{"
- " \"reservations-global\": true"
- " }";
- TestMove(config, expected);
-
- // Disabled.
- config = "{\n"
- "\"reservation-mode\": \"disabled\"\n"
- "}";
- expected = "{"
- " \"reservations-global\": false,"
- " \"reservations-in-subnet\": false"
- " }";
- TestMove(config, expected);
-
- config = "{\n"
- "\"reservation-mode\": \"off\"\n"
- "}";
- TestMove(config, expected);
-
- // Out-of-pool.
- config = "{\n"
- "\"reservation-mode\": \"out-of-pool\"\n"
- "}";
- expected = "{"
- " \"reservations-global\": false,"
- " \"reservations-in-subnet\": true,"
- " \"reservations-out-of-pool\": true"
- " }";
- TestMove(config, expected);
-
- // Global.
- config = "{\n"
- "\"reservation-mode\": \"global\"\n"
- "}";
- expected = "{"
- " \"reservations-global\": true,"
- " \"reservations-in-subnet\": false"
- " }";
- TestMove(config, expected);
-
- // All.
- config = "{\n"
- "\"reservation-mode\": \"all\"\n"
- "}";
- expected = "{"
- " \"reservations-global\": false,"
- " \"reservations-in-subnet\": true,"
- " \"reservations-out-of-pool\": false"
- " }";
- TestMove(config, expected);
-
- config = "{\n"
- "\"foobar\": 1234,\n"
- "\"reservation-mode\": \"all\"\n"
- "}";
- expected = "{"
- " \"foobar\": 1234,"
- " \"reservations-global\": false,"
- " \"reservations-in-subnet\": true,"
- " \"reservations-out-of-pool\": false"
- " }";
- TestMove(config, expected);
-}
-
// This test verifies that the inheritance is supported for triplets.
// Note that triplets have no comparison operator.
TEST_F(NetworkTest, inheritanceTriplet) {