]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Revert [#1283]
authorMichal Nowikowski <godfryd@isc.org>
Fri, 24 Jul 2020 10:19:17 +0000 (12:19 +0200)
committerMichal Nowikowski <godfryd@isc.org>
Fri, 24 Jul 2020 10:19:17 +0000 (12:19 +0200)
This reverts commit d30af02ceaebcbea2dcd41fbcd9e98a6fd518f78
and 392d1e5926cf46d3a6c81a8858f06b1ac5d86d87.

src/lib/asiolink/io_address.cc
src/lib/asiolink/io_address.h
src/lib/asiolink/tests/io_address_unittest.cc
src/lib/dhcpsrv/shared_network.h
src/lib/dhcpsrv/subnet.h

index a2a0a788cc2e0044b7d5242a50dcda4607d3f224..dae8074066655b75ed10e8016e75475e067c91d6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,7 +11,6 @@
 #include <exceptions/exceptions.h>
 
 #include <boost/static_assert.hpp>
-#include <boost/container_hash/hash.hpp>
 
 #include <unistd.h>             // for some IPC/network system calls
 #include <stdint.h>
@@ -173,16 +172,6 @@ IOAddress::increase(const IOAddress& addr) {
     return (IOAddress::fromBytes(addr.getFamily(), &packed[0]));
 }
 
-size_t
-hash_value(const IOAddress& address) {
-    if (address.isV4()) {
-        boost::hash<uint32_t> hasher;
-        return (hasher(address.toUint32()));
-    } else {
-        boost::hash<std::vector<uint8_t> > hasher;
-        return (hasher(address.toBytes()));
-    }
-}
 
 } // namespace asiolink
 } // namespace isc
index fb1d67b3ea4d462dcec472b3085f4cd16a56ee34..bb2ce692d83c8118ab8a9bfb4fb06c787251c0fd 100644 (file)
@@ -302,17 +302,6 @@ private:
 std::ostream&
 operator<<(std::ostream& os, const IOAddress& address);
 
-/// \brief Hash the IOAddress.
-///
-/// This method allows boost multi-index hashed indexes on IOAddresses.
-/// It follows the requirement with equality: if two addresses are equal
-/// their hashes are equal, if two addresses are not equal their hashes
-/// are almost surely not equal.
-///
-/// \param address A \c IOAddress to hash.
-/// \return The hash of the IOAddress.
-size_t hash_value(const IOAddress& address);
-
 } // namespace asiolink
 } // namespace isc
 #endif // IO_ADDRESS_H
index 503b0249ca5a6c04db80a943afeda00ecbc44271..ad6faec87d4a9910686a1ddba41b1be73755dc52 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -339,14 +339,3 @@ TEST(IOAddressTest, increaseAddr) {
     EXPECT_EQ(IOAddress("::1"), IOAddress::increase(any6));
     EXPECT_EQ(IOAddress("::"), IOAddress::increase(the_last_one));
 }
-
-// Test verifies the hash function is sane.
-TEST(IOAddressTest, hash) {
-    size_t hash1 = hash_value(IOAddress("192.0.2.1"));
-    size_t hash2 = hash_value(IOAddress("192.0.2.2"));
-    EXPECT_NE(hash1, hash2);
-
-    hash1 = hash_value(IOAddress("2001:db8::12"));
-    hash2 = hash_value(IOAddress("2001:db8::1234"));
-    EXPECT_NE(hash1, hash2);
-}
index f92fd5d038ed1ecfc33ba6729e122d083424f220..e463033ed4dd8ba9ec6d7bebe59d083ed4843ace 100644 (file)
@@ -243,7 +243,7 @@ typedef boost::multi_index_container<
         >,
         // Fourth index allows for access by server identifier specified for the
         // network.
-        boost::multi_index::hashed_non_unique<
+        boost::multi_index::ordered_non_unique<
             boost::multi_index::tag<SharedNetworkServerIdIndexTag>,
             boost::multi_index::const_mem_fun<Network4, asiolink::IOAddress,
                                               &Network4::getServerId>
index 77ce70d0988b0394a791c73204df047f41893d75..e2ac1b364842257cb20973f49f0f1099169085d3 100644 (file)
@@ -16,9 +16,8 @@
 #include <dhcpsrv/pool.h>
 #include <dhcpsrv/subnet_id.h>
 #include <dhcpsrv/triplet.h>
-#include <boost/multi_index/hashed_index.hpp>
-#include <boost/multi_index/indexed_by.hpp>
 #include <boost/multi_index/mem_fun.hpp>
+#include <boost/multi_index/indexed_by.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/random_access_index.hpp>
 #include <boost/multi_index_container.hpp>
@@ -862,7 +861,7 @@ typedef boost::multi_index_container<
         >,
 
         // Fourth index allows for searching using an output from getServerId.
-        boost::multi_index::hashed_non_unique<
+        boost::multi_index::ordered_non_unique<
             boost::multi_index::tag<SubnetServerIdIndexTag>,
             boost::multi_index::const_mem_fun<Network4, asiolink::IOAddress,
                                               &Network4::getServerId>