mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 13:07:50 +00:00
[#2959] removed deprecated parameter reservation-mode
This commit is contained in:
parent
47d6f71be6
commit
23f7d80c41
@ -801,13 +801,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1001,13 +994,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1144,11 +1130,6 @@
|
||||
"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,
|
||||
|
||||
|
@ -828,13 +828,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1033,13 +1026,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1180,11 +1166,6 @@
|
||||
"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,
|
||||
|
||||
|
@ -51,9 +51,6 @@
|
||||
|
||||
// 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,
|
||||
|
@ -48,11 +48,10 @@
|
||||
// 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
|
||||
@ -66,12 +65,9 @@
|
||||
"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,
|
||||
|
@ -65,11 +65,6 @@
|
||||
// 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,
|
||||
|
||||
@ -102,10 +97,6 @@
|
||||
"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.
|
||||
@ -127,10 +118,6 @@
|
||||
"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.
|
||||
|
@ -751,13 +751,6 @@
|
||||
// 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,
|
||||
|
||||
@ -975,13 +968,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1115,11 +1101,6 @@
|
||||
"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,
|
||||
|
||||
|
@ -778,13 +778,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1007,13 +1000,6 @@
|
||||
// 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,
|
||||
|
||||
@ -1147,11 +1133,6 @@
|
||||
"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,
|
||||
|
||||
|
@ -40,9 +40,6 @@
|
||||
|
||||
// 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,
|
||||
|
@ -47,12 +47,9 @@
|
||||
|
||||
// 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,
|
||||
|
@ -71,11 +71,6 @@
|
||||
},
|
||||
"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,
|
||||
|
||||
@ -102,10 +97,6 @@
|
||||
"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.
|
||||
@ -130,10 +121,6 @@
|
||||
"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.
|
||||
|
@ -5316,61 +5316,60 @@ address should be revoked and the reserved one be used instead.
|
||||
|
||||
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:
|
||||
allocating or renewing a lease for the client.
|
||||
|
||||
- ``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.
|
||||
Configuration flags are:
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
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``.
|
||||
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.
|
||||
|
||||
The ``reservation-mode`` parameter can be specified at:
|
||||
Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
|
||||
``reservations-out-of-pool`` flags are suported.
|
||||
|
||||
- global level: ``.Dhcp4["reservation-mode"]`` (lowest priority: gets overridden
|
||||
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:
|
||||
|
||||
::
|
||||
|
||||
@ -5422,7 +5421,7 @@ following decision diagram may be useful:
|
||||
| | | |
|
||||
| yes| no| |
|
||||
| | | V
|
||||
+----------------+ +--> "all"
|
||||
+----------------+ +--> "in-subnet"
|
||||
|
||||
An example configuration that disables reservations looks as follows:
|
||||
|
||||
@ -5438,7 +5437,8 @@ 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"
|
||||
}
|
||||
]
|
||||
@ -5451,7 +5451,7 @@ An example configuration using global reservations is shown below:
|
||||
|
||||
{
|
||||
"Dhcp4": {
|
||||
"reservation-mode": "global",
|
||||
"reservations-global": true,
|
||||
"reservations": [
|
||||
{
|
||||
"hostname": "host-one",
|
||||
@ -5493,7 +5493,7 @@ The meaning of the reservation flags are:
|
||||
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
|
||||
|
||||
@ -5504,7 +5504,7 @@ The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
The ``global``configuration using ``reservations-global`` corresponds to:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
@ -5515,7 +5515,7 @@ The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -5527,7 +5527,7 @@ The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds t
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -5539,7 +5539,7 @@ And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
@ -4614,60 +4614,60 @@ instead.
|
||||
|
||||
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:
|
||||
allocating or renewing a lease for the client.
|
||||
|
||||
- ``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.
|
||||
Configuration flags are:
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
- ``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.
|
||||
- ``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.
|
||||
|
||||
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``.
|
||||
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.
|
||||
|
||||
The ``reservation-mode`` parameter can be specified at:
|
||||
Since Kea 1.9.1 the ``reservations-global``, ``reservations-in-subnet`` and
|
||||
``reservations-out-of-pool`` flags are suported.
|
||||
|
||||
- global level: ``.Dhcp6["reservation-mode"]`` (lowest priority: gets overridden
|
||||
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:
|
||||
|
||||
::
|
||||
|
||||
@ -4720,7 +4720,7 @@ following decision diagram may be useful:
|
||||
| | | |
|
||||
| yes| no| |
|
||||
| | | V
|
||||
+----------------+ +--> "all"
|
||||
+----------------+ +--> "in-subnet"
|
||||
|
||||
An example configuration that disables reservations looks as follows:
|
||||
|
||||
@ -4736,7 +4736,8 @@ 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"
|
||||
}
|
||||
]
|
||||
@ -4749,7 +4750,7 @@ An example configuration using global reservations is shown below:
|
||||
|
||||
{
|
||||
"Dhcp6": {
|
||||
"reservation-mode": "global",
|
||||
"reservations-global": true,
|
||||
"reservations": [
|
||||
{
|
||||
"duid": "00:03:00:01:11:22:33:44:55:66",
|
||||
@ -4791,7 +4792,7 @@ The meaning of the reservation flags are:
|
||||
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
|
||||
|
||||
@ -4802,7 +4803,7 @@ The ``disabled`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
The ``global``configuration using ``reservations-global`` corresponds to:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
@ -4813,7 +4814,7 @@ The ``global`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -4825,7 +4826,7 @@ The ``out-of-pool`` value from the deprecated ``reservation-mode`` corresponds t
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -4837,7 +4838,7 @@ And the ``all`` value from the deprecated ``reservation-mode`` corresponds to:
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
|
@ -1031,10 +1031,6 @@ An example response could look as follows:
|
||||
"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.
|
||||
|
@ -1125,62 +1125,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
|
||||
}
|
||||
}
|
||||
|
||||
\"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:
|
||||
|
@ -175,11 +175,6 @@ using namespace std;
|
||||
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"
|
||||
@ -299,7 +294,6 @@ using namespace std;
|
||||
%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
|
||||
@ -534,7 +528,6 @@ global_param: valid_lifetime
|
||||
| reservations
|
||||
| config_control
|
||||
| server_tag
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
@ -1599,7 +1592,6 @@ subnet4_param: valid_lifetime
|
||||
| client_class
|
||||
| require_client_classes
|
||||
| reservations
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
@ -1720,20 +1712,6 @@ reservations_out_of_pool: RESERVATIONS_OUT_OF_POOL COLON BOOLEAN {
|
||||
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)));
|
||||
@ -1793,7 +1771,6 @@ shared_network_param: name
|
||||
| server_hostname
|
||||
| boot_file_name
|
||||
| relay
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
|
@ -352,10 +352,6 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
|
||||
// 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);
|
||||
|
||||
@ -627,7 +623,6 @@ processDhcp4Config(isc::data::ConstElementPtr config_set) {
|
||||
(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") ||
|
||||
|
@ -175,8 +175,6 @@ Parser4Context::contextName() {
|
||||
return ("hooks-libraries");
|
||||
case SUBNET4:
|
||||
return ("subnet4");
|
||||
case RESERVATION_MODE:
|
||||
return ("reservation-mode");
|
||||
case OPTION_DEF:
|
||||
return ("option-def");
|
||||
case OPTION_DATA:
|
||||
|
@ -273,9 +273,6 @@ public:
|
||||
/// 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,
|
||||
|
||||
|
@ -789,8 +789,7 @@ TEST(ParserTest, mapEntries) {
|
||||
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&) =
|
||||
|
@ -1403,62 +1403,6 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
|
||||
}
|
||||
}
|
||||
|
||||
\"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:
|
||||
|
@ -166,11 +166,6 @@ using namespace std;
|
||||
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"
|
||||
@ -300,7 +295,6 @@ using namespace std;
|
||||
%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
|
||||
@ -538,7 +532,6 @@ global_param: data_directory
|
||||
| reservations
|
||||
| config_control
|
||||
| server_tag
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
@ -1615,7 +1608,6 @@ subnet6_param: preferred_lifetime
|
||||
| client_class
|
||||
| require_client_classes
|
||||
| reservations
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
@ -1710,20 +1702,6 @@ reservations_out_of_pool: RESERVATIONS_OUT_OF_POOL COLON BOOLEAN {
|
||||
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)));
|
||||
@ -1785,7 +1763,6 @@ shared_network_param: name
|
||||
| rebind_timer
|
||||
| option_data_list
|
||||
| relay
|
||||
| reservation_mode
|
||||
| reservations_global
|
||||
| reservations_in_subnet
|
||||
| reservations_out_of_pool
|
||||
|
@ -454,10 +454,6 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
|
||||
// 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);
|
||||
|
||||
@ -760,7 +756,6 @@ processDhcp6Config(isc::data::ConstElementPtr config_set) {
|
||||
(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") ||
|
||||
|
@ -172,8 +172,6 @@ Parser6Context::contextName() {
|
||||
return ("hooks-libraries");
|
||||
case SUBNET6:
|
||||
return ("subnet6");
|
||||
case RESERVATION_MODE:
|
||||
return ("reservation-mode");
|
||||
case OPTION_DEF:
|
||||
return ("option-def");
|
||||
case OPTION_DATA:
|
||||
|
@ -273,9 +273,6 @@ public:
|
||||
/// 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,
|
||||
|
||||
|
@ -780,8 +780,7 @@ TEST(ParserTest, mapEntries) {
|
||||
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&) =
|
||||
|
@ -24,7 +24,6 @@ CfgGlobals::nameToIndex = {
|
||||
{ "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 },
|
||||
|
@ -47,7 +47,6 @@ public:
|
||||
DHCP4O6_PORT,
|
||||
COMMENT,
|
||||
SERVER_TAG,
|
||||
RESERVATION_MODE,
|
||||
RESERVATIONS_GLOBAL,
|
||||
RESERVATIONS_IN_SUBNET,
|
||||
RESERVATIONS_OUT_OF_POOL,
|
||||
|
@ -17,77 +17,6 @@ using namespace isc::util;
|
||||
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) {
|
||||
|
@ -18,24 +18,6 @@ namespace dhcp {
|
||||
/// @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
|
||||
|
@ -740,11 +740,8 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params,
|
||||
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);
|
||||
@ -1280,11 +1277,8 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
|
||||
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_);
|
||||
|
@ -45,10 +45,8 @@ SharedNetwork4Parser::parse(const data::ConstElementPtr& shared_network_data,
|
||||
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);
|
||||
@ -253,10 +251,8 @@ SharedNetwork6Parser::parse(const data::ConstElementPtr& shared_network_data,
|
||||
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);
|
||||
|
@ -69,7 +69,6 @@ const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
|
||||
{ "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 },
|
||||
@ -225,7 +224,6 @@ const SimpleKeywords SimpleParser4::SUBNET4_PARAMETERS = {
|
||||
{ "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 },
|
||||
@ -267,8 +265,8 @@ const SimpleKeywords SimpleParser4::SUBNET4_PARAMETERS = {
|
||||
/// 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, "" },
|
||||
@ -280,9 +278,9 @@ const SimpleDefaults SimpleParser4::SUBNET4_DEFAULTS = {
|
||||
/// @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, "" },
|
||||
@ -355,7 +353,6 @@ const SimpleKeywords SimpleParser4::SHARED_NETWORK4_PARAMETERS = {
|
||||
{ "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 },
|
||||
|
@ -69,7 +69,6 @@ const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
|
||||
{ "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 },
|
||||
@ -225,7 +224,6 @@ const SimpleKeywords SimpleParser6::SUBNET6_PARAMETERS = {
|
||||
{ "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 },
|
||||
@ -362,7 +360,6 @@ const SimpleKeywords SimpleParser6::SHARED_NETWORK6_PARAMETERS = {
|
||||
{ "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 },
|
||||
|
@ -246,22 +246,12 @@ SrvConfig::merge6(SrvConfig& other) {
|
||||
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()) {
|
||||
|
@ -644,155 +644,6 @@ TEST_F(NetworkTest, getSiaddrNeverFail) {
|
||||
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user