39template<
typename LeasePtrType,
typename IdentifierType>
40void queueNCRCommon(
const NameChangeType& chg_type,
const LeasePtrType& lease,
44 if (lease->hostname_.empty() || (!lease->fqdn_fwd_ && !lease->fqdn_rev_)
49 .arg(lease->addr_.toText());
62 static_cast<void>(ddns_params.setPoolFromAddress(lease->addr_));
64 auto mode = ddns_params.getConflictResolutionMode();
69 ddns_ttl_percent = ddns_params.getTtlPercent();
70 ddns_ttl = ddns_params.getTtl();
71 ddns_ttl_min = ddns_params.getTtlMin();
72 ddns_ttl_max = ddns_params.getTtlMax();
77 std::vector<uint8_t> hostname_wire;
83 ddns_ttl_percent, ddns_ttl,
84 ddns_ttl_min, ddns_ttl_max);
89 lease->hostname_, lease->addr_.toText(),
90 dhcid, lease->cltt_ + ttl,
91 ttl, conflict_resolution_mode));
95 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
101 }
catch (
const std::exception& ex) {
104 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
105 .arg(lease->addr_.toText())
120 ->getCfgSubnets4()->getSubnet(lease->subnet_id_);
123 if (lease->client_id_) {
124 queueNCRCommon(chg_type, lease, lease->client_id_->getClientId(),
129 queueNCRCommon(chg_type, lease, lease->hwaddr_,
141 ->getCfgSubnets6()->getSubnet(lease->subnet_id_);
142 queueNCRCommon(chg_type, lease, *(lease->duid_),
154 return (ddns_ttl.
get());
158 double ttl_percent = (ddns_ttl_percent.
get() > 0.0 ?
159 ddns_ttl_percent.
get() : 0.33333);
162 uint32_t ttl =
static_cast<uint32_t
>(round(ttl_percent * lease_lft));
167 uint32_t ttl_min = (ddns_ttl_min.
get() > 0) ? ddns_ttl_min.
get() : 600;
179 uint32_t ttl_max = ddns_ttl_max.
get();
180 if (ttl_max && ttl > ttl_max) {
D2ClientMgr & getD2ClientMgr()
Fetches the DHCP-DDNS manager.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
bool ddnsEnabled()
Convenience method for checking if DHCP-DDNS is enabled.
void sendRequest(dhcp_ddns::NameChangeRequestPtr &ncr)
Send the given NameChangeRequests to kea-dhcp-ddns.
Convenience container for conveying DDNS behavioral parameters It is intended to be created per Packe...
static void writeFqdn(const std::string &fqdn, std::vector< uint8_t > &buf, const bool downcase=false)
Append FQDN into a buffer.
static std::string makeLabel(const HWAddrPtr &hwaddr, const ClientIdPtr &client_id, const uint32_t transid)
Returns text representation of the given packet identifiers.
static std::string makeLabel(const DuidPtr duid, const uint32_t transid, const HWAddrPtr &hwaddr)
Returns text representation of the given packet identifiers.
Container class for handling the DHCID value within a NameChangeRequest.
Represents a DHCP-DDNS client request.
A template representing an optional value.
T get() const
Retrieves the encapsulated value.
void unspecified(bool unspecified)
Modifies the flag that indicates whether the value is specified or unspecified.
Defines the D2ClientMgr class.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
ConflictResolutionMode StringToConflictResolutionMode(const std::string &mode_str)
Function which converts string to ConflictResolutionMode enum values.
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
NameChangeType
Defines the types of DNS updates that can be requested.
const int DHCPSRV_DBG_TRACE_DETAIL_DATA
Additional information.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
uint32_t calculateDdnsTtl(uint32_t lease_lft, const util::Optional< double > &ddns_ttl_percent, const util::Optional< uint32_t > &ddns_ttl, const util::Optional< uint32_t > &ddns_ttl_min, const util::Optional< uint32_t > &ddns_ttl_max)
Calculates TTL for a DNS resource record based on lease life time.
const isc::log::MessageID DHCPSRV_QUEUE_NCR
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
const isc::log::MessageID DHCPSRV_DDNS_TTL_TOO_LARGE
const isc::log::MessageID DHCPSRV_QUEUE_NCR_FAILED
const int DHCPSRV_DBG_TRACE_DETAIL
Additional information.
const isc::log::MessageID DHCPSRV_QUEUE_NCR_SKIP
const isc::log::MessageID DHCPSRV_DDNS_TTL_TOO_SMALL
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
string dumpDouble(double val, size_t precision)
Converts a double to a string with given precision.
Defines the logger used by the top-level component of kea-lfc.
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)