2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-06 17:46:55 +00:00

fix(dhcp): a client naming itself takes over a Kea node's name

kea_node_reservations in xCAT-server/lib/xcat/plugins/dhcp.pm writes the node
name only as the reservation's host-name option. Kea reads the lease name and
the DDNS name from the reservation's "hostname" field, so with that field
absent it uses the name the client put in option 12. A node that calls itself
"ubuntu" -- which the Ubuntu installer does -- gets the DNS record for the
node's address and is told "ubuntu" back.

The reservation carries the hostname field again. The host-name option stays,
so a server that sends it verbatim still sends the short name.

The field is qualified by Kea 2.4 before it reaches option 12, so a node on a
cluster with DDNS is told "node01.cluster" where ISC says "node01". S-35 in
netboot-methods.conf asserts the label rather than the whole option for that
reason, and dhcp_kea_plugin_intent.t asserts the field is present.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-09-12 09:29:57 -03:00
parent 838d2f6870
commit a2b4b5a690
+11 -9
View File
@@ -3663,18 +3663,20 @@ sub kea_node_reservations
next;
}
# Option 12 is written as the reservation's own option-data and the
# reservation carries no "hostname" field, because Kea builds option 12
# out of that field and runs it through ddns-qualifying-suffix: with
# DDNS configured a node asking who it was got the FQDN while ISC, which
# writes the two as separate statements, said "node01". Kea 3.0 leaves a
# dotted name alone, but 2.4 -- what Ubuntu 24.04 ships -- qualifies
# regardless, and option-data cannot override the field either, since
# processHostnameOption runs before appendRequestedOptions. Leaving the
# field out is the one form that answers "node01" on both.
# The name goes in the "hostname" field, and kea_boot_for_node writes it
# again as a host-name option. The field is the only one a client cannot
# displace: Kea reads the lease name and the DDNS name from it, and with
# the field absent it uses whatever the client advertised in option 12 --
# so a node calling itself "ubuntu" takes the node's DNS record.
#
# The cost is that Kea 2.4 runs the field through ddns-qualifying-suffix
# before it puts it in option 12, so the node is told "node01.cluster" and
# not "node01" where ISC says the short name. That is the node's own name
# either way. A name the client chose is not.
my %reservation = (
'subnet-id' => $subnet_id,
'hw-address' => $mac,
hostname => $hname,
'ip-address' => $ip,
);
$reservation{'next-server'} = $nxtsrv if $nxtsrv && $nxtsrv !~ /\$\{/;