]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
fixed unit tests - added constraints in cql host data source
authorRazvan Becheriu <razvan.becheriu@qualitance.com>
Thu, 22 Feb 2018 11:51:10 +0000 (13:51 +0200)
committerRazvan Becheriu <razvan.becheriu@qualitance.com>
Thu, 22 Feb 2018 11:51:10 +0000 (13:51 +0200)
src/lib/dhcpsrv/cql_host_data_source.cc
src/lib/dhcpsrv/testutils/host_data_source_utils.cc

index cd786f08e80ad094ac1d535885ef3a9748ef0b76..8e501a365e165e72b4c177016231a79d29ce41f3 100644 (file)
@@ -1143,8 +1143,15 @@ CqlHostExchange::hashIntoId() const {
 
     // Get key.
     std::stringstream key_stream;
-    key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-')
-               << DUID(host_identifier_).toText();
+    if (host_ipv4_address_) {
+        key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-')
+                   << "-";
+        key_stream << std::setw(10) << std::setfill('-') << "-";
+    } else {
+        key_stream << std::setw(3 * DUID::MAX_DUID_LEN - 1) << std::setfill('-')
+                   << DUID(host_identifier_).toText();
+        key_stream << std::setw(10) << std::setfill('-') << host_identifier_type_;
+    }
     key_stream << std::setw(10) << std::setfill('-') << host_ipv4_subnet_id_;
     key_stream << std::setw(10) << std::setfill('-') << host_ipv6_subnet_id_;
     key_stream << std::setw(V4ADDRESS_TEXT_MAX_LEN) << std::setfill('-')
index 8ad892e874751c5ef6e32dc371c6d91db7d0ebe2..a13914bdeb23717eb51ba6576f11757d52e39e08 100644 (file)
@@ -101,8 +101,8 @@ HostDataSourceUtils::initializeHost6(std::string address,
     // subnet4 with subnet6.
     static SubnetID subnet4 = 0;
     static SubnetID subnet6 = 100;
-    subnet4++;
-    subnet6++;
+    ++subnet4;
+    ++subnet6;
 
     HostPtr host(new Host(&ident[0], ident.size(), identifier, subnet4, subnet6,
                           IOAddress("0.0.0.0")));