]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1405] ignore out of pool if in subnet is disabled
authorRazvan Becheriu <razvan@isc.org>
Mon, 16 Nov 2020 14:00:18 +0000 (16:00 +0200)
committerRazvan Becheriu <razvan@isc.org>
Wed, 18 Nov 2020 13:55:24 +0000 (15:55 +0200)
20 files changed:
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
src/bin/admin/tests/mysql_tests.sh.in
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/dora_unittest.cc
src/bin/dhcp4/tests/host_unittest.cc
src/bin/dhcp6/json_config_parser.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/host_unittest.cc
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp6_unittest.cc
src/lib/dhcpsrv/alloc_engine.cc
src/lib/dhcpsrv/parsers/base_network_parser.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/tests/network_unittest.cc
src/share/api/network4-get.json
src/share/api/network6-get.json
src/share/database/scripts/mysql/upgrade_9.4_to_9.5.sh.in

index 1fcd8c0fa5e0425d1248cf1f688c904536c7de5d..889907c655ac3b6c9bbe3e905077d49b845f7ea4 100644 (file)
@@ -4662,7 +4662,6 @@ The correspondence of old values are:
 
        "reservations-global": false,
        "reservations-in-subnet": false,
-       "reservations-out-of-pool": false,
        ...
    }
 
@@ -4735,19 +4734,20 @@ configuration, as ``out-of-pool`` are also ``in-subnet``.
    "Dhcp4": {
 
        "reservations-global": true,
-       // "reservations-in-subnet": false, <-config error
+       // "reservations-in-subnet": false,
        "reservations-out-of-pool": true,
        ...
    }
 
 
-For this reason, the ``in-subnet`` can be omitted when ``out-of-pool`` is set.
+For this reason, the ``in-subnet`` can not be omitted when ``out-of-pool`` is set.
 
 ::
 
    "Dhcp4": {
 
        "reservations-global": true,
+       "reservations-in-subnet": true,
        "reservations-out-of-pool": true,
        ...
    }
@@ -4765,7 +4765,6 @@ An example configuration that disables reservations looks as follows:
            "subnet": "192.0.2.0/24",
            "reservations-global": false,
            "reservations-in-subnet": false,
-           "reservations-out-of-pool": false,
            ...
        }
        ]
@@ -4780,7 +4779,6 @@ An example configuration using global reservations is shown below:
 
        "reservations-global": true,
        "reservations-in-subnet": false,
-       "reservations-out-of-pool": false,
        "reservations": [
           {
            "hw-address": "01:bb:cc:dd:ee:ff",
index 285478912f40006e07d35bb041fbe4ba3f5f80b5..30492c2dd4dd07479930bb1316ed57a1a618ebff 100644 (file)
@@ -4107,7 +4107,6 @@ The correspondence of old values are:
 
        "reservations-global": false,
        "reservations-in-subnet": false,
-       "reservations-out-of-pool": false,
        ...
    }
 
@@ -4180,19 +4179,20 @@ configuration, as ``out-of-pool`` are also ``in-subnet``.
    "Dhcp6": {
 
        "reservations-global": true,
-       // "reservations-in-subnet": false, <-config error
+       // "reservations-in-subnet": false,
        "reservations-out-of-pool": true,
        ...
    }
 
 
-For this reason, the ``in-subnet`` can be omitted when ``out-of-pool`` is set.
+For this reason, the ``in-subnet`` can not be omitted when ``out-of-pool`` is set.
 
 ::
 
    "Dhcp6": {
 
        "reservations-global": true,
+       "reservations-in-subnet": true,
        "reservations-out-of-pool": true,
        ...
    }
@@ -4210,7 +4210,6 @@ An example configuration that disables reservations looks as follows:
            "subnet": "2001:db8:1::/64",
            "reservations-global": false,
            "reservations-in-subnet": false,
-           "reservations-out-of-pool": false,
            ...
        }
        ]
@@ -4225,7 +4224,6 @@ An example configuration using global reservations is shown below:
 
        "reservations-global": true,
        "reservations-in-subnet": false,
