diff options
author | Marcin Siodelski <marcin@isc.org> | 2019-03-11 14:57:58 +0100 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2019-03-14 09:59:58 +0100 |
commit | 8edf2fb25330a75d0b1a6dde5e319a3640f53e51 (patch) | |
tree | 887ea9b50dd39de1802190d57f9b64e69d0746c4 /src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc | |
parent | [#521,!270] Updated unit tests comment. (diff) | |
download | kea-8edf2fb25330a75d0b1a6dde5e319a3640f53e51.tar.xz kea-8edf2fb25330a75d0b1a6dde5e319a3640f53e51.zip |
[#521,!270] Addressed review comments.
Diffstat (limited to 'src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc')
-rw-r--r-- | src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index 0e104120e5..8ac602aa8a 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -602,17 +602,21 @@ MySqlConfigBackendImpl::processOptionRow(const Option::Universe& universe, code = (*(first_binding + 1))->getInteger<uint16_t>(); } - // Option can be stored as a blob or formatted value in the configuration. - std::vector<uint8_t> blob; - if (!(*(first_binding + 2))->amNull()) { - blob = (*(first_binding + 2))->getBlob(); - } - OptionBuffer buf(blob.begin(), blob.end()); // Get formatted value if available. std::string formatted_value = (*(first_binding + 3))->getStringOrDefault(""); - OptionPtr option(new Option(universe, code, buf.begin(), buf.end())); + OptionPtr option(new Option(universe, code)); + + // If we don't have a formatted value, check for a blob. Add it to the + // option if it exists. + if (formatted_value.empty()) { + std::vector<uint8_t> blob; + if (!(*(first_binding + 2))->amNull()) { + blob = (*(first_binding + 2))->getBlob(); + } + option->setData(blob.begin(), blob.end()); + } // Check if the option is persistent. bool persistent = static_cast<bool>((*(first_binding + 5))->getIntegerOrDefault<uint8_t>(0)); |