Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
7e2dedc0
Commit
7e2dedc0
authored
Oct 29, 2012
by
Tomek Mrugalski
🛰
Browse files
[2324] Changes after review (including compilation fixes for Sol, Fedora and Mac OS)
parent
8aa188a1
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
7e2dedc0
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
...
...
src/lib/dhcp/alloc_engine.h
View file @
7e2dedc0
...
...
@@ -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:
};
...
...
src/lib/dhcp/lease_mgr.h
View file @
7e2dedc0
...
...
@@ -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.
///
...
...
src/lib/dhcp/tests/alloc_engine_unittest.cc
View file @
7e2dedc0
...
...
@@ -22,6 +22,7 @@
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <sstream>
#include <map>
#include <gtest/gtest.h>
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
<
IOAddress
,
int
>
generated_addrs
;
std
::
map
<
IOAddress
,
int
>
generated_addrs
;
int
cnt
=
0
;
while
(
++
cnt
)
{
IOAddress
candidate
=
alloc
->
pickAddress
(
subnet_
,
duid_
,
IOAddress
(
"::"
));
...
...
src/lib/dhcp/tests/memfile_lease_mgr.cc
View file @
7e2dedc0
...
...
@@ -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
...
...
src/lib/dhcp/tests/memfile_lease_mgr.h
View file @
7e2dedc0
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment