From: Thomas Markwalder Date: Tue, 21 Mar 2023 18:59:52 +0000 (-0400) Subject: [#225] Updated arm X-Git-Tag: Kea-2.3.6~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1880494948a07fb8b790e01a0fcf1fbb6d8c6a3c;p=thirdparty%2Fkea.git [#225] Updated arm doc/sphinx/arm/dhcp4-srv.rst doc/sphinx/arm/dhcp4-srv.rst updated DDNS parameter doc Added a ChangeLog entry --- diff --git a/ChangeLog b/ChangeLog index 7df1bfb1fd..9a116e157e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2119. [func] tmark + Added a new parameter, ddns-ttl-percent, to kea-dhcp4 + and kea-dhcp6, that may be used to calculate DNS TTL + as a simple percentage of the lease life time. + (Gitlab #225) + 2118. [bug] razvan Fixed a bug which was changing the multi-threading settings when running config-test command and the settings were different from diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json index 6d6375893e..cfdc08bd62 100644 --- a/doc/examples/kea4/all-keys.json +++ b/doc/examples/kea4/all-keys.json @@ -776,7 +776,7 @@ "ddns-use-conflict-resolution": true, // Shared network level value. See description at the global level. - "ddns-ttl-percent": 0.75, + "ddns-ttl-percent": 0.65, // Shared network level value. See description at the global level. "hostname-char-replacement": "x", @@ -918,7 +918,7 @@ "ddns-use-conflict-resolution": true, // Subnet level value. See description at the global level. - "ddns-ttl-percent": 0.75, + "ddns-ttl-percent": 0.55, // Subnet level value. See description at the global level. "hostname-char-replacement": "x", diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index 7e4184a655..895bf21f4c 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -3369,6 +3369,7 @@ DDNS-related parameters are split into two groups: - ``ddns-qualifying-suffix`` - ``ddns-update-on-renew`` - ``ddns-use-conflict-resolution`` + - ``ddns-ttl-percent`` - ``hostname-char-set`` - ``hostname-char-replacement`` @@ -3408,6 +3409,7 @@ The default configuration and values would appear as follows: "ddns-qualifying-suffix": "", "ddns-update-on-renew": false, "ddns-use-conflict-resolution": true, + "ddns-ttl-percent": 0.75, "hostname-char-set": "", "hostname-char-replacement": "" ... @@ -3492,14 +3494,18 @@ conflict with existing entries owned by other DHCPv4 clients. reassigning either FQDNs or IP addresses. Doing so causes ``kea-dhcp4`` to generate DNS removal requests to D2. -.. note:: - - The DNS entries Kea creates contain a value for TTL (time to live). Since - Kea 1.9.3, ``kea-dhcp4`` calculates that value based on - `RFC 4702, Section 5 `__, - which suggests that the TTL value be 1/3 of the lease's lifetime, with - a minimum value of 10 minutes. In earlier versions, the server set the TTL value - equal to the lease's valid lifetime. +The DNS entries Kea creates contain a value for TTL (time to live). Since +Kea 1.9.3, ``kea-dhcp4`` calculates that value based on +`RFC 4702, Section 5 `__, +which suggests that the TTL value be 1/3 of the lease's lifetime, with +a minimum value of 10 minutes. In earlier versions, the server set the +TTL value equal to the lease's valid lifetime. + +Kea 2.3.6 adds a new parameter, ``ddns-ttl-percent``. When specified +it causes the TTL to be calculated as a simple percentage of the lease's +life time, using the parameter's value as the percentage. It is specified +as a decimal percent (e.g. .25, .75, 1.00) and may be specified at the +global, shared-network, and subnet levels. By default it is unspecified. .. _dhcpv4-d2-io-config: diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index 4d6a48a7ce..f506d317e6 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -2952,6 +2952,7 @@ DDNS-related parameters are split into two groups: - ``ddns-qualifying-suffix`` - ``ddns-update-on-renew`` - ``ddns-use-conflict-resolution`` + - ``ddns-ttl-percent`` - ``hostname-char-set`` - ``hostname-char-replacement`` @@ -2991,6 +2992,7 @@ The default configuration and values would appear as follows: "ddns-qualifying-suffix": "", "ddns-update-on-renew": false, "ddns-use-conflict-resolution": true, + "ddns-ttl-percent": 0.75, "hostname-char-set": "", "hostname-char-replacement": "" ... @@ -3075,14 +3077,18 @@ conflict with existing entries owned by other DHCPv6 clients. reassigning either FQDNs or IP addresses. Doing so causes ``kea-dhcp6`` to generate DNS removal requests to D2. -.. note:: - - The DNS entries Kea creates contain a value for TTL (time to live). Since - Kea 1.9.3, ``kea-dhcp6`` calculates that value based on - `RFC 4702, Section 5 `__, - which suggests that the TTL value be 1/3 of the lease's lifetime, with - a minimum value of 10 minutes. In earlier versions, the server set the TTL value - equal to the lease's valid lifetime. +The DNS entries Kea creates contain a value for TTL (time to live). Since +Kea 1.9.3, ``kea-dhcp6`` calculates that value based on +`RFC 4702, Section 5 `__, +which suggests that the TTL value be 1/3 of the lease's lifetime, with +a minimum value of 10 minutes. In earlier versions, the server set the +TTL value equal to the lease's valid lifetime. + +Kea 2.3.6 adds a new parameter, ``ddns-ttl-percent``. When specified +it causes the TTL to be calculated as a simple percentage of the lease's +life time, using the parameter's value as the percentage. It is specified +as a decimal percent (e.g. .25, .75, 1.00) and may be specified at the +global, shared-network, and subnet levels. By default it is unspecified. .. _dhcpv6-d2-io-config: diff --git a/src/lib/dhcpsrv/ncr_generator.h b/src/lib/dhcpsrv/ncr_generator.h index 2994481780..2011912a78 100644 --- a/src/lib/dhcpsrv/ncr_generator.h +++ b/src/lib/dhcpsrv/ncr_generator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2015-2023 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -44,13 +44,17 @@ void queueNCR(const dhcp_ddns::NameChangeType& chg_type, const Lease6Ptr& lease) /// @brief Calculates TTL for a DNS resource record based on lease life time. /// -/// Per RFC 4702 Section 5, the RR TTL should be calculated as: -/// TTL = ((lease life time / 3) < 10 minutes) ? 10 minutes : (lease life time / 3) +/// If the parameter, ddns_ttl_percent is greater than zero, it is used to calculate +/// the TTL directly: +/// +/// TTL = (lease life time * ddns-ttl-percent) /// -/// This function may be expanded in the future to support configurable -/// parameters. +/// Otherwise it is calculated as per RFC 4702 Section 5: +/// +/// TTL = ((lease life time / 3) < 10 minutes) ? 10 minutes : (lease life time / 3) /// /// @param lease_life_time valid life time of the lease +/// @param ddns_ttl_percent optional percentage to use in calculation /// /// @return the calculated TTL. uint32_t calculateDdnsTtl(uint32_t lease_life_time,