2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[#1405] do not set reservation mode if not explicitly specified

This commit is contained in:
Razvan Becheriu
2020-10-15 17:04:23 +03:00
parent 378451e9b0
commit e65f8627f9

View File

@@ -232,17 +232,17 @@ BaseNetworkParser::parseHostReservationMode(const data::ConstElementPtr& network
void
BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& network_data,
NetworkPtr& network) {
bool found = false;
if (network_data->contains("reservations-out-of-pool")) {
found = true;
}
if (network_data->contains("reservations-in-subnet")) {
found = true;
}
if (network_data->contains("reservations-global")) {
found = true;
}
if (network_data->contains("reservation-mode")) {
bool found = false;
if (network_data->contains("reservations-out-of-pool")) {
found = true;
}
if (network_data->contains("reservations-in-subnet")) {
found = true;
}
if (network_data->contains("reservations-global")) {
found = true;
}
if (found) {
isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
" and one of 'reservations-out-of-pool'"
@@ -250,6 +250,9 @@ BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& networ
" 'reservations-global' parameters");
}
}
if (!found) {
return;
}
try {
HostReservationModesParser parser;
Network::HRMode flags = parser.parse(network_data);