Skip to content
GitLab
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
2bc621d5
Commit
2bc621d5
authored
Mar 17, 2016
by
Thomas Markwalder
Browse files
[master] Fixed Coverity issue in alloc_engine.cc
Merged in Trac #4309.
parents
88d5a985
6f0b3a5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/alloc_engine.cc
View file @
2bc621d5
// Copyright (C) 2012-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-201
6
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
...
...
@@ -1628,33 +1628,30 @@ AllocEngine::reclaimExpiredLease(const Lease6Ptr& lease,
if
(
!
skipped
)
{
// Generate removal name change request for D2, if required.
// This will return immediatel
l
y if the DNS wasn't updated
// This will return immediately if the DNS wasn't updated
// when the lease was created.
queueNCR
(
CHG_REMOVE
,
lease
);
// Let's check if the lease that just expired is in DECLINED state.
// If it is, we need to conduct couple extra steps and also force
// its removal.
bool
remove_tmp
=
(
reclaim_mode
==
DB_RECLAIM_REMOVE
);
// If it is, we need to perform a couple extra steps.
bool
remove_lease
=
(
reclaim_mode
==
DB_RECLAIM_REMOVE
);
if
(
lease
->
state_
==
Lease
::
STATE_DECLINED
)
{
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore.
if
(
reclaim_mode
!=
DB_RECLAIM_LEAVE_UNCHANGED
)
{
remove_tmp
=
true
;
}
// Do extra steps required for declined lease reclaimation:
// Do extra steps required for declined lease reclamation:
// - call the recover hook
// - bump decline-related stats
// - log separate message
remove_tmp
=
reclaimDeclined
(
lease
);
// There's no point in keeping a declined lease after its
// reclamation. A declined lease doesn't have any client
// identifying information anymore. So we'll flag it for
// removal unless the hook has set the skip flag.
remove_lease
=
reclaimDeclined
(
lease
);
}
if
(
reclaim_mode
!=
DB_RECLAIM_LEAVE_UNCHANGED
)
{
// Reclaim the lease - depending on the configuration, set the
// expired-reclaimed state or simply remove it.
LeaseMgr
&
lease_mgr
=
LeaseMgrFactory
::
instance
();
reclaimLeaseInDatabase
<
Lease6Ptr
>
(
lease
,
remove_
tmp
,
reclaimLeaseInDatabase
<
Lease6Ptr
>
(
lease
,
remove_
lease
,
boost
::
bind
(
&
LeaseMgr
::
updateLease6
,
&
lease_mgr
,
_1
));
}
...
...
@@ -1726,33 +1723,32 @@ AllocEngine::reclaimExpiredLease(const Lease4Ptr& lease,
queueNCR
(
CHG_REMOVE
,
lease
);
// Let's check if the lease that just expired is in DECLINED state.
// If it is, we need to conduct couple extra steps and also force
// its removal.
bool
remove_tmp
=
(
reclaim_mode
==
DB_RECLAIM_REMOVE
);
// If it is, we need to perform a couple extra steps.
bool
remove_lease
=
(
reclaim_mode
==
DB_RECLAIM_REMOVE
);
if
(
lease
->
state_
==
Lease
::
STATE_DECLINED
)
{
// There's no point in keeping declined lease after its
// reclaimation. Declined lease doesn't have any client
// identifying information anymore.
if
(
reclaim_mode
!=
DB_RECLAIM_LEAVE_UNCHANGED
)
{
remove_tmp
=
true
;
}
// Do extra steps required for declined lease reclaimation:
// Do extra steps required for declined lease reclamation:
// - call the recover hook
// - bump decline-related stats
// - log separate message
remove_tmp
=
reclaimDeclined
(
lease
);
// There's no point in keeping a declined lease after its
// reclamation. A declined lease doesn't have any client
// identifying information anymore. So we'll flag it for
// removal unless the hook has set the skip flag.
remove_lease
=
reclaimDeclined
(
lease
);
}
if
(
reclaim_mode
!=
DB_RECLAIM_LEAVE_UNCHANGED
)
{
// Reclaim the lease - depending on the configuration, set the
// expired-reclaimed state or simply remove it.
LeaseMgr
&
lease_mgr
=
LeaseMgrFactory
::
instance
();
reclaimLeaseInDatabase
<
Lease4Ptr
>
(
lease
,
remove_
tmp
,
reclaimLeaseInDatabase
<
Lease4Ptr
>
(
lease
,
remove_
lease
,
boost
::
bind
(
&
LeaseMgr
::
updateLease4
,
&
lease_mgr
,
_1
));
}
}
// Update statistics.
// Decrease number of assigned addresses.
StatsMgr
::
instance
().
addValue
(
StatsMgr
::
generateName
(
"subnet"
,
lease
->
subnet_id_
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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