-       "reservations-out-of-pool": false,
        "reservations": [
           {
            "duid": "00:03:00:01:11:22:33:44:55:66",
index daa965532a778a354d7b59c000fc589bb5066618..98ce622c790a2db81160668feb6187a0bde929a0 100644 (file)
@@ -1468,64 +1468,64 @@ mysql_reservation_mode_upgrade_test() {
     # Upgrade to schema 9.5.
     mysql_upgrade_schema_to_version 9.5
 
-    # Test DISABLED (0) -> false, false, false
-    qry="select count(id) from dhcp4_shared_network where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool = false and name = 'test0';"
+    # Test DISABLED (0) -> false, false, null
+    qry="select count(id) from dhcp4_shared_network where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool is null and name = 'test0';"
     run_statement "#4_shared_disabled" "$qry" 1
 
     # Test OUT_OF_POOL (1) -> false, true, true
     qry="select count(id) from dhcp4_shared_network where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = true and name = 'test1';"
     run_statement "#4_shared_out_of_pool" "$qry" 1
 
-    # Test GLOBAL (2) -> true, false, false
-    qry="select count(id) from dhcp4_shared_network where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool = false and name = 'test2';"
+    # Test GLOBAL (2) -> true, false, null
+    qry="select count(id) from dhcp4_shared_network where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool is null and name = 'test2';"
     run_statement "#4_shared_global" "$qry" 1
 
     # Test ALL (3) -> false, true, false
     qry="select count(id) from dhcp4_shared_network where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = false and name = 'test3';"
     run_statement "#4_shared_all" "$qry" 1
 
-    # Test DISABLED (0) -> false, false, false
-    qry="select count(subnet_id) from dhcp4_subnet where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool = false and subnet_prefix = '192.0.0.0/24'"
+    # Test DISABLED (0) -> false, false, null
+    qry="select count(subnet_id) from dhcp4_subnet where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool is null and subnet_prefix = '192.0.0.0/24'"
     run_statement "#4_subnet_disabled" "$qry" 1
 
     # Test OUT_OF_POOL (1) -> false, true, true
     qry="select count(subnet_id) from dhcp4_subnet where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = true and subnet_prefix = '192.0.1.0/24'"
     run_statement "#4_subnet_out_of_pool" "$qry" 1
 
-    # Test GLOBAL (2) -> true, false, false
-    qry="select count(subnet_id) from dhcp4_subnet where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool = false and subnet_prefix = '192.0.2.0/24'"
+    # Test GLOBAL (2) -> true, false, null
+    qry="select count(subnet_id) from dhcp4_subnet where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool is null and subnet_prefix = '192.0.2.0/24'"
     run_statement "#4_subnet_global" "$qry" 1
 
     # Test ALL (3) -> false, true, false
     qry="select count(subnet_id) from dhcp4_subnet where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = false and subnet_prefix = '192.0.3.0/24'"
     run_statement "#4_subnet_all" "$qry" 1
 
-    # Test DISABLED (0) -> false, false, false
-    qry="select count(id) from dhcp6_shared_network where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool = false and name = 'test0';"
+    # Test DISABLED (0) -> false, false, null
+    qry="select count(id) from dhcp6_shared_network where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool is null and name = 'test0';"
     run_statement "#6_shared_disabled" "$qry" 1
 
     # Test OUT_OF_POOL (1) -> false, true, true
     qry="select count(id) from dhcp6_shared_network where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = true and name = 'test1';"
     run_statement "#6_shared_out_of_pool" "$qry" 1
 
-    # Test GLOBAL (2) -> true, false, false
-    qry="select count(id) from dhcp6_shared_network where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool = false and name = 'test2';"
+    # Test GLOBAL (2) -> true, false, null
+    qry="select count(id) from dhcp6_shared_network where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool is null and name = 'test2';"
     run_statement "#6_shared_global" "$qry" 1
 
     # Test ALL (3) -> false, true, false
     qry="select count(id) from dhcp6_shared_network where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = false and name = 'test3';"
     run_statement "#6_shared_all" "$qry" 1
 
-    # Test DISABLED (0) -> false, false, false
-    qry="select count(subnet_id) from dhcp6_subnet where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool = false and subnet_prefix = '2001:db8::/64'"
+    # Test DISABLED (0) -> false, false, null
+    qry="select count(subnet_id) from dhcp6_subnet where reservations_global = false and reservations_in_subnet = false and reservations_out_of_pool is null and subnet_prefix = '2001:db8::/64'"
     run_statement "#6_subnet_disabled" "$qry" 1
 
     # Test OUT_OF_POOL (1) -> false, true, true
     qry="select count(subnet_id) from dhcp6_subnet where reservations_global = false and reservations_in_subnet = true and reservations_out_of_pool = true and subnet_prefix = '2001:db8:1::/64'"
     run_statement "#6_subnet_out_of_pool" "$qry" 1
 
-    # Test GLOBAL (2) -> true, false, false
-    qry="select count(subnet_id) from dhcp6_subnet where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool = false and subnet_prefix = '2001:db8:2::/64'"
+    # Test GLOBAL (2) -> true, false, null
+    qry="select count(subnet_id) from dhcp6_subnet where reservations_global = true and reservations_in_subnet = false and reservations_out_of_pool is null and subnet_prefix = '2001:db8:2::/64'"
     run_statement "#6_subnet_global" "$qry" 1
 
     # Test ALL (3) -> false, true, false
index 56d64fe47710eef6f80ca9b97b4def4267c70a5e..e1868877d67441951f922d0b8f95260eea274605 100644 (file)
@@ -181,8 +181,7 @@ Dhcpv4Exchange::Dhcpv4Exchange(const AllocEnginePtr& alloc_engine,
 
         // Find static reservations if not disabled for our subnet.
         if (subnet->getReservationsGlobal() ||
-            subnet->getReservationsInSubnet() ||
-            subnet->getReservationsOutOfPool()) {
+            subnet->getReservationsInSubnet()) {
             // Before we can check for static reservations, we need to prepare a set
             // of identifiers to be used for this.
             setHostIdentifiers();
index d46cb63523985fd3585fca86cecdbf5ce3f1ca97..1d65cb00f2361bffb1a0fea44eb5824ff4eb5fcf 100644 (file)
@@ -375,7 +375,8 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set,
 
         // Move from reservation mode to new reservations flags.
         if (BaseNetworkParser::moveReservationMode(mutable_cfg)) {
-            LOG_WARN(dhcp4_logger, DHCP4_DEPRECATED_RESERVATION_MODE);
+            // @todo enable warning
+            // LOG_WARN(dhcp4_logger, DHCP4_DEPRECATED_RESERVATION_MODE);
         }
 
         // Set all default values if not specified by the user.
index 79239c5178849c2a091c11b364d15ab6a9da2984..f12aa45ae7aee2f4bd81c6f031d45fce018a9f28 100644 (file)
@@ -5316,15 +5316,13 @@ TEST_F(Dhcp4ParserTest, hostReservationPerSubnet) {
         "    \"pools\": [ { \"pool\": \"192.0.3.0/24\" } ],"
         "    \"subnet\": \"192.0.3.0/24\", "
         "    \"reservations-global\": false,"
-        "    \"reservations-in-subnet\": false,"
-        "    \"reservations-out-of-pool\": false"
+        "    \"reservations-in-subnet\": false"
         " },"
         " {"
         "    \"pools\": [ { \"pool\": \"192.0.4.0/24\" } ],"
         "    \"subnet\": \"192.0.4.0/24\", "
         "    \"reservations-global\": true,"
-        "    \"reservations-in-subnet\": false,"
-        "    \"reservations-out-of-pool\": false"
+        "    \"reservations-in-subnet\": false"
         " },"
         " {"
         "    \"pools\": [ { \"pool\": \"192.0.5.0/24\" } ],"
index b380032ed58c762ee738c529d9cc2b006f1d0fb9..3ea2529a98449e5a09a5cc66b2d56095338cc80c 100644 (file)
@@ -481,7 +481,6 @@ const char* DORA_CONFIGS[] = {
         "    \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ],"
         "    \"reservations-global\": false,"
         "    \"reservations-in-subnet\": false,"
-        "    \"reservations-out-of-pool\": false,"
         "    \"reservations\": [ "
         "       {"
         "         \"hw-address\": \"aa:bb:cc:dd:ee:ff\","
index 55d8c6e5791f86b9fe9cb45aab70fef3d7cf2a6a..6502f68fa2f1fe7b8ed9bdfaa9557619d08307e6 100644 (file)
@@ -69,7 +69,6 @@ const char* CONFIGS[] = {
         "    \"subnet\": \"10.0.0.0/24\",\n"
         "    \"reservations-global\": true,\n"
         "    \"reservations-in-subnet\": false,\n"
-        "    \"reservations-out-of-pool\": false,\n"
         "    \"pools\": [ { \"pool\": \"10.0.0.10-10.0.0.100\" } ]\n"
         "} ]\n"
     "}\n"
@@ -107,7 +106,6 @@ const char* CONFIGS[] = {
         "        \"interface\": \"eth1\",\n"
         "        \"reservations-global\": true,\n"
         "        \"reservations-in-subnet\": false,\n"
-        "        \"reservations-out-of-pool\": false,\n"
         "        \"reservations\": [ \n"
         "        {\n"
         "           \"hw-address\": \"aa:bb:cc:dd:ee:ff\",\n"
@@ -194,7 +192,6 @@ const char* CONFIGS[] = {
         "],\n"
         "\"reservations-global\": true,\n"
         "\"reservations-in-subnet\": false,\n"
-        "\"reservations-out-of-pool\": false,\n"
         "\"valid-lifetime\": 600,\n"
         "\"reservations\": [ \n"
         "{\n"
@@ -247,7 +244,6 @@ const char* CONFIGS[] = {
         "],\n"
         "\"reservations-global\": true,\n"
         "\"reservations-in-subnet\": false,\n"
-        "\"reservations-out-of-pool\": false,\n"
         "\"valid-lifetime\": 600,\n"
         "\"reservations\": [ \n"
         "{\n"
index 18f5eda151aaeb92b4fc5420cf30609e7e8b25d2..50d77181405f82334e5724a1351671385539f231 100644 (file)
@@ -476,7 +476,8 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set,
 
         // Move from reservation mode to new reservations flags.
         if (BaseNetworkParser::moveReservationMode(mutable_cfg)) {
-            LOG_WARN(dhcp6_logger, DHCP6_DEPRECATED_RESERVATION_MODE);
+            // @todo enable warning
+            // LOG_WARN(dhcp6_logger, DHCP6_DEPRECATED_RESERVATION_MODE);
         }
 
         // Set all default values if not specified by the user.
index bfe1fc2ab9b692e662d3780289656d8cc5501568..538e5a2be56340fd96dd3bfb117e0659ae89b695 100644 (file)
@@ -5686,15 +5686,13 @@ TEST_F(Dhcp6ParserTest, hostReservationPerSubnet) {
         "    \"pools\": [ { \"pool\": \"2001:db8:3::/64\" } ],"
         "    \"subnet\": \"2001:db8:3::/48\", "
         "    \"reservations-global\": false,"
-        "    \"reservations-in-subnet\": false,"
-        "    \"reservations-out-of-pool\": false"
+        "    \"reservations-in-subnet\": false"
         " },"
         " {"
         "    \"pools\": [ { \"pool\": \"2001:db8:4::/64\" } ],"
         "    \"subnet\": \"2001:db8:4::/48\", "
         "    \"reservations-global\": true,"
-        "    \"reservations-in-subnet\": false,"
-        "    \"reservations-out-of-pool\": false"
+        "    \"reservations-in-subnet\": false"
         " },"
         " {"
         "    \"pools\": [ { \"pool\": \"2001:db8:5::/64\" } ],"
@@ -6773,7 +6771,6 @@ TEST_F(Dhcp6ParserTest, sharedNetworksDerive) {
         "    \"rapid-commit\": true,\n"
         "    \"reservations-global\": false,\n"
         "    \"reservations-in-subnet\": false,\n"
-        "    \"reservations-out-of-pool\": false,\n"
         "    \"subnet6\": [\n"
         "    { \n"
         "        \"subnet\": \"2001:db1::/48\",\n"
index 43b5a9b41155682f442543f0190cd8d56a73bae2..c60a05fb8319ff4a5da6ff543e16d9c3e70690c7 100644 (file)
@@ -356,8 +356,7 @@ const char* CONFIGS[] = {
         "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ], \n"
         "    \"interface\" : \"eth0\", \n"
         "    \"reservations-global\": true, \n"
-        "    \"reservations-in-subnet\": false, \n"
-        "    \"reservations-out-of-pool\": false \n"
+        "    \"reservations-in-subnet\": false \n"
         " },"
         " {  \n"
         "    \"id\": 2, \n"
@@ -402,7 +401,6 @@ const char* CONFIGS[] = {
         "    \"interface\" : \"eth0\", \n"
         "    \"reservations-global\": true, \n"
         "    \"reservations-in-subnet\": false, \n"
-        "    \"reservations-out-of-pool\": false, \n"
         "    \"pd-pools\": [ \n"
         "    { \n"
         "       \"prefix\": \"3000::\", \n"
@@ -446,7 +444,6 @@ const char* CONFIGS[] = {
         "],\n"
         "\"reservations-global\": true,\n"
         "\"reservations-in-subnet\": false,\n"
-        "\"reservations-out-of-pool\": false,\n"
         "\"valid-lifetime\": 4000,\n"
         "\"reservations\": [ \n"
         "{\n"
@@ -500,7 +497,6 @@ const char* CONFIGS[] = {
         "],\n"
         "\"reservations-global\": true,\n"
         "\"reservations-in-subnet\": false,\n"
-        "\"reservations-out-of-pool\": false,\n"
         "\"valid-lifetime\": 4000,\n"
         "\"reservations\": [ \n"
         "{\n"
index 4a2feb7cbfc466101d6c47aebb33d5d361be42c5..43da6cef8c4920ecd7424d811552d011a55ea4c6 100644 (file)
@@ -163,7 +163,6 @@ public:
         subnet->requireClientClass("required-class2");
         subnet->setReservationsGlobal(false);
         subnet->setReservationsInSubnet(false);
-        subnet->setReservationsOutOfPool(false);
         subnet->setSname("server-hostname");
         subnet->setContext(user_context);
         subnet->setValid(555555);
@@ -264,7 +263,6 @@ public:
         shared_network->requireClientClass("required-class2");
         shared_network->setReservationsGlobal(false);
         shared_network->setReservationsInSubnet(false);
-        shared_network->setReservationsOutOfPool(false);
         shared_network->setContext(user_context);
         shared_network->setValid(5555);
         shared_network->setCalculateTeeTimes(true);
index 4c34d4f4dfb5b543962f04a975b74ddf14839e90..1ce871302bab149e8ff8d153c0a6e04e4bd01e35 100644 (file)
@@ -159,7 +159,6 @@ public:
         subnet->requireClientClass("required-class2");
         subnet->setReservationsGlobal(false);
         subnet->setReservationsInSubnet(false);
-        subnet->setReservationsOutOfPool(false);
         subnet->setContext(user_context);
         subnet->setValid(555555);
         subnet->setPreferred(4444444);
@@ -311,7 +310,6 @@ public:
         shared_network->requireClientClass("required-class2");
         shared_network->setReservationsGlobal(false);
         shared_network->setReservationsInSubnet(false);
-        shared_network->setReservationsOutOfPool(false);
         shared_network->setContext(user_context);
         shared_network->setValid(5555);
         shared_network->setPreferred(4444);
index c769a9dc3ad97743cca3b95c770eca8c285b2b2a..f869a3d4b951782bc3bf8f4d19e3e28dc3284239 100644 (file)
@@ -535,8 +535,7 @@ isAllocated(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const {
 ConstHostPtr
 AllocEngine::ClientContext6::currentHost() const {
     Subnet6Ptr subnet = host_subnet_ ? host_subnet_ : subnet_;
-    if (subnet && (subnet->getReservationsInSubnet() ||
-        subnet->getReservationsOutOfPool())) {
+    if (subnet && subnet->getReservationsInSubnet()) {
         auto host = hosts_.find(subnet->getID());
         if (host != hosts_.cend()) {
             return (host->second);
@@ -604,8 +603,7 @@ AllocEngine::findReservation(ClientContext6& ctx) {
             ctx.hosts_[SUBNET_ID_GLOBAL] = ghost;
 
             // If we had only to fetch global reservations it is done.
-            if (!subnet->getReservationsInSubnet() &&
-                !subnet->getReservationsOutOfPool()) {
+            if (!subnet->getReservationsInSubnet()) {
                 return;
             }
         }
@@ -644,7 +642,7 @@ AllocEngine::findReservation(ClientContext6& ctx) {
         // Only makes sense to get reservations if the client has access
         // to the class and host reservations are enabled for this subnet.
         if (subnet->clientSupported(ctx.query_->getClasses()) &&
-            (subnet->getReservationsInSubnet() || subnet->getReservationsOutOfPool())) {
+            subnet->getReservationsInSubnet()) {
             // Iterate over configured identifiers in the order of preference
             // and try to use each of them to search for the reservations.
             for (auto id_pair : ctx.host_identifiers_) {
@@ -1483,8 +1481,7 @@ AllocEngine::removeNonmatchingReservedLeases6(ClientContext6& ctx,
     // If host reservation is disabled (so there are no reserved leases)
     // use the simplified version.
     if (!ctx.subnet_->getReservationsGlobal() &&
-        !ctx.subnet_->getReservationsInSubnet() &&
-        !ctx.subnet_->getReservationsOutOfPool()) {
+        !ctx.subnet_->getReservationsInSubnet()) {
         removeNonmatchingReservedNoHostLeases6(ctx, existing_leases);
         return;
     }
@@ -3046,8 +3043,7 @@ hasAddressReservation(AllocEngine::ClientContext4& ctx) {
                     !(host->second->getIPv4Reservation().isV4Zero()));
             // if we want global + other modes we would need to
             // return only if true, else continue
-            if (!subnet->getReservationsInSubnet() &&
-                !subnet->getReservationsOutOfPool()) {
+            if (!subnet->getReservationsInSubnet()) {
                 return (found);
             } else {
                 if (found) {
@@ -3243,8 +3239,7 @@ AllocEngine::ClientContext4::ClientContext4(const Subnet4Ptr& subnet,
 
 ConstHostPtr
 AllocEngine::ClientContext4::currentHost() const {
-    if (subnet_ && (subnet_->getReservationsInSubnet() ||
-        subnet_->getReservationsOutOfPool())) {
+    if (subnet_ && subnet_->getReservationsInSubnet()) {
         auto host = hosts_.find(subnet_->getID());
         if (host != hosts_.cend()) {
             return (host->second);
@@ -3349,8 +3344,7 @@ AllocEngine::findReservation(ClientContext4& ctx) {
             ctx.hosts_[SUBNET_ID_GLOBAL] = ghost;
 
             // If we had only to fetch global reservations it is done.
-            if (!subnet->getReservationsInSubnet() &&
-                !subnet->getReservationsOutOfPool()) {
+            if (!subnet->getReservationsInSubnet()) {
                 return;
             }
         }
@@ -3391,7 +3385,7 @@ AllocEngine::findReservation(ClientContext4& ctx) {
         // Only makes sense to get reservations if the client has access
         // to the class.
         if (subnet->clientSupported(ctx.query_->getClasses()) &&
-            (subnet->getReservationsInSubnet() || subnet->getReservationsOutOfPool())) {
+            subnet->getReservationsInSubnet()) {
             // Iterate over configured identifiers in the order of preference
             // and try to use each of them to search for the reservations.
             BOOST_FOREACH(const IdentifierPair& id_pair, ctx.host_identifiers_) {
index baad63e8980d314f0b8fd6bda48bd9f63484f75c..da165eaddb5e17e92e0503f52c5be6b308a30b55 100644 (file)
@@ -32,7 +32,6 @@ BaseNetworkParser::moveReservationMode(ElementPtr config) {
     if ((hr_mode == "disabled") || (hr_mode == "off")) {
         config->set("reservations-global", Element::create(false));
         config->set("reservations-in-subnet", Element::create(false));
-        config->set("reservations-out-of-pool", 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));
@@ -40,7 +39,6 @@ BaseNetworkParser::moveReservationMode(ElementPtr config) {
     } else if (hr_mode == "global") {
         config->set("reservations-global", Element::create(true));
         config->set("reservations-in-subnet", Element::create(false));
-        config->set("reservations-out-of-pool", Element::create(false));
     } else if (hr_mode == "all") {
         config->set("reservations-global", Element::create(false));
         config->set("reservations-in-subnet", Element::create(true));
index 96976378b2e9a0e163fc75a2470cc642a9e4f8a8..94467deadf8b146592b182a5ab0ba0b318337037 100644 (file)
@@ -747,7 +747,8 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params,
     ElementPtr mutable_params;
     mutable_params = boost::const_pointer_cast<Element>(params);
     if (BaseNetworkParser::moveReservationMode(mutable_params)) {
-        LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE);
+        // @todo enable warning
+        // LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE);
     }
 
     // Parse parameters common to all Network derivations.
@@ -1245,7 +1246,8 @@ Subnet6ConfigParser::initSubnet(data::ConstElementPtr params,
     ElementPtr mutable_params;
     mutable_params = boost::const_pointer_cast<Element>(params);
     if (BaseNetworkParser::moveReservationMode(mutable_params)) {
-        LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE);
+        // @todo enable warning
+        // LOG_WARN(dhcpsrv_logger, DHCPSRV_DEPRECATED_RESERVATION_MODE);
     }
 
     // Parse parameters common to all Network derivations.
index 7a3d89beff0a65c59a6c27bbfe1b3e9d62b0c0d9..ce8d4cf37e22c9b808eb07542252e0ff7ad38628 100644 (file)
@@ -685,8 +685,7 @@ TEST_F(NetworkReservationTest, move) {
         "}";
     expected = "{"
         " \"reservations-global\": false,"
-        " \"reservations-in-subnet\": false,"
-        " \"reservations-out-of-pool\": false"
+        " \"reservations-in-subnet\": false"
         " }";
     TestMove(config, expected);
 
@@ -712,8 +711,7 @@ TEST_F(NetworkReservationTest, move) {
         "}";
     expected = "{"
         " \"reservations-global\": true,"
-        " \"reservations-in-subnet\": false,"
-        " \"reservations-out-of-pool\": false"
+        " \"reservations-in-subnet\": false"
         " }";
     TestMove(config, expected);
 
index 97548b941d6285ca0eadd52f0a5ce3431445502b..670317048e95733ea76b67c12a718178eecbb175 100644 (file)
@@ -33,7 +33,6 @@
         "                \"ip-address\": \"0.0.0.0\"",
         "            },",
         "            \"renew-timer\": 60,",
-        "            \"reservation-mode\": \"all\",",
         "            \"subnet4\": [",
         "                {",
         "                    \"subnet\": \"192.0.2.0/24\",",
index 87a2045cbe2953418cfc5b99c806304e3ab94387..c24f0b519b7d522b1e4b0a246df272cf3621ee80 100644 (file)
@@ -33,7 +33,6 @@
         "                \"ip-address\": \"0.0.0.0\"",
         "            },",
         "            \"renew-timer\": 60,",
-        "            \"reservation-mode\": \"all\",",
         "            \"subnet4\": [",
         "                {",
         "                    \"subnet\": \"192.0.2.0/24\",",
index da58d017ca9d6e9fd641a2c57ce63a564c5c7626..03c1c5588c4b5fcd8a9443c92d7c52d8b7d46a51 100644 (file)
@@ -49,8 +49,7 @@ SET @disable_audit = 1;
 # 3 is ALL
 UPDATE dhcp4_subnet
     SET reservations_global = FALSE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 0;
 
 UPDATE dhcp4_subnet
@@ -61,8 +60,7 @@ UPDATE dhcp4_subnet
 
 UPDATE dhcp4_subnet
     SET reservations_global = TRUE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 2;
 
 UPDATE dhcp4_subnet
@@ -73,8 +71,7 @@ UPDATE dhcp4_subnet
 
 UPDATE dhcp4_shared_network
     SET reservations_global = FALSE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 0;
 
 UPDATE dhcp4_shared_network
@@ -85,8 +82,7 @@ UPDATE dhcp4_shared_network
 
 UPDATE dhcp4_shared_network
     SET reservations_global = TRUE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 2;
 
 UPDATE dhcp4_shared_network
@@ -97,8 +93,7 @@ UPDATE dhcp4_shared_network
 
 UPDATE dhcp6_subnet
     SET reservations_global = FALSE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 0;
 
 UPDATE dhcp6_subnet
@@ -109,8 +104,7 @@ UPDATE dhcp6_subnet
 
 UPDATE dhcp6_subnet
     SET reservations_global = TRUE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 2;
 
 UPDATE dhcp6_subnet
@@ -121,8 +115,7 @@ UPDATE dhcp6_subnet
 
 UPDATE dhcp6_shared_network
     SET reservations_global = FALSE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 0;
 
 UPDATE dhcp6_shared_network
@@ -133,8 +126,7 @@ UPDATE dhcp6_shared_network
 
 UPDATE dhcp6_shared_network
     SET reservations_global = TRUE,
-        reservations_in_subnet = FALSE,
-        reservations_out_of_pool = FALSE
+        reservations_in_subnet = FALSE
     WHERE reservation_mode = 2;
 
 UPDATE dhcp6_shared_network