2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 17:02:15 +00:00

fix(dhcp): a node cannot netboot over DHCPv6 with the ISC backend

makedhcp wrote no boot file into a DHCPv6 reservation, so the firmware took the
reserved address and had nothing to load. EDK2 reported "PXE-E21: Remote boot
cancelled" and tried the next boot entry, which reads as a DHCP failure although
the address was granted. Measured on openEuler 24.03: dhcpd6.conf carried no
bootfile reference where the DHCPv4 configuration carried fifteen.

addnode6 now emits option dhcp6.bootfile-url, which is RFC 5970 option 59, from
the same helpers the Kea backend uses. Those two helpers read noderes and
BootPolicy, not Kea, so they lose their kea_ prefix.

Two further defects kept the same node from booting. The DHCPv6 daemon was never
started: ISC runs it as a second service, the flag that recorded the need was
assigned and never read, restart_dhcpd restarted only the DHCPv4 service, and the
service map had no ISC DHCPv6 name. And makedhcp failed with "The file
/etc/sysconfig/dhcpd6 doesn't exist" although no EL or openEuler dhcp package
ships that file and dhcpd6 does not need it: with the file deleted the daemon
still binds the provisioning NIC, because ISC dhcpd listens only on the
interfaces its subnet declarations name.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-28 02:41:54 -03:00
parent 3389c1ccd1
commit e375c064ce
2 changed files with 28 additions and 9 deletions
+3
View File
@@ -4264,6 +4264,9 @@ sub servicemap {
#
my %svchash = (
"dhcp" => [ "dhcp3-server", "dhcpd", "isc-dhcp-server" ],
# The second ISC daemon, which serves DHCPv6. Debian serves both families from
# isc-dhcp-server and has no v6-only unit, so the name does not resolve there.
"dhcp6" => [ "dhcpd6" ],
"kea-dhcp4" => [ "kea-dhcp4", "kea-dhcp4-server", "isc-kea-dhcp4-server" ],
"kea-dhcp6" => [ "kea-dhcp6", "kea-dhcp6-server", "isc-kea-dhcp6-server" ],
"kea-ctrl-agent" => [ "kea-ctrl-agent", "kea-ctrl-agent-server", "isc-kea-ctrl-agent" ],
+25 -9
View File
@@ -853,7 +853,15 @@ sub addnode6 {
$commands .= "new host\n";
$commands .= "set name = \"$node\"\n";
$commands .= "set dhcp-client-identifier = $duid\n";
$commands .= 'set statements = "ddns-hostname \"' . $node . '\";";' . "\n";
# RFC 5970 option 59. Without it the firmware takes the reserved address and has nothing
# to load, so EDK2 reports "PXE-E21: Remote boot cancelled" and tries the next boot entry.
my $nrent = $nrhash ? $nrhash->{$node}->[0] : undef;
my $ntent = $nodetypeents ? $nodetypeents->{$node}->[0] : undef;
my $bootfile_url = dhcp6_bootfile_url_for_node( $node, $node, $nrent, $ntent );
my $statements6 = 'ddns-hostname \"' . $node . '\";';
$statements6 .= ' option dhcp6.bootfile-url \"' . $bootfile_url . '\";' if $bootfile_url;
$commands .= 'set statements = "' . $statements6 . '";' . "\n";
if ($ip) {
$commands .= "set ip-address = $ip\n";
@@ -2384,10 +2392,6 @@ sub process_request
if ($missingfiles{dhcpd}) {
$callback->({ error => ["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"] });
}
} else {
if ($missingfiles{dhcpd6}) {
$callback->({ error => ["The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"] });
}
}
}
if ($missingfiles{dhcpd}) {
@@ -2710,6 +2714,10 @@ sub process_request
print "xx";
}
}
if (not $::XCATSITEVALS{externaldhcpservers} and $restartdhcp6 and $^O ne 'aix') {
xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: restart dhcp6 service");
restart_dhcpd6();
}
flock($dhcplockfd, LOCK_UN);
umask $oldmask;
}
@@ -4432,7 +4440,7 @@ sub kea_node_reservations6
} else {
$reservation{'hw-address'} = $mac;
}
my $bootfile_url = kea_bootfile_url6_for_node($node, $hname, $nrent, $ntent);
my $bootfile_url = dhcp6_bootfile_url_for_node($node, $hname, $nrent, $ntent);
if ($bootfile_url) {
$reservation{'option-data'} = [
{
@@ -4449,7 +4457,7 @@ sub kea_node_reservations6
return \@reservations;
}
sub kea_bootfile_url6_for_node
sub dhcp6_bootfile_url_for_node
{
my ( $node, $peer, $nrent, $ntent ) = @_;
@@ -4459,7 +4467,7 @@ sub kea_bootfile_url6_for_node
|| $netboot eq 'grub2-http'
|| $netboot eq 'grub2-tftp');
my $server = kea_boot_server6_for_node($node, $peer, $nrent);
my $server = dhcp6_boot_server_for_node($node, $peer, $nrent);
return unless $server;
my $uri_host = xCAT::NetworkUtils->format_uri_host($server);
@@ -4475,7 +4483,7 @@ sub kea_bootfile_url6_for_node
return "tftp://$uri_host/boot/grub2/$loader";
}
sub kea_boot_server6_for_node
sub dhcp6_boot_server_for_node
{
my ( $node, $peer, $nrent ) = @_;
@@ -4922,6 +4930,14 @@ sub restart_dhcpd
return xCAT::Utils->restartservice("dhcp");
}
# Restart the ISC DHCPv6 daemon. It is a second service, so restarting dhcpd leaves it
# with the previous configuration -- or stopped, which grants no address at all.
# restartservice answers -1 where the name does not resolve, as on Debian.
sub restart_dhcpd6
{
return xCAT::Utils->restartservice("dhcp6");
}
# Restart dhcpd on aix
sub restart_dhcpd_aix
{