From b44a3700865731d23079fea1a7f81260f01be87c Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Wed, 4 Dec 2024 15:04:10 -0500 Subject: [PATCH] [#1989] Updated ARM Changes to be committed: modified: doc/sphinx/arm/dhcp4-srv.rst modified: doc/sphinx/arm/hooks-ddns-tuning.rst --- doc/sphinx/arm/dhcp4-srv.rst | 7 +++++++ doc/sphinx/arm/hooks-ddns-tuning.rst | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index e148115115..254f9e8268 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -4029,6 +4029,13 @@ qualifying suffix is "example.com", and the default value is used for ``myhost-172-16-1-10.example.com.`` +.. note:: + + When the client sends the host name option, ``kea-dhcp4`` never adds a dot to + the returned host name. It will only end with a dot if the client sent it + already qualified and ending with a dot. When the client sends the FQDN option, + the FQDN returned in the response will always end with a dot. + .. _dhcp4-host-name-sanitization: Sanitizing Client Host Name and FQDN Names diff --git a/doc/sphinx/arm/hooks-ddns-tuning.rst b/doc/sphinx/arm/hooks-ddns-tuning.rst index 72b2a49e8c..1c28d5033f 100644 --- a/doc/sphinx/arm/hooks-ddns-tuning.rst +++ b/doc/sphinx/arm/hooks-ddns-tuning.rst @@ -59,6 +59,23 @@ expression is shown below: ... } +The default behavior of :iscman:`kea-dhcp4` is to prefer the FQDN option (code 81) over the +host name option (code 12) when a client sends both. The following example shows +the ``hostname-expr`` one would use to reverse this rule: + +.. code-block:: javascript + + { + "hooks-libraries": [ + { + "library": "/usr/local/lib/libdhcp_ddns_tuning.so", + "parameters": { + "hostname-expr" : "ifelse(option[12].exists, option[host-name].text, option[81].text)" + } + }, + ], + } + It is also possible to define this parameter in a subnet, using the user-context mechanism. If defined at the subnet level, the expression applies to a specific subnet only. If the subnet expression is defined as empty, ``""``, it suppresses (or disables) the use of a @@ -73,19 +90,13 @@ global expression for that subnet. An example subnet expression is shown below: "pool": "192.0.2.10 - 192.0.2.20" } ], - // This is a subnet-specific user context. "user-context": { "ddns-tuning": { "hostname-expr": "'guest-'+int8totext(substring(pkt4.yiaddr, 0,1))+'-' \ +int8totext(substring(pkt4.yiaddr, 1,2))+'-' \ +int8totext(substring(pkt4.yiaddr, 2,3))+'-' \ +int8totext(substring(pkt4.yiaddr, 3,4))" - }, - "last-modified": "2017-09-04 13:32", - "description": "you can put anything you like here", - "phones": [ "x1234", "x2345" ], - "devices-registered": 42, - "billing": false + } } }], ...