From: Marcin Siodelski Date: Fri, 29 Mar 2019 14:47:34 +0000 (+0100) Subject: [#490,!293] Do not throw from the getHostReservationMode function. X-Git-Tag: Kea-1.6.0-beta~291 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fb8b5e1ed94900f4d75d5a19e84f8e511a03156;p=thirdparty%2Fkea.git [#490,!293] Do not throw from the getHostReservationMode function. --- diff --git a/src/lib/dhcpsrv/network.h b/src/lib/dhcpsrv/network.h index 91611b9f91..ca45da023f 100644 --- a/src/lib/dhcpsrv/network.h +++ b/src/lib/dhcpsrv/network.h @@ -405,9 +405,18 @@ public: util::Optional hr_mode_name; hr_mode_name = getGlobalProperty(hr_mode_name, "reservation-mode"); if (!hr_mode_name.unspecified()) { - // If the HR mode is globally configured, let's convert it from - // a string to enum. - return (hrModeFromString(hr_mode_name.get())); + try { + // If the HR mode is globally configured, let's convert it from + // a string to enum. + return (hrModeFromString(hr_mode_name.get())); + + } catch (...) { + // This should not really happen because the configuration + // parser should have already verified the globally configured + // reservation mode. However, we want to be 100% sure that this + // method doesn't throw. Let's just return unspecified. + return (hr_mode); + } } } return (hr_mode);