From: Michal Nowikowski Date: Fri, 24 Jul 2020 10:19:17 +0000 (+0200) Subject: Revert [#1283] X-Git-Tag: Kea-1.7.10~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b572b4aacc1af0c825618d8cdd70a4b9f0aa8d25;p=thirdparty%2Fkea.git Revert [#1283] This reverts commit d30af02ceaebcbea2dcd41fbcd9e98a6fd518f78 and 392d1e5926cf46d3a6c81a8858f06b1ac5d86d87. --- diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc index a2a0a788cc..dae8074066 100644 --- a/src/lib/asiolink/io_address.cc +++ b/src/lib/asiolink/io_address.cc @@ -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 #include -#include #include // for some IPC/network system calls #include @@ -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 hasher; - return (hasher(address.toUint32())); - } else { - boost::hash > hasher; - return (hasher(address.toBytes())); - } -} } // namespace asiolink } // namespace isc diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h index fb1d67b3ea..bb2ce692d8 100644 --- a/src/lib/asiolink/io_address.h +++ b/src/lib/asiolink/io_address.h @@ -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 diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc index 503b0249ca..ad6faec87d 100644 --- a/src/lib/asiolink/tests/io_address_unittest.cc +++ b/src/lib/asiolink/tests/io_address_unittest.cc @@ -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); -} diff --git a/src/lib/dhcpsrv/shared_network.h b/src/lib/dhcpsrv/shared_network.h index f92fd5d038..e463033ed4 100644 --- a/src/lib/dhcpsrv/shared_network.h +++ b/src/lib/dhcpsrv/shared_network.h @@ -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, boost::multi_index::const_mem_fun diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index 77ce70d098..e2ac1b3648 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -16,9 +16,8 @@ #include #include #include -#include -#include #include +#include #include #include #include @@ -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, boost::multi_index::const_mem_fun