]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[94-cb-implement-mysqlconfigbackenddhcpv6-prepare] Addressed some comments
authorFrancis Dupont <fdupont@isc.org>
Thu, 21 Feb 2019 21:03:20 +0000 (22:03 +0100)
committerFrancis Dupont <fdupont@isc.org>
Fri, 22 Feb 2019 22:59:25 +0000 (17:59 -0500)
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc
src/hooks/dhcp/mysql_cb/mysql_cb_impl.cc
src/hooks/dhcp/mysql_cb/mysql_cb_impl.h
src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h

index 590f874192ad7fa0bcfd3781d37f26b1a2733f42..d8c4fec0152c5b9c7a63dc7e7f8795a06bc5a02c 100644 (file)
@@ -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.
index a90b99332690313cc7e4898db89ee5819ea15552..a66ae53ceaf01fa8e91fa91aaa4296d789f099a6 100644 (file)
@@ -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<uint64_t>());
+    // modification_ts
+    out_bindings.push_back(MySqlBinding::createTimestamp());
     // pd_pool_id
     if (universe == Option::V6) {
         out_bindings.push_back(MySqlBinding::createInteger<uint64_t>());
     }
-    // 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);
 }
index 2644faa6be161c29474fe40d3d693c461bcc3857..af76295017da419682322b9d55924f943920ad66 100644 (file)
@@ -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.
index 68901cfacdd3f9432cbfe6b12f6d0fd448be73e9..cd201bceb4295ec1b1282eaf0c68ce1378daeaf1 100644 (file)
@@ -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