Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
23b49041
Commit
23b49041
authored
Jul 10, 2017
by
Marcin Siodelski
Browse files
[master] Merge branch 'trac5328'
parents
16fe95cf
5d862c3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/memfile_lease_mgr.cc
View file @
23b49041
...
@@ -638,14 +638,17 @@ Memfile_LeaseMgr::getLease4(const HWAddr& hwaddr) const {
...
@@ -638,14 +638,17 @@ Memfile_LeaseMgr::getLease4(const HWAddr& hwaddr) const {
LOG_DEBUG
(
dhcpsrv_logger
,
DHCPSRV_DBG_TRACE_DETAIL
,
LOG_DEBUG
(
dhcpsrv_logger
,
DHCPSRV_DBG_TRACE_DETAIL
,
DHCPSRV_MEMFILE_GET_HWADDR
).
arg
(
hwaddr
.
toText
());
DHCPSRV_MEMFILE_GET_HWADDR
).
arg
(
hwaddr
.
toText
());
Lease4Collection
collection
;
Lease4Collection
collection
;
const
Lease4StorageAddressIndex
&
idx
=
storage4_
.
get
<
AddressIndexTag
>
();
for
(
Lease4StorageAddressIndex
::
const_iterator
lease
=
idx
.
begin
();
lease
!=
idx
.
end
();
++
lease
)
{
// Every Lease4 has a hardware address, so we can compare it
// Using composite index by 'hw address' and 'subnet id'. It is
if
(
(
*
(
*
lease
)
->
hwaddr_
)
==
hwaddr
)
{
// ok to use it for searching by the 'hw address' only.
collection
.
push_back
((
*
lease
));
const
Lease4StorageHWAddressSubnetIdIndex
&
idx
=
}
storage4_
.
get
<
HWAddressSubnetIdIndexTag
>
();
std
::
pair
<
Lease4StorageHWAddressSubnetIdIndex
::
const_iterator
,
Lease4StorageHWAddressSubnetIdIndex
::
const_iterator
>
l
=
idx
.
equal_range
(
boost
::
make_tuple
(
hwaddr
.
hwaddr_
));
for
(
auto
lease
=
l
.
first
;
lease
!=
l
.
second
;
++
lease
)
{
collection
.
push_back
(
Lease4Ptr
(
new
Lease4
(
**
lease
)));
}
}
return
(
collection
);
return
(
collection
);
...
@@ -677,15 +680,16 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id) const {
...
@@ -677,15 +680,16 @@ Memfile_LeaseMgr::getLease4(const ClientId& client_id) const {
LOG_DEBUG
(
dhcpsrv_logger
,
DHCPSRV_DBG_TRACE_DETAIL
,
LOG_DEBUG
(
dhcpsrv_logger
,
DHCPSRV_DBG_TRACE_DETAIL
,
DHCPSRV_MEMFILE_GET_CLIENTID
).
arg
(
client_id
.
toText
());
DHCPSRV_MEMFILE_GET_CLIENTID
).
arg
(
client_id
.
toText
());
Lease4Collection
collection
;
Lease4Collection
collection
;
const
Lease4StorageAddressIndex
&
idx
=
storage4_
.
get
<
AddressIndexTag
>
();
// Using composite index by 'client id' and 'subnet id'. It is ok
for
(
Lease4StorageAddressIndex
::
const_iterator
lease
=
idx
.
begin
();
// to use it to search by 'client id' only.
lease
!=
idx
.
end
();
++
lease
)
{
const
Lease4StorageClientIdSubnetIdIndex
&
idx
=
storage4_
.
get
<
ClientIdSubnetIdIndexTag
>
();
std
::
pair
<
Lease4StorageClientIdSubnetIdIndex
::
const_iterator
,
Lease4StorageClientIdSubnetIdIndex
::
const_iterator
>
l
=
idx
.
equal_range
(
boost
::
make_tuple
(
client_id
.
getClientId
()));
// client-id is not mandatory in DHCPv4. There can be a lease that does
for
(
auto
lease
=
l
.
first
;
lease
!=
l
.
second
;
++
lease
)
{
// not have a client-id. Dereferencing null pointer would be a bad thing
collection
.
push_back
(
Lease4Ptr
(
new
Lease4
(
**
lease
)));
if
((
*
lease
)
->
client_id_
&&
*
(
*
lease
)
->
client_id_
==
client_id
)
{
collection
.
push_back
((
*
lease
));
}
}
}
return
(
collection
);
return
(
collection
);
...
...
Write
Preview
Markdown
is supported
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