From: Razvan Becheriu Date: Fri, 6 Aug 2021 13:53:17 +0000 (+0300) Subject: [#1930] do not mention reservations-out-of-pool when reservations-in-subnet is false X-Git-Tag: Kea-1.9.11~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d2b034e8249b15aea232bb5e06d7f679ae7e6fa;p=thirdparty%2Fkea.git [#1930] do not mention reservations-out-of-pool when reservations-in-subnet is false --- diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index 864c1eba19..76c4bdd1b3 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -731,6 +731,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "subnet4" levels. "reservations-out-of-pool": false, // List of client classes which must be evaluated when this shared @@ -1049,6 +1050,8 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "shared-networks" and + // "subnet4" levels. "reservations-out-of-pool": false, // Global compute T1 and T2 timers. diff --git a/doc/examples/kea4/global-reservations.json b/doc/examples/kea4/global-reservations.json index 1953fc7c4e..3efde9114d 100644 --- a/doc/examples/kea4/global-reservations.json +++ b/doc/examples/kea4/global-reservations.json @@ -51,7 +51,7 @@ // 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", +// "reservation-mode": "global", // It is replaced by the "reservations-global", "reservations-in-subnet" and // "reservations-out-of-pool" parameters. @@ -64,6 +64,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. +// If it is specified, it is inherited to "shared-networks" and "subnet4" levels. "reservations-out-of-pool": false, // Define several global host reservations. diff --git a/doc/examples/kea4/reservations.json b/doc/examples/kea4/reservations.json index 0b9437cac7..c264d3b644 100644 --- a/doc/examples/kea4/reservations.json +++ b/doc/examples/kea4/reservations.json @@ -81,6 +81,8 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "shared-networks" and + // "subnet4" levels. "reservations-out-of-pool": false, "reservations": [ diff --git a/doc/examples/kea4/shared-network.json b/doc/examples/kea4/shared-network.json index 3de7c9379e..54caeb5651 100644 --- a/doc/examples/kea4/shared-network.json +++ b/doc/examples/kea4/shared-network.json @@ -79,6 +79,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "subnet4" levels. "reservations-out-of-pool": false, // This starts a list of subnets allowed in this shared network. diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json index 694942af62..13ce667518 100644 --- a/doc/examples/kea6/all-keys.json +++ b/doc/examples/kea6/all-keys.json @@ -680,6 +680,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "subnet6" levels. "reservations-out-of-pool": false, // List of client classes which must be evaluated when this shared @@ -1018,6 +1019,8 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "shared-networks" and + // "subnet6" levels. "reservations-out-of-pool": false, // Data directory. diff --git a/doc/examples/kea6/global-reservations.json b/doc/examples/kea6/global-reservations.json index 6fdb0bee54..908bc84b22 100644 --- a/doc/examples/kea6/global-reservations.json +++ b/doc/examples/kea6/global-reservations.json @@ -40,7 +40,7 @@ // 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", +// "reservation-mode": "global", // It is replaced by the "reservations-global", "reservations-in-subnet" and // "reservations-out-of-pool" parameters. @@ -53,6 +53,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. +// If it is specified, it is inherited to "shared-networks" and "subnet6" levels. "reservations-out-of-pool": false, // Define several global host reservations. diff --git a/doc/examples/kea6/reservations.json b/doc/examples/kea6/reservations.json index e860e3ccb4..a4a30ce993 100644 --- a/doc/examples/kea6/reservations.json +++ b/doc/examples/kea6/reservations.json @@ -61,6 +61,8 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "shared-networks" and + // "subnet6" levels. "reservations-out-of-pool": false, "pools": [ { "pool": "2001:db8:1::/120" } ], diff --git a/doc/examples/kea6/shared-network.json b/doc/examples/kea6/shared-network.json index cbec7d321b..0b6e7b1eb1 100644 --- a/doc/examples/kea6/shared-network.json +++ b/doc/examples/kea6/shared-network.json @@ -84,6 +84,7 @@ // Specify if server can assume that all reserved addresses // are out-of-pool. // Ignored when reservations-in-subnet is false. + // If it is specified, it is inherited to "subnet6" levels. "reservations-out-of-pool": false, // List of subnets belonging to this particular shared-network diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index 7fad50fde1..c381861d60 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -4739,44 +4739,46 @@ following decision diagram may be useful: An example configuration that disables reservations looks as follows: -:: +.. code-block:: json - "Dhcp4": { - "subnet4": [ - { - "subnet": "192.0.2.0/24", - "reservation-mode": "disabled", - ... + { + "Dhcp4": { + "subnet4": [ + { + "subnet": "192.0.2.0/24", + "reservation-mode": "disabled", + "pools": [ { "pool": "192.0.2.10-192.0.2.100" } ] + } + ] } - ] } - An example configuration using global reservations is shown below: -:: - - "Dhcp4": { +.. code-block:: json + { + "Dhcp4": { - "reservation-mode": "global", - "reservations": [ - { - "hw-address": "01:bb:cc:dd:ee:ff", - "hostname": "host-one" - }, - { - "hw-address": "02:bb:cc:dd:ee:ff", - "hostname": "host-two" - } - ], + "reservation-mode": "global", + "reservations": [ + { + "hw-address": "01:bb:cc:dd:ee:ff", + "hostname": "host-one" + }, + { + "hw-address": "02:bb:cc:dd:ee:ff", + "hostname": "host-two" + } + ], - "subnet4": [ - { - "subnet": "192.0.2.0/24", - ... + "subnet4": [ + { + "subnet": "192.0.2.0/24", + "pools": [ { "pool": "192.0.2.10-192.0.2.100" } ] + } + ] } - ] } The meaning of the reservation flags are: @@ -4802,74 +4804,79 @@ The correspondence of old values are: ``disabled``: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": false, - "reservations-in-subnet": false, - ... + "reservations-global": false, + "reservations-in-subnet": false + } } ``global``: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": true, - "reservations-in-subnet": false, - "reservations-out-of-pool": false, - ... + "reservations-global": true, + "reservations-in-subnet": false + } } ``out-of-pool``: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": false, - "reservations-in-subnet": true, - "reservations-out-of-pool": true, - ... + "reservations-global": false, + "reservations-in-subnet": true, + "reservations-out-of-pool": true + } } ``all``: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": false, - "reservations-in-subnet": true, - "reservations-out-of-pool": false, - ... + "reservations-global": false, + "reservations-in-subnet": true, + "reservations-out-of-pool": false + } } To activate both ``global`` and ``all``, the following combination can be used: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": true, - "reservations-in-subnet": true, - "reservations-out-of-pool": false, - ... + "reservations-global": true, + "reservations-in-subnet": true, + "reservations-out-of-pool": false + } } To activate both ``global`` and ``out-of-pool``, the following combination can be used: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": true, - "reservations-in-subnet": true, - "reservations-out-of-pool": true, - ... + "reservations-global": true, + "reservations-in-subnet": true, + "reservations-out-of-pool": true + } } Note that enabling ``out-of-pool`` and disabling ``in-subnet`` at the same time @@ -4881,45 +4888,47 @@ levels. An example configuration that disables reservations looks as follows: -:: +.. code-block:: json - "Dhcp4": { - "subnet4": [ - { - "subnet": "192.0.2.0/24", - "reservations-global": false, - "reservations-in-subnet": false, - ... + { + "Dhcp4": { + "subnet4": [ + { + "subnet": "192.0.2.0/24", + "reservations-global": false, + "reservations-in-subnet": false + } + ] } - ] } - An example configuration using global reservations is shown below: -:: +.. code-block:: json - "Dhcp4": { + { + "Dhcp4": { - "reservations-global": true, - "reservations-in-subnet": false, - "reservations": [ - { - "hw-address": "01:bb:cc:dd:ee:ff", - "hostname": "host-one" - }, - { - "hw-address": "02:bb:cc:dd:ee:ff", - "hostname": "host-two" - } - ], + "reservations-global": true, + "reservations-in-subnet": false, + "reservations": [ + { + "hw-address": "01:bb:cc:dd:ee:ff", + "hostname": "host-one" + }, + { + "hw-address": "02:bb:cc:dd:ee:ff", + "hostname": "host-two" + } + ], - "subnet4": [ - { - "subnet": "192.0.2.0/24", - ... + "subnet4": [ + { + "subnet": "192.0.2.0/24", + "pools": [ { "pool": "192.0.2.10-192.0.2.100" } ] + } + ] } - ] } For more details regarding global reservations, see :ref:`global-reservations4`. @@ -5036,8 +5045,9 @@ following can be used: # Specify if the server should lookup in-subnet reservations. "reservations-in-subnet": false, # Specify if the server can assume that all reserved addresses - # are out-of-pool. - "reservations-out-of-pool": false, + # are out-of-pool. It can be ignored because "reservations-in-subnet" + # is false. + # "reservations-out-of-pool": false, "pools": [ { "pool": "10.0.0.10-10.0.0.100" } ] } ] } @@ -5147,8 +5157,10 @@ following example: # Specify if the server should lookup in-subnet reservations. "reservations-in-subnet": false, # Specify if the server can assume that all reserved addresses - # are out-of-pool. - "reservations-out-of-pool": false, + # are out-of-pool. It can be ignored because "reservations-in-subnet" + # is false, but if it is specified, it is inherited to "shared-networks" + # and "subnet4" levels. + # "reservations-out-of-pool": false, "shared-networks": [{ "subnet4": [ { diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index 04c8b20e14..e40ad13995 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -4155,44 +4155,46 @@ following decision diagram may be useful: An example configuration that disables reservations looks as follows: -:: +.. code-block:: json - "Dhcp6": { - "subnet6": [ - { - "subnet": "2001:db8:1::/64", - "reservation-mode": "disabled", - ... + { + "Dhcp6": { + "subnet6": [ + { + "subnet": "2001:db8:1::/64", + "reservation-mode": "disabled", + "pools": [ { "pool": "2001:db8:1::-2001:db8:1::100" } ] + } + ] } - ] } - An example configuration using global reservations is shown below: -:: - - "Dhcp6": { +.. code-block:: json + { + "Dhcp6": { - "reservation-mode": "global", - "reservations": [ - { - "duid": "00:03:00:01:11:22:33:44:55:66", - "hostname": "host-one" - }, - { - "duid": "00:03:00:01:99:88:77:66:55:44", - "hostname": "host-two" - } - ], + "reservation-mode": "global", + "reservations": [ + { + "duid": "00:03:00:01:11:22:33:44:55:66", + "hostname": "host-one" + }, + { + "duid": "00:03:00:01:99:88:77:66:55:44", + "hostname": "host-two" + } + ], - "subnet6": [ - { - "subnet": "2001:db8:1::/64", - ... + "subnet6": [ + { + "subnet": "2001:db8:1::/64", + "pools": [ { "pool": "2001:db8:1::-2001:db8:1::100" } ] + } + ] } - ] } The meaning of the reservation flags are: @@ -4218,74 +4220,79 @@ The correspondence of old values are: ``disabled``: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": false, - "reservations-in-subnet": false, - ... + "reservations-global": false, + "reservations-in-subnet": false + } } ``global``: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": true, - "reservations-in-subnet": false, - "reservations-out-of-pool": false, - ... + "reservations-global": true, + "reservations-in-subnet": false + } } ``out-of-pool``: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": false, - "reservations-in-subnet": true, - "reservations-out-of-pool": true, - ... + "reservations-global": false, + "reservations-in-subnet": true, + "reservations-out-of-pool": true + } } ``all``: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": false, - "reservations-in-subnet": true, - "reservations-out-of-pool": false, - ... + "reservations-global": false, + "reservations-in-subnet": true, + "reservations-out-of-pool": false + } } To activate both ``global`` and ``all``, the following combination can be used: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": true, - "reservations-in-subnet": true, - "reservations-out-of-pool": false, - ... + "reservations-global": true, + "reservations-in-subnet": true, + "reservations-out-of-pool": false + } } To activate both ``global`` and ``out-of-pool``, the following combination can be used: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": true, - "reservations-in-subnet": true, - "reservations-out-of-pool": true, - ... + "reservations-global": true, + "reservations-in-subnet": true, + "reservations-out-of-pool": true + } } Note that enabling ``out-of-pool`` and disabling ``in-subnet`` at the same time @@ -4297,45 +4304,47 @@ levels. An example configuration that disables reservations looks as follows: -:: +.. code-block:: json - "Dhcp6": { - "subnet6": [ - { - "subnet": "2001:db8:1::/64", - "reservations-global": false, - "reservations-in-subnet": false, - ... + { + "Dhcp6": { + "subnet6": [ + { + "subnet": "2001:db8:1::/64", + "reservations-global": false, + "reservations-in-subnet": false + } + ] } - ] } - An example configuration using global reservations is shown below: -:: +.. code-block:: json - "Dhcp6": { + { + "Dhcp6": { - "reservations-global": true, - "reservations-in-subnet": false, - "reservations": [ - { - "duid": "00:03:00:01:11:22:33:44:55:66", - "hostname": "host-one" - }, - { - "duid": "00:03:00:01:99:88:77:66:55:44", - "hostname": "host-two" - } - ], + "reservations-global": true, + "reservations-in-subnet": false, + "reservations": [ + { + "duid": "00:03:00:01:11:22:33:44:55:66", + "hostname": "host-one" + }, + { + "duid": "00:03:00:01:99:88:77:66:55:44", + "hostname": "host-two" + } + ], - "subnet6": [ - { - "subnet": "2001:db8:1::/64", - ... + "subnet6": [ + { + "subnet": "2001:db8:1::/64", + "pools": [ { "pool": "2001:db8:1::-2001:db8:1::100" } ] + } + ] } - ] } For more details regarding global reservations, see :ref:`global-reservations6`. @@ -4448,8 +4457,9 @@ following can be used: # Specify if the server should lookup in-subnet reservations. "reservations-in-subnet": false, # Specify if the server can assume that all reserved addresses - # are out-of-pool. - "reservations-out-of-pool": false, + # are out-of-pool. It can be ignored because "reservations-in-subnet" + # is false. + # "reservations-out-of-pool": false, "pools": [ { "pool": "2001:db8:1::-2001:db8:1::100" } ] } ] } @@ -4559,8 +4569,10 @@ following example: # Specify if the server should lookup in-subnet reservations. "reservations-in-subnet": false, # Specify if the server can assume that all reserved addresses - # are out-of-pool. - "reservations-out-of-pool": false, + # are out-of-pool. It can be ignored because "reservations-in-subnet" + # is false, but if it is specified, it is inherited to "shared-networks" + # and "subnet6" levels. + # "reservations-out-of-pool": false, "shared-networks": [{ "subnet6": [ { diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 376f540ab5..da9fb9ee9d 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -6461,8 +6461,7 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { " \"ip-address\": \"5.6.7.8\"\n" " },\n" " \"reservations-global\": false,\n" - " \"reservations-in-subnet\": true,\n" - " \"reservations-out-of-pool\": true,\n" + " \"reservations-in-subnet\": false,\n" " \"renew-timer\": 10,\n" " \"rebind-timer\": 20,\n" " \"valid-lifetime\": 40,\n" @@ -6489,8 +6488,8 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { " \"ip-address\": \"55.66.77.88\"\n" " },\n" " \"reservations-global\": false,\n" - " \"reservations-in-subnet\": false,\n" - " \"reservations-out-of-pool\": false\n" + " \"reservations-in-subnet\": true,\n" + " \"reservations-out-of-pool\": true\n" " }\n" " ]\n" " },\n" @@ -6542,8 +6541,8 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { EXPECT_EQ("bar", s->getFilename().get()); EXPECT_TRUE(s->hasRelayAddress(IOAddress("5.6.7.8"))); EXPECT_FALSE(s->getReservationsGlobal()); - EXPECT_TRUE(s->getReservationsInSubnet()); - EXPECT_TRUE(s->getReservationsOutOfPool()); + EXPECT_FALSE(s->getReservationsInSubnet()); + EXPECT_FALSE(s->getReservationsOutOfPool()); // For the second subnet, the renew-timer should be 100, because it // was specified explicitly. Other parameters a derived @@ -6561,8 +6560,8 @@ TEST_F(Dhcp4ParserTest, sharedNetworksDerive) { EXPECT_EQ("bootfile.efi", s->getFilename().get()); EXPECT_TRUE(s->hasRelayAddress(IOAddress("55.66.77.88"))); EXPECT_FALSE(s->getReservationsGlobal()); - EXPECT_FALSE(s->getReservationsInSubnet()); - EXPECT_FALSE(s->getReservationsOutOfPool()); + EXPECT_TRUE(s->getReservationsInSubnet()); + EXPECT_TRUE(s->getReservationsOutOfPool()); // Ok, now check the second shared subnet. net = nets->at(1);