]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#488,!259] Added support for boot file, next_server and sname to MySQL CB.
authorMarcin Siodelski <marcin@isc.org>
Wed, 6 Mar 2019 13:31:55 +0000 (14:31 +0100)
committerMarcin Siodelski <marcin@isc.org>
Thu, 7 Mar 2019 13:00:36 +0000 (08:00 -0500)
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc
src/hooks/dhcp/mysql_cb/mysql_query_macros_dhcp.h
src/hooks/dhcp/mysql_cb/tests/mysql_cb_dhcp4_unittest.cc

index 2847022dd00fba63899222b718b91b12dfd6d23d..57c7eba0d43d20dd1d788a06428f12a6b3a2a2b5 100644 (file)
@@ -1012,7 +1012,10 @@ public:
             MySqlBinding::createInteger<uint8_t>(), // calculate_tee_times
             MySqlBinding::createInteger<float>(), // t1_percent
             MySqlBinding::createInteger<float>(), // t2_percent
-            MySqlBinding::createInteger<uint8_t>() // authoritative
+            MySqlBinding::createInteger<uint8_t>(), // authoritative
+            MySqlBinding::createString(BOOT_FILE_NAME_BUF_LENGTH), // boot_file_name
+            MySqlBinding::createInteger<uint32_t>(), // next_server
+            MySqlBinding::createString(SERVER_HOSTNAME_BUF_LENGTH) // server_hostname
         };
 
         uint64_t last_network_id = 0;
@@ -1131,6 +1134,21 @@ public:
                     last_network->setAuthoritative(out_bindings[28]->getBool());
                 }
 
+                // boot_file_name
+                if (!out_bindings[29]->amNull()) {
+                    last_network->setFilename(out_bindings[29]->getString());
+                }
+
+                // next_server
+                if (!out_bindings[30]->amNull()) {
+                    last_network->setSiaddr(IOAddress(out_bindings[30]->getInteger<uint32_t>()));
+                }
+
+                // server_hostaname
+                if (!out_bindings[31]->amNull()) {
+                    last_network->setSname(out_bindings[31]->getString());
+                }
+
                 shared_networks.push_back(last_network);
             }
 
@@ -1255,7 +1273,10 @@ public:
             MySqlBinding::condCreateBool(shared_network->getCalculateTeeTimes()),
             MySqlBinding::condCreateFloat(shared_network->getT1Percent()),
             MySqlBinding::condCreateFloat(shared_network->getT2Percent()),
-            MySqlBinding::condCreateBool(shared_network->getAuthoritative())
+            MySqlBinding::condCreateBool(shared_network->getAuthoritative()),
+            MySqlBinding::condCreateString(shared_network->getFilename()),
+            MySqlBinding::condCreateIPv4Address(shared_network->getSiaddr()),
+            MySqlBinding::condCreateString(shared_network->getSname())
         };
 
         MySqlTransaction transaction(conn_);
@@ -2108,8 +2129,11 @@ TaggedStatementArray tagged_statements = { {
       "  calculate_tee_times,"
       "  t1_percent,"
       "  t2_percent,"
-      "  authoritative"
-      ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
+      "  authoritative,"
+      "  boot_file_name,"
+      "  next_server,"
+      "  server_hostname"
+      ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" },
 
     // Insert association of the shared network with a server.
     { MySqlConfigBackendDHCPv4Impl::INSERT_SHARED_NETWORK4_SERVER,
@@ -2188,7 +2212,10 @@ TaggedStatementArray tagged_statements = { {
       "  calculate_tee_times = ?,"
       "  t1_percent = ?,"
       "  t2_percent = ?,"
-      "  authoritative = ? "
+      "  authoritative = ?,"
+      "  boot_file_name = ?,"
+      "  next_server = ?,"
+      "  server_hostname = ? "
       "WHERE name = ?" },
 
     // Update existing option definition.
index 57bfa672015b172cab6233fe9c7e7579c1f6cd37..7976fc87f50bc1c969256bf49430e45e4f25391f 100644 (file)
@@ -228,7 +228,10 @@ namespace {
     "  n.calculate_tee_times," \
     "  n.t1_percent," \
     "  n.t2_percent," \
-    "  n.authoritative " \
+    "  n.authoritative," \
+    "  n.boot_file_name," \
+    "  n.next_server," \
+    "  n.server_hostname " \
     "FROM dhcp4_shared_network AS n " \
     "INNER JOIN dhcp4_shared_network_server AS a " \
     "  ON n.id = a.shared_network_id " \
index cd70ef4ff9291e9f045cb16f485b15f223494d18..60ef55388bddec215baf8c72fdfa5981cca1fb95 100644 (file)
@@ -189,6 +189,9 @@ public:
         shared_network->setCalculateTeeTimes(true);
         shared_network->setT1Percent(0.345);
         shared_network->setT2Percent(0.444);
+        shared_network->setSiaddr(IOAddress("192.0.1.2"));
+        shared_network->setSname("frog");
+        shared_network->setFilename("/dev/null");
 
         // Add several options to the shared network.
         shared_network->getCfgOption()->add(test_options_[2]->option_,