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
4924ba41
Commit
4924ba41
authored
Sep 05, 2013
by
Marcin Siodelski
Browse files
[3035] Implemented function to enqueue new NameChangeRequests.
parent
df155072
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_messages.mes
View file @
4924ba41
...
...
@@ -134,6 +134,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_NCR_CREATION_FAILED failed to generate name change requests for DNS: %1
This message indicates that server was unable to generate so called
NameChangeRequests which should be sent to the b10-dhcp_ddns module to create
new DNS records for the lease being acquired or to update existing records
for the renewed lease. The reason for the failure is printed in the logged
message.
% DHCP4_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic
This warning message is issued when current server configuration specifies
no interfaces that server should listen on, or specified interfaces are not
...
...
@@ -211,6 +218,16 @@ failure is given in the message.
% DHCP4_QUERY_DATA received packet type %1, data is <%2>
A debug message listing the data received from the client.
% DHCP4_QUEUE_ADDITION_NCR name change request for adding new DNS entry queued: %1
A debug message which is logged when the NameChangeRequest to add new DNS
entries for the particular lease has been queued. The parameter of this log
carries the details of the NameChangeRequest.
% DHCP4_QUEUE_REMOVAL_NCR name change request for removing a DNS entry queued: %1
A debug message which is logged when the NameChangeRequest to remove existing
DNS entry for the particular lease has been queued. The parameter of this log
carries the details of the NameChangeRequest.
% DHCP4_RELEASE address %1 belonging to client-id %2, hwaddr %3 was released properly.
This debug message indicates that an address was released properly. It
is a normal operation during client shutdown.
...
...
src/bin/dhcp4/dhcp4_srv.cc
View file @
4924ba41
...
...
@@ -884,7 +884,7 @@ Dhcpv4Srv::createNameChangeRequests(const Lease4Ptr& lease,
old_lease
->
hostname_
,
old_lease
->
addr_
.
toText
(),
dhcid
,
0
,
old_lease
->
valid_lft_
);
n
ame
_c
hange
_reqs_
.
push
(
ncr
);
queueN
ame
C
hange
Request
(
ncr
);
// If FQDN data from both leases match, there is no need to update.
}
else
if
((
lease
->
hostname_
==
old_lease
->
hostname_
)
&&
...
...
@@ -905,10 +905,27 @@ Dhcpv4Srv::createNameChangeRequests(const Lease4Ptr& lease,
lease
->
fqdn_fwd_
,
lease
->
fqdn_rev_
,
lease
->
hostname_
,
lease
->
addr_
.
toText
(),
dhcid
,
0
,
lease
->
valid_lft_
);
n
ame
_c
hange
_reqs_
.
push
(
ncr
);
queueN
ame
C
hange
Request
(
ncr
);
}
}
void
Dhcpv4Srv
::
queueNameChangeRequest
(
const
isc
::
dhcp_ddns
::
NameChangeRequest
&
ncr
)
{
if
(
ncr
.
getChangeType
()
==
isc
::
dhcp_ddns
::
CHG_ADD
)
{
LOG_DEBUG
(
dhcp4_logger
,
DBG_DHCP4_DETAIL_DATA
,
DHCP4_QUEUE_ADDITION_NCR
)
.
arg
(
ncr
.
toText
());
}
else
{
LOG_DEBUG
(
dhcp4_logger
,
DBG_DHCP4_DETAIL_DATA
,
DHCP4_QUEUE_REMOVAL_NCR
)
.
arg
(
ncr
.
toText
());
}
name_change_reqs_
.
push
(
ncr
);
}
void
Dhcpv4Srv
::
assignLease
(
const
Pkt4Ptr
&
question
,
Pkt4Ptr
&
answer
)
{
...
...
@@ -999,6 +1016,21 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// @todo: send renew timer option (T1, option 58)
// @todo: send rebind timer option (T2, option 59)
// @todo Currently the NameChangeRequests are always generated if
// real (not fake) allocation is being performed. Should we have
// control switch to enable/disable NameChangeRequest creation?
// Perhaps we need a way to detect whether the b10-dhcp-ddns module
// is up an running?
if
(
!
fake_allocation
)
{
try
{
createNameChangeRequests
(
lease
,
old_lease
);
}
catch
(
const
Exception
&
ex
)
{
LOG_ERROR
(
dhcp4_logger
,
DHCP4_NCR_CREATION_FAILED
)
.
arg
(
ex
.
what
());
}
}
}
else
{
// Allocation engine did not allocate a lease. The engine logged
// cause of that failure. The only thing left is to insert
...
...
src/bin/dhcp4/dhcp4_srv.h
View file @
4924ba41
...
...
@@ -329,6 +329,16 @@ protected:
void
createNameChangeRequests
(
const
Lease4Ptr
&
lease
,
const
Lease4Ptr
&
old_lease
);
/// @brief Adds the NameChangeRequest to the queue for processing.
///
/// This function adds the @c isc::dhcp_ddns::NameChangeRequest to the
/// queue and emits the debug message which indicates whether the request
/// being added is to remove DNS entry or add a new entry. This function
/// is exception free.
///
/// @param ncr An isc::dhcp_ddns::NameChangeRequest object being added.
void
queueNameChangeRequest
(
const
isc
::
dhcp_ddns
::
NameChangeRequest
&
ncr
);
/// @brief Attempts to renew received addresses
///
/// Attempts to renew existing lease. This typically includes finding a lease that
...
...
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