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
Adam Osuchowski
Kea
Commits
aaababbd
Commit
aaababbd
authored
Jan 13, 2015
by
Marcin Siodelski
Browse files
[3668] Install LFC timer for the DHCPv4 and DHCPv6 server.
parent
b4fb07db
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_messages.mes
View file @
aaababbd
...
...
@@ -187,6 +187,13 @@ specified client after receiving a REQUEST message from it. There are many
possible reasons for such a failure. Additional messages will indicate the
reason.
% DHCP4_LEASE_DATABASE_TIMERS_EXEC_FAIL failed to execute the timers for lease database: %1
A warning message executed when a server process is unable to execute
the periodic actions for the lease database. An example of the periodic
action is a Lease File Cleanup. One of the reasons for the failure is
a misconfiguration of the lease database, whereby the lease database
hasn't been selected.
% DHCP4_NAME_GEN_UPDATE_FAIL failed to update the lease after generating name for a client: %1
This message indicates the failure when trying to update the lease and/or
options in the server's response with the hostname generated by the server
...
...
src/bin/dhcp4/dhcp4_srv.cc
View file @
aaababbd
// Copyright (C) 2011-201
4
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
5
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -40,6 +40,7 @@
#include <hooks/hooks_manager.h>
#include <util/strutil.h>
#include <asio.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
...
...
@@ -149,9 +150,20 @@ Dhcpv4Srv::sendPacket(const Pkt4Ptr& packet) {
bool
Dhcpv4Srv
::
run
()
{
while
(
!
shutdown_
)
{
/// @todo: calculate actual timeout once we have lease database
/// @todo Currently we're using the fixed value of the timeout for
/// select. This value shouldn't be changed. Keeping it at 1s
/// guarantees that the main loop will be executed at least once
/// a seconds allowing for executing the interval timers associated
/// with the lease database backend in use. The intervals for these
/// timers are configured using the unit of 1 second. Bumping up
/// the select timeout would cause the timers to go out of sync
/// with the configured value.
/// Probing for the packets at this pace should not cause a
/// significant rise of the CPU usage. However, in the future we
/// should adjust the select timeout to the value reported by the
/// lease database backend as a minimal poll interval.
//cppcheck-suppress variableScope This is temporary anyway
const
int
timeout
=
1
000
;
const
int
timeout
=
1
;
// client's message and server's response
Pkt4Ptr
query
;
...
...
@@ -183,6 +195,15 @@ Dhcpv4Srv::run() {
// terminate.
handleSignal
();
// Execute ready timers for the lease database, e.g. Lease File Cleanup.
try
{
LeaseMgrFactory
::
instance
().
getIOService
()
->
get_io_service
().
poll
();
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_WARN
(
dhcp4_logger
,
DHCP4_LEASE_DATABASE_TIMERS_EXEC_FAIL
)
.
arg
(
ex
.
what
());
}
// Timeout may be reached or signal received, which breaks select()
// with no reception ocurred
if
(
!
query
)
{
...
...
src/bin/dhcp6/dhcp6_messages.mes
View file @
aaababbd
...
...
@@ -275,6 +275,13 @@ failed to grant a non-temporary address lease for the client. There may
be many reasons for such failure. Each failure is logged in a separate
log entry.
% DHCP6_LEASE_DATABASE_TIMERS_EXEC_FAIL failed to execute the timers for lease database: %1
A warning message executed when a server process is unable to execute
the periodic actions for the lease database. An example of the periodic
action is a Lease File Cleanup. One of the reasons for the failure is
a misconfiguration of the lease database, whereby the lease database
hasn't been selected.
% DHCP6_LEASE_NA_WITHOUT_DUID address lease for address %1 does not have a DUID
This error message indicates a database consistency problem. The lease
database has an entry indicating that the given address is in use,
...
...
src/bin/dhcp6/dhcp6_srv.cc
View file @
aaababbd
// Copyright (C) 2011-201
4
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2011-201
5
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
@@ -47,6 +47,8 @@
#include <util/io_utilities.h>
#include <util/range_utilities.h>
#include <asio.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
...
...
@@ -228,14 +230,20 @@ Dhcpv6Srv::testUnicast(const Pkt6Ptr& pkt) const {
bool
Dhcpv6Srv
::
run
()
{
while
(
!
shutdown_
)
{
/// @todo Calculate actual timeout to the next event (e.g. lease
/// expiration) once we have lease database. The idea here is that
/// it is possible to do everything in a single process/thread.
/// For now, we are just calling select for 1000 seconds. There
/// were some issues reported on some systems when calling select()
/// with too large values. Unfortunately, I don't recall the details.
/// @todo Currently we're using the fixed value of the timeout for
/// select. This value shouldn't be changed. Keeping it at 1s
/// guarantees that the main loop will be executed at least once
/// a seconds allowing for executing the interval timers associated
/// with the lease database backend in use. The intervals for these
/// timers are configured using the unit of 1 second. Bumping up
/// the select timeout would cause the timers to go out of sync
/// with the configured value.
/// Probing for the packets at this pace should not cause a
/// significant rise of the CPU usage. However, in the future we
/// should adjust the select timeout to the value reported by the
/// lease database backend as a minimal poll interval.
//cppcheck-suppress variableScope This is temporary anyway
const
int
timeout
=
1
000
;
const
int
timeout
=
1
;
// client's message and server's response
Pkt6Ptr
query
;
...
...
@@ -266,6 +274,15 @@ bool Dhcpv6Srv::run() {
// terminate.
handleSignal
();
// Execute ready timers for the lease database, e.g. Lease File Cleanup.
try
{
LeaseMgrFactory
::
instance
().
getIOService
()
->
get_io_service
().
poll
();
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_WARN
(
dhcp6_logger
,
DHCP6_LEASE_DATABASE_TIMERS_EXEC_FAIL
)
.
arg
(
ex
.
what
());
}
// Timeout may be reached or signal received, which breaks select()
// with no packet received
if
(
!
query
)
{
...
...
src/lib/dhcpsrv/dhcpsrv_messages.mes
View file @
aaababbd
...
...
@@ -302,6 +302,11 @@ memory.
A debug message issued when DHCPv6 lease is being loaded from the file to
memory.
% DHCPSRV_MEMFILE_LFC_SETUP setting up the Lease File Cleanup interval to %1 sec
An info message logged when the Memfile lease database backend configures
the LFC to be executed periodically. An argument holds the interval in seconds
in which the LFC will be executed.
% DHCPSRV_MEMFILE_LFC_START starting Lease File Cleanup
An info message issued when the Memfile lease database backend starts the
periodic Lease File Cleanup.
...
...
src/lib/dhcpsrv/memfile_lease_mgr.cc
View file @
aaababbd
...
...
@@ -491,6 +491,7 @@ Memfile_LeaseMgr::initTimers(const Universe& universe) {
if
(
lfc_interval
>
0
)
{
asiolink
::
IntervalTimer
::
Callback
cb
=
boost
::
bind
(
&
Memfile_LeaseMgr
::
lfcCallback
,
this
);
LOG_INFO
(
dhcpsrv_logger
,
DHCPSRV_MEMFILE_LFC_SETUP
).
arg
(
lfc_interval
);
lfc_timer_
.
setup
(
cb
,
lfc_interval
*
1000
);
}
}
...
...
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