From: Tomek Mrugalski Date: Mon, 29 Oct 2012 11:02:24 +0000 (+0100) Subject: [2324] Changes after review (including compilation fixes for Sol, Fedora and Mac OS) X-Git-Tag: trac2487_base~21^2~9^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e2dedc024cd77a301d7e30d180e16fa2132cbf5;p=thirdparty%2Fkea.git [2324] Changes after review (including compilation fixes for Sol, Fedora and Mac OS) --- diff --git a/ChangeLog b/ChangeLog index 9e76a18744..6ec7aec8bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +4XX. [func] tomek + DHCPv6 Allocation Engine implemented. It allows address allocation + from the configured subnets/pools. It currently features a single + allocator: IterativeAllocator, which assigns addresses iteratively. + Other allocators (hashed, random) are planned. + (Trac #2324, git TBD) + 494. [bug] jinmei Fixed a problem that shutting down BIND 10 kept some of the processes alive. It was two-fold: when the main bind10 process diff --git a/src/lib/dhcp/alloc_engine.h b/src/lib/dhcp/alloc_engine.h index 74e30dd8b0..496703a96c 100644 --- a/src/lib/dhcp/alloc_engine.h +++ b/src/lib/dhcp/alloc_engine.h @@ -67,6 +67,10 @@ protected: virtual isc::asiolink::IOAddress pickAddress(const Subnet6Ptr& subnet, const DuidPtr& duid, const isc::asiolink::IOAddress& hint) = 0; + + /// @brief virtual destructor + virtual ~Allocator() { + } protected: }; diff --git a/src/lib/dhcp/lease_mgr.h b/src/lib/dhcp/lease_mgr.h index 7541a15f7b..e859deaf64 100644 --- a/src/lib/dhcp/lease_mgr.h +++ b/src/lib/dhcp/lease_mgr.h @@ -398,7 +398,7 @@ public: /// @param addr address of the searched lease /// /// @return smart pointer to the lease (or NULL if a lease is not found) - virtual Lease6Ptr getLease6(isc::asiolink::IOAddress addr) const = 0; + virtual Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const = 0; /// @brief Returns existing IPv6 leases for a given DUID+IA combination /// @@ -450,7 +450,7 @@ public: /// @param addr IPv4 address of the lease to be deleted. /// /// @return true if deletion was successful, false if no such lease exists - virtual bool deleteLease6(isc::asiolink::IOAddress addr) = 0; + virtual bool deleteLease6(const isc::asiolink::IOAddress& addr) = 0; /// @brief Returns backend name. /// diff --git a/src/lib/dhcp/tests/alloc_engine_unittest.cc b/src/lib/dhcp/tests/alloc_engine_unittest.cc index b50a2c56ae..bbb4bbd9e9 100644 --- a/src/lib/dhcp/tests/alloc_engine_unittest.cc +++ b/src/lib/dhcp/tests/alloc_engine_unittest.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include using namespace std; @@ -35,6 +36,9 @@ namespace { class NakedAllocEngine : public AllocEngine { public: + NakedAllocEngine(AllocEngine::AllocType engine_type, unsigned int attempts) + :AllocEngine(engine_type, attempts) { + } using AllocEngine::Allocator; using AllocEngine::IterativeAllocator; }; @@ -308,7 +312,7 @@ TEST_F(AllocEngineTest, IterativeAllocator_manyPools) { // there are 8 extra pools with 9 addresses in each. // Let's keep picked addresses here and check their uniqueness. - map generated_addrs; + std::map generated_addrs; int cnt = 0; while (++cnt) { IOAddress candidate = alloc->pickAddress(subnet_, duid_, IOAddress("::")); diff --git a/src/lib/dhcp/tests/memfile_lease_mgr.cc b/src/lib/dhcp/tests/memfile_lease_mgr.cc index ac3316d6ca..195fd8bb97 100644 --- a/src/lib/dhcp/tests/memfile_lease_mgr.cc +++ b/src/lib/dhcp/tests/memfile_lease_mgr.cc @@ -65,7 +65,7 @@ Lease4Collection Memfile_LeaseMgr::getLease4(const ClientId& ) const { return (Lease4Collection()); } -Lease6Ptr Memfile_LeaseMgr::getLease6(isc::asiolink::IOAddress addr) const { +Lease6Ptr Memfile_LeaseMgr::getLease6(const isc::asiolink::IOAddress& addr) const { Lease6Storage::iterator l = storage6_.find(addr); if (l == storage6_.end()) { return (Lease6Ptr()); @@ -95,7 +95,7 @@ bool Memfile_LeaseMgr::deleteLease4(uint32_t ) { return (false); } -bool Memfile_LeaseMgr::deleteLease6(isc::asiolink::IOAddress addr) { +bool Memfile_LeaseMgr::deleteLease6(const isc::asiolink::IOAddress& addr) { Lease6Storage::iterator l = storage6_.find(addr); if (l == storage6_.end()) { // no such lease diff --git a/src/lib/dhcp/tests/memfile_lease_mgr.h b/src/lib/dhcp/tests/memfile_lease_mgr.h index 666db6ace7..c5a41e6c7f 100644 --- a/src/lib/dhcp/tests/memfile_lease_mgr.h +++ b/src/lib/dhcp/tests/memfile_lease_mgr.h @@ -132,7 +132,7 @@ public: /// @param addr address of the searched lease /// /// @return smart pointer to the lease (or NULL if a lease is not found) - Lease6Ptr getLease6(isc::asiolink::IOAddress addr) const; + Lease6Ptr getLease6(const isc::asiolink::IOAddress& addr) const; /// @brief Returns existing IPv6 lease for a given DUID+IA combination /// @@ -187,12 +187,12 @@ public: /// @param addr IPv4 address of the lease to be deleted. /// /// @return true if deletion was successful, false if no such lease exists - bool deleteLease6(isc::asiolink::IOAddress addr); + bool deleteLease6(const isc::asiolink::IOAddress& addr); /// @brief Returns backend name. /// /// Each backend have specific name, e.g. "mysql" or "sqlite". - std::string getName() const { return "memfile"; } + std::string getName() const { return ("memfile"); } /// @brief Returns description of the backend. /// @@ -200,7 +200,7 @@ public: std::string getDescription() const; /// @brief Returns backend version. - std::string getVersion() const { return "test-version"; } + std::string getVersion() const { return ("test-version"); } using LeaseMgr::getParameter;