From: Francis Dupont Date: Thu, 21 Feb 2019 21:03:20 +0000 (+0100) Subject: [94-cb-implement-mysqlconfigbackenddhcpv6-prepare] Addressed some comments X-Git-Tag: 397-cb-implement-mysqlconfigbackenddhcpv6_base~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6713a20543aec0af5a1f9f23d153c29731dd4ec0;p=thirdparty%2Fkea.git [94-cb-implement-mysqlconfigbackenddhcpv6-prepare] Addressed some comments --- diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc index 590f874192..d8c4fec015 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc @@ -1589,7 +1589,7 @@ public: getOption4(const ServerSelector& server_selector, const uint16_t code, const std::string& space) { return (getOption(GET_OPTION4_CODE_SPACE, Option::V4, - server_selector, code, space));; + server_selector, code, space)); } /// @brief Sends query to retrieve all global options. diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc index a90b993326..a66ae53cea 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc @@ -554,12 +554,12 @@ MySqlConfigBackendImpl::getOptions(const int index, out_bindings.push_back(MySqlBinding::createString(SHARED_NETWORK_NAME_BUF_LENGTH)); // pool_id out_bindings.push_back(MySqlBinding::createInteger()); + // modification_ts + out_bindings.push_back(MySqlBinding::createTimestamp()); // pd_pool_id if (universe == Option::V6) { out_bindings.push_back(MySqlBinding::createInteger()); } - // modification_ts - out_bindings.push_back(MySqlBinding::createTimestamp()); uint64_t last_option_id = 0; @@ -651,10 +651,7 @@ MySqlConfigBackendImpl::processOptionRow(const Option::Universe& universe, // its option space and timestamp. OptionDescriptorPtr desc(new OptionDescriptor(option, persistent, formatted_value)); desc->space_name_ = space; - // In DHCPv6 the pd_pool_id field shifts the position of the - // modification_ts field by one. - size_t ts_idx = (universe == Option::V4 ? 11 : 12); - desc->setModificationTime((*(first_binding + ts_idx))->getTimestamp()); + desc->setModificationTime((*(first_binding + 11))->getTimestamp()); return (desc); } diff --git a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h index 2644faa6be..af76295017 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h +++ b/src/hooks/dhcp/mysql_cb/mysql_cb_impl.h @@ -423,7 +423,7 @@ public: const std::string& space); /// @brief Sends query to retrieve single option by code and option space - /// for a given [pd] pool id. + /// for a given address or prefix delegation (v6) pool id. /// /// @param index Index of the query to be used. /// @param universe Option universe, i.e. V4 or V6. diff --git a/src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h b/src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h index 68901cfacd..cd201bceb4 100644 --- a/src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h +++ b/src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h @@ -151,8 +151,8 @@ namespace { " x.user_context," \ " x.shared_network_name," \ " x.pool_id," \ - " x.pd_pool_id," \ " x.modification_ts," \ + " x.pd_pool_id," \ " y.option_id," \ " y.code," \ " y.value," \ @@ -164,8 +164,8 @@ namespace { " y.user_context," \ " y.shared_network_name," \ " y.pool_id," \ - " y.pd_pool_id," \ " y.modification_ts," \ + " y.pd_pool_id," \ " o.option_id," \ " o.code," \ " o.value," \ @@ -177,8 +177,8 @@ namespace { " o.user_context," \ " o.shared_network_name," \ " o.pool_id," \ - " o.pd_pool_id," \ - " o.modification_ts " \ + " o.modification_ts," \ + " o.pd_pool_id " \ "FROM dhcp6_subnet AS s " \ "INNER JOIN dhcp6_subnet_server AS a " \ " ON s.subnet_id = a.subnet_id " \ @@ -259,8 +259,8 @@ namespace { " o.user_context," \ " o.shared_network_name," \ " o.pool_id," \ - " o.pd_pool_id," \ - " o.modification_ts " \ + " o.modification_ts," \ + " o.pd_pool_id " \ "FROM dhcp6_shared_network AS n " \ "INNER JOIN dhcp6_shared_network_server AS a " \ " ON n.id = a.shared_network_id " \ @@ -307,8 +307,8 @@ namespace { " o.user_context," \ " o.shared_network_name," \ " o.pool_id," \ - pd_pool_id \ " o.modification_ts " \ + pd_pool_id \ "FROM " #table_prefix "_options AS o " \ "INNER JOIN " #table_prefix "_options_server AS a" \ " ON o.option_id = a.option_id " \ @@ -435,8 +435,8 @@ namespace { " user_context," \ " shared_network_name," \ " pool_id," \ - pd_pool_id \ " modification_ts" \ + pd_pool_id \ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?" last ")" #endif @@ -503,8 +503,8 @@ namespace { " o.user_context = ?," \ " o.shared_network_name = ?," \ " o.pool_id = ?," \ - pd_pool_id \ " o.modification_ts = ? " \ + pd_pool_id \ "WHERE s.tag = ? " #__VA_ARGS__ #endif