mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#1405] ignore out of pool if in subnet is disabled
This commit is contained in:
parent
60186c5cef
commit
f06b3ffde9
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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.
|
||||
|
@ -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\" } ],"
|
||||
|
@ -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\","
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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_) {
|
||||
|
@ -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));
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
" \"ip-address\": \"0.0.0.0\"",
|
||||
" },",
|
||||
" \"renew-timer\": 60,",
|
||||
" \"reservation-mode\": \"all\",",
|
||||
" \"subnet4\": [",
|
||||
" {",
|
||||
" \"subnet\": \"192.0.2.0/24\",",
|
||||
|
@ -33,7 +33,6 @@
|
||||
" \"ip-address\": \"0.0.0.0\"",
|
||||
" },",
|
||||
" \"renew-timer\": 60,",
|
||||
" \"reservation-mode\": \"all\",",
|
||||
" \"subnet4\": [",
|
||||
" {",
|
||||
" \"subnet\": \"192.0.2.0/24\",",
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user