mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[694-add-valid-lifetime-to-dhcp4_lease_alloc-and-dhcp6_lease_alloc-logging] Added lease valid lifetime to DHCP*_LEASE_ALLOC logs
This commit is contained in:
@@ -373,11 +373,11 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&,
|
|||||||
if (rcode == 0) {
|
if (rcode == 0) {
|
||||||
CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
|
CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
|
||||||
|
|
||||||
// Update the fetch globals callback.
|
// Update the fetch globals callback.
|
||||||
auto cfg = CfgMgr::instance().getStagingCfg()->getD2ClientConfig();
|
auto cfg = CfgMgr::instance().getStagingCfg()->getD2ClientConfig();
|
||||||
cfg->setFetchGlobalsFn([]() -> ConstElementPtr {
|
cfg->setFetchGlobalsFn([]() -> ConstElementPtr {
|
||||||
return (CfgMgr::instance().getCurrentCfg()->getConfiguredGlobals());
|
return (CfgMgr::instance().getCurrentCfg()->getConfiguredGlobals());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use new configuration.
|
// Use new configuration.
|
||||||
CfgMgr::instance().commit();
|
CfgMgr::instance().commit();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed May 22 2019 18:21
|
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Tue Jun 25 2019 10:19
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <log/message_types.h>
|
#include <log/message_types.h>
|
||||||
@@ -210,7 +210,7 @@ const char* values[] = {
|
|||||||
"DHCP4_INIT_FAIL", "failed to initialize Kea server: %1",
|
"DHCP4_INIT_FAIL", "failed to initialize Kea server: %1",
|
||||||
"DHCP4_INIT_REBOOT", "%1: client is in INIT-REBOOT state and requests address %2",
|
"DHCP4_INIT_REBOOT", "%1: client is in INIT-REBOOT state and requests address %2",
|
||||||
"DHCP4_LEASE_ADVERT", "%1: lease %2 will be advertised",
|
"DHCP4_LEASE_ADVERT", "%1: lease %2 will be advertised",
|
||||||
"DHCP4_LEASE_ALLOC", "%1: lease %2 has been allocated",
|
"DHCP4_LEASE_ALLOC", "%1: lease %2 has been allocated for %3",
|
||||||
"DHCP4_NCR_CREATE", "%1: DDNS updates enabled, therefore sending name change requests",
|
"DHCP4_NCR_CREATE", "%1: DDNS updates enabled, therefore sending name change requests",
|
||||||
"DHCP4_NCR_CREATION_FAILED", "%1: failed to generate name change requests for DNS: %2",
|
"DHCP4_NCR_CREATION_FAILED", "%1: failed to generate name change requests for DNS: %2",
|
||||||
"DHCP4_NOT_RUNNING", "DHCPv4 server is not running",
|
"DHCP4_NOT_RUNNING", "DHCPv4 server is not running",
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed May 22 2019 18:21
|
// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Tue Jun 25 2019 10:19
|
||||||
|
|
||||||
#ifndef DHCP4_MESSAGES_H
|
#ifndef DHCP4_MESSAGES_H
|
||||||
#define DHCP4_MESSAGES_H
|
#define DHCP4_MESSAGES_H
|
||||||
|
@@ -399,12 +399,13 @@ those which offered leases and continue allocation with that server.
|
|||||||
The first argument specifies the client and the transaction identification
|
The first argument specifies the client and the transaction identification
|
||||||
information. The second argument specifies the IPv4 address to be offered.
|
information. The second argument specifies the IPv4 address to be offered.
|
||||||
|
|
||||||
% DHCP4_LEASE_ALLOC %1: lease %2 has been allocated
|
% DHCP4_LEASE_ALLOC %1: lease %2 has been allocated for %3
|
||||||
This informational message indicates that the server successfully granted a
|
This informational message indicates that the server successfully granted a
|
||||||
lease in response to client's DHCPREQUEST message. The lease information will
|
lease in response to client's DHCPREQUEST message. The lease information will
|
||||||
be sent to the client in the DHCPACK message. The first argument contains the
|
be sent to the client in the DHCPACK message. The first argument contains the
|
||||||
client and the transaction identification information. The second argument
|
client and the transaction identification information. The second argument
|
||||||
contains the allocated IPv4 address.
|
contains the allocated IPv4 address. The third argument is the validity
|
||||||
|
lifetime.
|
||||||
|
|
||||||
% DHCP4_NCR_CREATE %1: DDNS updates enabled, therefore sending name change requests
|
% DHCP4_NCR_CREATE %1: DDNS updates enabled, therefore sending name change requests
|
||||||
This debug message is issued when the server is starting to send
|
This debug message is issued when the server is starting to send
|
||||||
|
@@ -2120,9 +2120,16 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) {
|
|||||||
if (lease) {
|
if (lease) {
|
||||||
// We have a lease! Let's set it in the packet and send it back to
|
// We have a lease! Let's set it in the packet and send it back to
|
||||||
// the client.
|
// the client.
|
||||||
LOG_INFO(lease4_logger, fake_allocation ? DHCP4_LEASE_ADVERT : DHCP4_LEASE_ALLOC)
|
if (fake_allocation) {
|
||||||
.arg(query->getLabel())
|
LOG_INFO(lease4_logger, DHCP4_LEASE_ADVERT)
|
||||||
.arg(lease->addr_.toText());
|
.arg(query->getLabel())
|
||||||
|
.arg(lease->addr_.toText());
|
||||||
|
} else {
|
||||||
|
LOG_INFO(lease4_logger, DHCP4_LEASE_ALLOC)
|
||||||
|
.arg(query->getLabel())
|
||||||
|
.arg(lease->addr_.toText())
|
||||||
|
.arg(lease->valid_lft_);
|
||||||
|
}
|
||||||
|
|
||||||
// We're logging this here, because this is the place where we know
|
// We're logging this here, because this is the place where we know
|
||||||
// which subnet has been actually used for allocation. If the
|
// which subnet has been actually used for allocation. If the
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Wed May 22 2019 18:12
|
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Jun 25 2019 10:19
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <log/message_types.h>
|
#include <log/message_types.h>
|
||||||
@@ -217,7 +217,7 @@ const char* values[] = {
|
|||||||
"DHCP6_INIT_FAIL", "failed to initialize Kea server: %1",
|
"DHCP6_INIT_FAIL", "failed to initialize Kea server: %1",
|
||||||
"DHCP6_LEASE_ADVERT", "%1: lease for address %2 and iaid=%3 will be advertised",
|
"DHCP6_LEASE_ADVERT", "%1: lease for address %2 and iaid=%3 will be advertised",
|
||||||
"DHCP6_LEASE_ADVERT_FAIL", "%1: failed to advertise an address lease for iaid=%2",
|
"DHCP6_LEASE_ADVERT_FAIL", "%1: failed to advertise an address lease for iaid=%2",
|
||||||
"DHCP6_LEASE_ALLOC", "%1: lease for address %2 and iaid=%3 has been allocated",
|
"DHCP6_LEASE_ALLOC", "%1: lease for address %2 and iaid=%3 has been allocated for %4",
|
||||||
"DHCP6_LEASE_ALLOC_FAIL", "%1: failed to grant an address lease for iaid=%2",
|
"DHCP6_LEASE_ALLOC_FAIL", "%1: failed to grant an address lease for iaid=%2",
|
||||||
"DHCP6_LEASE_DATA", "%1: detailed lease information for iaid=%2: %3",
|
"DHCP6_LEASE_DATA", "%1: detailed lease information for iaid=%2: %3",
|
||||||
"DHCP6_LEASE_NA_WITHOUT_DUID", "%1: address lease for address %2 does not have a DUID",
|
"DHCP6_LEASE_NA_WITHOUT_DUID", "%1: address lease for address %2 does not have a DUID",
|
||||||
@@ -246,7 +246,7 @@ const char* values[] = {
|
|||||||
"DHCP6_PARSER_FAIL", "failed to create or run parser for configuration element %1: %2",
|
"DHCP6_PARSER_FAIL", "failed to create or run parser for configuration element %1: %2",
|
||||||
"DHCP6_PD_LEASE_ADVERT", "%1: lease for prefix %2/%3 and iaid=%4 will be advertised",
|
"DHCP6_PD_LEASE_ADVERT", "%1: lease for prefix %2/%3 and iaid=%4 will be advertised",
|
||||||
"DHCP6_PD_LEASE_ADVERT_FAIL", "%1: failed to advertise a prefix lease for iaid=%2",
|
"DHCP6_PD_LEASE_ADVERT_FAIL", "%1: failed to advertise a prefix lease for iaid=%2",
|
||||||
"DHCP6_PD_LEASE_ALLOC", "%1: lease for prefix %2/%3 and iaid=%4 has been allocated",
|
"DHCP6_PD_LEASE_ALLOC", "%1: lease for prefix %2/%3 and iaid=%4 has been allocated for %5",
|
||||||
"DHCP6_PD_LEASE_ALLOC_FAIL", "%1: failed to grant a prefix lease for iaid=%2",
|
"DHCP6_PD_LEASE_ALLOC_FAIL", "%1: failed to grant a prefix lease for iaid=%2",
|
||||||
"DHCP6_PD_LEASE_RENEW", "%1: lease for prefix %2/%3 and iaid=%4 has been allocated",
|
"DHCP6_PD_LEASE_RENEW", "%1: lease for prefix %2/%3 and iaid=%4 has been allocated",
|
||||||
"DHCP6_PROCESS_IA_NA_EXTEND", "%1: extending lease lifetime for IA_NA option with iaid=%2",
|
"DHCP6_PROCESS_IA_NA_EXTEND", "%1: extending lease lifetime for IA_NA option with iaid=%2",
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Wed May 22 2019 18:12
|
// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Jun 25 2019 10:19
|
||||||
|
|
||||||
#ifndef DHCP6_MESSAGES_H
|
#ifndef DHCP6_MESSAGES_H
|
||||||
#define DHCP6_MESSAGES_H
|
#define DHCP6_MESSAGES_H
|
||||||
|
@@ -429,13 +429,13 @@ be many reasons for such failure. Each failure is logged in a separate
|
|||||||
log entry. The first argument holds the client and transaction identification
|
log entry. The first argument holds the client and transaction identification
|
||||||
information. The second argument holds the IAID.
|
information. The second argument holds the IAID.
|
||||||
|
|
||||||
% DHCP6_LEASE_ALLOC %1: lease for address %2 and iaid=%3 has been allocated
|
% DHCP6_LEASE_ALLOC %1: lease for address %2 and iaid=%3 has been allocated for %4
|
||||||
This informational message indicates that in response to a client's REQUEST
|
This informational message indicates that in response to a client's REQUEST
|
||||||
message, the server successfully granted a non-temporary address
|
message, the server successfully granted a non-temporary address
|
||||||
lease. This is a normal behavior and indicates successful operation.
|
lease. This is a normal behavior and indicates successful operation.
|
||||||
The first argument includes the client and transaction identification
|
The first argument includes the client and transaction identification
|
||||||
information. The remaining arguments hold the allocated address and
|
information. The remaining arguments hold the allocated address,
|
||||||
IAID.
|
IAID and validity lifetime.
|
||||||
|
|
||||||
% DHCP6_LEASE_ALLOC_FAIL %1: failed to grant an address lease for iaid=%2
|
% DHCP6_LEASE_ALLOC_FAIL %1: failed to grant an address lease for iaid=%2
|
||||||
This message indicates that in response to a received REQUEST, the server
|
This message indicates that in response to a received REQUEST, the server
|
||||||
@@ -612,13 +612,13 @@ be many reasons for such failure. Each failure is logged in a separate
|
|||||||
log entry. The first argument holds the client and transaction identification
|
log entry. The first argument holds the client and transaction identification
|
||||||
information. The second argument holds the IAID.
|
information. The second argument holds the IAID.
|
||||||
|
|
||||||
% DHCP6_PD_LEASE_ALLOC %1: lease for prefix %2/%3 and iaid=%4 has been allocated
|
% DHCP6_PD_LEASE_ALLOC %1: lease for prefix %2/%3 and iaid=%4 has been allocated for %5
|
||||||
This informational message indicates that in response to a client's REQUEST
|
This informational message indicates that in response to a client's REQUEST
|
||||||
message, the server successfully granted a prefix lease.
|
message, the server successfully granted a prefix lease.
|
||||||
This is a normal behavior and indicates successful operation.
|
This is a normal behavior and indicates successful operation.
|
||||||
The first argument includes the client and transaction identification
|
The first argument includes the client and transaction identification
|
||||||
information. The remaining arguments hold the allocated prefix,
|
information. The remaining arguments hold the allocated prefix,
|
||||||
prefix length and and IAID.
|
prefix length, IAID and validity lifetime.
|
||||||
|
|
||||||
% DHCP6_PD_LEASE_ALLOC_FAIL %1: failed to grant a prefix lease for iaid=%2
|
% DHCP6_PD_LEASE_ALLOC_FAIL %1: failed to grant a prefix lease for iaid=%2
|
||||||
This message indicates that in response to a received REQUEST, the server
|
This message indicates that in response to a received REQUEST, the server
|
||||||
|
@@ -1835,10 +1835,18 @@ Dhcpv6Srv::assignIA_NA(const Pkt6Ptr& query, const Pkt6Ptr& answer,
|
|||||||
if (lease) {
|
if (lease) {
|
||||||
// We have a lease! Let's wrap its content into IA_NA option
|
// We have a lease! Let's wrap its content into IA_NA option
|
||||||
// with IAADDR suboption.
|
// with IAADDR suboption.
|
||||||
LOG_INFO(lease6_logger, ctx.fake_allocation_ ? DHCP6_LEASE_ADVERT : DHCP6_LEASE_ALLOC)
|
if (ctx.fake_allocation_) {
|
||||||
.arg(query->getLabel())
|
LOG_INFO(lease6_logger, DHCP6_LEASE_ADVERT)
|
||||||
.arg(lease->addr_.toText())
|
.arg(query->getLabel())
|
||||||
.arg(ia->getIAID());
|
.arg(lease->addr_.toText())
|
||||||
|
.arg(ia->getIAID());
|
||||||
|
} else {
|
||||||
|
LOG_INFO(lease6_logger, DHCP6_LEASE_ALLOC)
|
||||||
|
.arg(query->getLabel())
|
||||||
|
.arg(lease->addr_.toText())
|
||||||
|
.arg(ia->getIAID())
|
||||||
|
.arg(lease->valid_lft_);
|
||||||
|
}
|
||||||
LOG_DEBUG(lease6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_LEASE_DATA)
|
LOG_DEBUG(lease6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_LEASE_DATA)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(ia->getIAID())
|
.arg(ia->getIAID())
|
||||||
@@ -1948,12 +1956,20 @@ Dhcpv6Srv::assignIA_PD(const Pkt6Ptr& query, const Pkt6Ptr& /*answer*/,
|
|||||||
|
|
||||||
// We have a lease! Let's wrap its content into IA_PD option
|
// We have a lease! Let's wrap its content into IA_PD option
|
||||||
// with IAADDR suboption.
|
// with IAADDR suboption.
|
||||||
LOG_INFO(lease6_logger, ctx.fake_allocation_ ?
|
if (ctx.fake_allocation_) {
|
||||||
DHCP6_PD_LEASE_ADVERT : DHCP6_PD_LEASE_ALLOC)
|
LOG_INFO(lease6_logger, DHCP6_PD_LEASE_ADVERT)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg((*l)->addr_.toText())
|
.arg((*l)->addr_.toText())
|
||||||
.arg(static_cast<int>((*l)->prefixlen_))
|
.arg(static_cast<int>((*l)->prefixlen_))
|
||||||
.arg(ia->getIAID());
|
.arg(ia->getIAID());
|
||||||
|
} else {
|
||||||
|
LOG_INFO(lease6_logger, DHCP6_PD_LEASE_ALLOC)
|
||||||
|
.arg(query->getLabel())
|
||||||
|
.arg((*l)->addr_.toText())
|
||||||
|
.arg(static_cast<int>((*l)->prefixlen_))
|
||||||
|
.arg(ia->getIAID())
|
||||||
|
.arg((*l)->valid_lft_);
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Option6IAPrefix>
|
boost::shared_ptr<Option6IAPrefix>
|
||||||
addr(new Option6IAPrefix(D6O_IAPREFIX, (*l)->addr_,
|
addr(new Option6IAPrefix(D6O_IAPREFIX, (*l)->addr_,
|
||||||
|
Reference in New Issue
Block a user