From e65f8627f99cfede51ca945ea9e7c86717bcf9f8 Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Thu, 15 Oct 2020 17:04:23 +0300 Subject: [PATCH] [#1405] do not set reservation mode if not explicitly specified --- .../dhcpsrv/parsers/base_network_parser.cc | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/dhcpsrv/parsers/base_network_parser.cc b/src/lib/dhcpsrv/parsers/base_network_parser.cc index 2b3edf206f..c4954a5954 100644 --- a/src/lib/dhcpsrv/parsers/base_network_parser.cc +++ b/src/lib/dhcpsrv/parsers/base_network_parser.cc @@ -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);