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());
60 auto mode = subnet->getDdnsConflictResolutionMode();
65 ddns_ttl_percent = subnet->getDdnsTtlPercent();
66 ddns_ttl = subnet->getDdnsTtl();
67 ddns_ttl_min = subnet->getDdnsTtlMin();
68 ddns_ttl_max = subnet->getDdnsTtlMax();
73 std::vector<uint8_t> hostname_wire;
79 ddns_ttl_percent, ddns_ttl,
80 ddns_ttl_min, ddns_ttl_max);
85 lease->hostname_, lease->addr_.toText(),
86 dhcid, lease->cltt_ + ttl,
87 ttl, conflict_resolution_mode));
91 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
97 }
catch (
const std::exception& ex) {
100 .arg(chg_type ==
CHG_ADD ?
"add" :
"remove")
101 .arg(lease->addr_.toText())
116 ->getCfgSubnets4()->getSubnet(lease->subnet_id_);
119 if (lease->client_id_) {
120 queueNCRCommon(chg_type, lease, lease->client_id_->getClientId(),
125 queueNCRCommon(chg_type, lease, lease->hwaddr_,
137 ->getCfgSubnets6()->getSubnet(lease->subnet_id_);
138 queueNCRCommon(chg_type, lease, *(lease->duid_),
150 return (ddns_ttl.
get());
154 double ttl_percent = (ddns_ttl_percent.
get() > 0.0 ?
155 ddns_ttl_percent.
get() : 0.33333);
158 uint32_t ttl =
static_cast<uint32_t
>(round(ttl_percent * lease_lft));
163 uint32_t ttl_min = (ddns_ttl_min.
get() > 0) ? ddns_ttl_min.
get() : 600;
175 uint32_t ttl_max = ddns_ttl_max.
get();
176 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.
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.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
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< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
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< Network > NetworkPtr
Pointer to the Network 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)