"reservations-global": false,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
...
}
"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,
...
}
"subnet": "192.0.2.0/24",
"reservations-global": false,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
...
}
]
"reservations-global": true,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
"reservations": [
{
"hw-address": "01:bb:cc:dd:ee:ff",
"reservations-global": false,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
...
}
"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,
...
}
"subnet": "2001:db8:1::/64",
"reservations-global": false,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
...
}
]
"reservations-global": true,
"reservations-in-subnet": false,
- "reservations-out-of-pool": false,
"reservations": [
{
"duid": "00:03:00:01:11:22:33:44:55:66",
# 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
// 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();
// 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.
" \"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\" } ],"
" \"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\","
" \"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"
" \"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"
"],\n"
"\"reservations-global\": true,\n"
"\"reservations-in-subnet\": false,\n"
- "\"reservations-out-of-pool\": false,\n"
"\"valid-lifetime\": 600,\n"
"\"reservations\": [ \n"
"{\n"
"],\n"
"\"reservations-global\": true,\n"
"\"reservations-in-subnet\": false,\n"
- "\"reservations-out-of-pool\": false,\n"
"\"valid-lifetime\": 600,\n"
"\"reservations\": [ \n"
"{\n"
// 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.
" \"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\" } ],"
" \"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"
" \"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"
" \"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"
"],\n"
"\"reservations-global\": true,\n"
"\"reservations-in-subnet\": false,\n"
- "\"reservations-out-of-pool\": false,\n"
"\"valid-lifetime\": 4000,\n"
"\"reservations\": [ \n"
"{\n"
"],\n"
"\"reservations-global\": true,\n"
"\"reservations-in-subnet\": false,\n"
- "\"reservations-out-of-pool\": false,\n"
"\"valid-lifetime\": 4000,\n"
"\"reservations\": [ \n"
"{\n"
subnet->requireClientClass("required-class2");
subnet->setReservationsGlobal(false);
subnet->setReservationsInSubnet(false);
- subnet->setReservationsOutOfPool(false);
subnet->setSname("server-hostname");
subnet->setContext(user_context);
subnet->setValid(555555);
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);
subnet->requireClientClass("required-class2");
subnet->setReservationsGlobal(false);
subnet->setReservationsInSubnet(false);
- subnet->setReservationsOutOfPool(false);
subnet->setContext(user_context);
subnet->setValid(555555);
subnet->setPreferred(4444444);
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);
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);
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;
}
}
// 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_) {
// 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;
}
!(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) {
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);
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;
}
}
// 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_) {
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));
} 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));
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.
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.
"}";
expected = "{"
" \"reservations-global\": false,"
- " \"reservations-in-subnet\": false,"
- " \"reservations-out-of-pool\": false"
+ " \"reservations-in-subnet\": false"
" }";
TestMove(config, expected);
"}";
expected = "{"
" \"reservations-global\": true,"
- " \"reservations-in-subnet\": false,"
- " \"reservations-out-of-pool\": false"
+ " \"reservations-in-subnet\": false"
" }";
TestMove(config, expected);
" \"ip-address\": \"0.0.0.0\"",
" },",
" \"renew-timer\": 60,",
- " \"reservation-mode\": \"all\",",
" \"subnet4\": [",
" {",
" \"subnet\": \"192.0.2.0/24\",",
" \"ip-address\": \"0.0.0.0\"",
" },",
" \"renew-timer\": 60,",
- " \"reservation-mode\": \"all\",",
" \"subnet4\": [",
" {",
" \"subnet\": \"192.0.2.0/24\",",
# 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
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
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
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
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
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
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
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