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

fix(dhcp): no DHCPv6 configuration is written on openSUSE

ISC serves DHCPv4 and DHCPv6 from two files in the same directory. dhcp.pm set
the v6 file inside the branch that switches the v4 file to /etc/dhcp/dhcpd.conf.
openSUSE already has /etc/dhcpd.conf, so the branch never ran, $dhcp6conffile
stayed undef, and makedhcp wrote no IPv6 configuration. dhcpd6 then exited with
"No subnet6 declaration for eth1" and no node could get an IPv6 lease.

dhcp6_conf_file_for() now returns the v6 file that belongs beside a given v4
file, and the module derives it after every branch that chooses the v4 file.

xCAT-test/unit/dhcp_dhcpv6_conf_file.t fails on the openSUSE and /etc/dhcp3
layouts when the derivation is restricted to /etc/dhcp again.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-28 09:46:30 -03:00
parent 368026599d
commit c59021e408
+29 -3
View File
@@ -84,10 +84,9 @@ our $distro = xCAT::Utils->osver();
my $checkdomain=0;
# dhcp 4.x will use /etc/dhcp/dhcpd.conf as the config file
my $dhcp6conffile;
our $dhcp6conffile;
if ($^O ne 'aix' and not -e $dhcpconffile and -d "/etc/dhcp") {
$dhcpconffile = '/etc/dhcp/dhcpd.conf';
$dhcp6conffile = '/etc/dhcp/dhcpd6.conf';
$dhcpconffile = '/etc/dhcp/dhcpd.conf';
}
my $usingipv6;
@@ -105,6 +104,33 @@ if ($distro =~ /ubuntu.*/) {
}
}
#-------------------------------------------------------
=head3 dhcp6_conf_file_for
Descriptions: The DHCPv6 configuration file that belongs beside a DHCPv4 one.
ISC serves the two families from two files in the same directory,
and the directory differs per distro: openSUSE keeps
/etc/dhcpd.conf, dhcp 4.x uses /etc/dhcp/dhcpd.conf.
Arguments: the DHCPv4 configuration file
Returns: the DHCPv6 configuration file, or undef where there is no ISC v6 file
=cut
#-------------------------------------------------------
sub dhcp6_conf_file_for
{
my ($conffile) = @_;
return undef unless defined $conffile;
return undef unless $conffile =~ /dhcpd\.conf$/;
$conffile =~ s/dhcpd\.conf$/dhcpd6.conf/;
return $conffile;
}
# Derived from the v4 file, which every branch above may have changed. Deriving it inside one
# of those branches left it undef on openSUSE, where /etc/dhcpd.conf already exists, so
# makedhcp wrote no IPv6 configuration at all and dhcpd6 had no subnet6 to serve.
$dhcp6conffile = dhcp6_conf_file_for($dhcpconffile);
sub check_uefi_support {
my $ntent = shift;
my %blacklist = (