2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +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,7 +232,6 @@ BaseNetworkParser::parseHostReservationMode(const data::ConstElementPtr& network
void void
BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& network_data, BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& network_data,
NetworkPtr& network) { NetworkPtr& network) {
if (network_data->contains("reservation-mode")) {
bool found = false; bool found = false;
if (network_data->contains("reservations-out-of-pool")) { if (network_data->contains("reservations-out-of-pool")) {
found = true; found = true;
@@ -243,6 +242,7 @@ BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& networ
if (network_data->contains("reservations-global")) { if (network_data->contains("reservations-global")) {
found = true; found = true;
} }
if (network_data->contains("reservation-mode")) {
if (found) { if (found) {
isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'" isc_throw(DhcpConfigError, "invalid use of both 'reservation-mode'"
" and one of 'reservations-out-of-pool'" " and one of 'reservations-out-of-pool'"
@@ -250,6 +250,9 @@ BaseNetworkParser::parseHostReservationModes(const data::ConstElementPtr& networ
" 'reservations-global' parameters"); " 'reservations-global' parameters");
} }
} }
if (!found) {
return;
}
try { try {
HostReservationModesParser parser; HostReservationModesParser parser;
Network::HRMode flags = parser.parse(network_data); Network::HRMode flags = parser.parse(network_data);