]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#490,!293] Do not throw from the getHostReservationMode function.
authorMarcin Siodelski <marcin@isc.org>
Fri, 29 Mar 2019 14:47:34 +0000 (15:47 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 29 Mar 2019 14:47:34 +0000 (15:47 +0100)
src/lib/dhcpsrv/network.h

index 91611b9f91af54f04f73e242167e95319bb35a36..ca45da023fa8b65079da27fa789c16c0c18b7fc9 100644 (file)
@@ -405,9 +405,18 @@ public:
             util::Optional<std::string> 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);