mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-19 17:02:15 +00:00
fix(xcat-core): a ppc64le node is reserved for a DHCPv6 identifier its firmware never sends
SLOF, the open firmware of a PowerKVM guest and a PowerVM LPAR, identifies itself with an RFC 3315 DUID-LL built from the MAC of its interface, and it reports no UUID at all. makedhcp derives every DHCPv6 reservation from vpd.uuid, so the reservation of a ppc64le node can never match: measured on an IPv6-only node, SLOF sent 00:03:00:01:<mac> against the 00:04:<uuid> reservation xCAT wrote. The node gets no reserved address and no RFC 5970 option 59, and its firmware has nothing to load. dhcp6_client_duid now takes the MAC and the architecture. kea_duid_ll_from_mac builds the DUID-LL from the first address of mac.mac, which is the interface that netboots, and dhcp6_firmware_duid_is_link_layer says which architectures send one. A ppc64le node takes the DUID-LL with no attribute set, and the byte-order warning about vpd.uuid is not reported for it, because that firmware does not read the value. mac.duid gains ll, which selects the DUID-LL on any architecture. firmware and canonical are unchanged and still override. One reservation covers the whole netboot: the grub2 ieee1275 network stack builds its DUID from the same interface, so the loader sends what the firmware sent. That is why no second reservation is written, unlike a chainloading UEFI node. dhcp_dhcpv6_duid.t gains five cases. On the unfixed tree 15 of its 195 assertions fail, cn11 with the firmware-order DUID-UUID where the DUID-LL is expected. A mutation that gives every architecture the DUID-LL fails 42, naming the x86_64 cases that must keep the DUID-UUID. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -56,7 +56,7 @@ mac Attributes:
|
||||
|
||||
\ **duid**\
|
||||
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, or a DUID. firmware (the default): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, ll, or a DUID. firmware (the default on an architecture whose firmware sends a UUID): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. ll: the DUID-LL built from the first address of mac.mac, which is what SLOF sends and what the grub2 ieee1275 network stack builds from the same interface. ll is the default on ppc64le, because SLOF reports no UUID at all and no DUID-UUID can match it. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ group Attributes:
|
||||
|
||||
\ **duid**\ (mac.duid)
|
||||
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, or a DUID. firmware (the default): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, ll, or a DUID. firmware (the default on an architecture whose firmware sends a UUID): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. ll: the DUID-LL built from the first address of mac.mac, which is what SLOF sends and what the grub2 ieee1275 network stack builds from the same interface. ll is the default on ppc64le, because SLOF reports no UUID at all and no DUID-UUID can match it. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ node Attributes:
|
||||
|
||||
\ **duid**\ (mac.duid)
|
||||
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, or a DUID. firmware (the default): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, ll, or a DUID. firmware (the default on an architecture whose firmware sends a UUID): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. ll: the DUID-LL built from the first address of mac.mac, which is what SLOF sends and what the grub2 ieee1275 network stack builds from the same interface. ll is the default on ppc64le, because SLOF reports no UUID at all and no DUID-UUID can match it. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ Without the attribute, the DUID is the DUID-UUID that UEFI firmware built on EDK
|
||||
Earlier xCAT releases stored ``vpd.uuid`` with the first three fields swapped for nodes from Genesis discovery and for KVM guests from \ **mkvm**\ , \ **clonevm**\ or \ **rscan**\ .
|
||||
Set ``vpd.uuid`` of such a node to the UUID that it reports.
|
||||
\ **makedhcp**\ warns about a node whose ``vpd.uuid`` looks byte-swapped, and never changes the value.
|
||||
The warning is reported only for a node with no ``duid`` attribute. Setting ``duid`` to ``firmware``, to ``canonical`` or to a DUID silences it.
|
||||
The warning is reported only for a node with no ``duid`` attribute, on an architecture whose firmware sends a UUID. Setting ``duid`` to ``firmware``, to ``canonical``, to ``ll`` or to a DUID silences it.
|
||||
The check reads the version field, which a swap moves, so it does not report every swapped value and it reports a UUID that does not follow RFC 4122.
|
||||
The warning is a report, not a diagnosis.
|
||||
A swap moves the version field, but it leaves a valid version in the first field about half the time.
|
||||
@@ -104,7 +104,8 @@ A swap moves the version field, but it leaves a valid version in the first field
|
||||
A node whose ``vpd.uuid`` is the nil UUID gets no DUID from it, because \ **nodeimport**\ writes that one value to every PowerKVM node.
|
||||
With Kea DHCP such a node keeps the reservation of its MAC address, like a node with no ``vpd.uuid``.
|
||||
With ISC DHCP it gets no DHCPv6 host, again like a node with no ``vpd.uuid``.
|
||||
Set ``duid=canonical`` for a client that sends ``vpd.uuid`` in RFC 4122 byte order, or set the DUID itself.
|
||||
Set ``duid=canonical`` for a client that sends ``vpd.uuid`` in RFC 4122 byte order, or set ``duid=ll`` for one that sends the DUID-LL of its MAC, or set the DUID itself.
|
||||
On ppc64le the DUID is that DUID-LL with no attribute set, because SLOF sends it and reports no UUID at all. Nothing above applies to such a node: ``vpd.uuid`` is not read for it, and no warning is reported about it.
|
||||
When the firmware and the operating system of a node send different identifiers, only the client that ``duid`` selects gets the reserved address.
|
||||
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ passed as argument rather than by table value',
|
||||
node => 'The node name or group name.',
|
||||
interface => 'The adapter interface name that will be used to install and manage the node. E.g. eth0 (for linux) or en0 (for AIX).)',
|
||||
mac => 'The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default.',
|
||||
duid => 'The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, or a DUID. firmware (the default): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.',
|
||||
duid => 'The DHCPv6 client identifier (DUID) that the IPv6 reservations of the node match. Valid values are firmware, canonical, ll, or a DUID. firmware (the default on an architecture whose firmware sends a UUID): the DUID-UUID that UEFI firmware built on EDK2 sends, which holds vpd.uuid with its first three fields in the little-endian order that SMBIOS 2.6 and later use. canonical: the DUID-UUID with vpd.uuid in RFC 4122 network byte order, which a client sends when it encodes the UUID that the operating system reports. ll: the DUID-LL built from the first address of mac.mac, which is what SLOF sends and what the grub2 ieee1275 network stack builds from the same interface. ll is the default on ppc64le, because SLOF reports no UUID at all and no DUID-UUID can match it. A DUID: the identifier itself, as colon-separated hexadecimal octets, for example 00:01:00:01:2e:4f:61:a0:02:00:00:00:00:61. Like a MAC address, a DUID identifies one client: when two nodes have the same DUID, the reservation belongs to the node that makedhcp updated last. A reservation matches one DUID. When the firmware and the operating system send different identifiers, set the identifier of the client that must get the reserved address.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
|
||||
@@ -72,7 +72,8 @@ B<makedhcp> cannot report those rows, and it cannot read the UUID that the node
|
||||
A node whose C<vpd.uuid> is the nil UUID gets no DUID from it, because B<nodeimport> writes that one value to every PowerKVM node.
|
||||
With Kea DHCP such a node keeps the reservation of its MAC address, like a node with no C<vpd.uuid>.
|
||||
With ISC DHCP it gets no DHCPv6 host, again like a node with no C<vpd.uuid>.
|
||||
Set C<duid=canonical> for a client that sends C<vpd.uuid> in RFC 4122 byte order, or set the DUID itself.
|
||||
Set C<duid=canonical> for a client that sends C<vpd.uuid> in RFC 4122 byte order, or set C<duid=ll> for one that sends the DUID-LL of its MAC, or set the DUID itself.
|
||||
On ppc64le the DUID is that DUID-LL with no attribute set, because SLOF sends it and reports no UUID at all. Nothing above applies to such a node: C<vpd.uuid> is not read for it, and no warning is reported about it.
|
||||
When the firmware and the operating system of a node send different identifiers, only the client that C<duid> selects gets the reserved address.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -4701,9 +4701,42 @@ sub kea_duid_from_uuid
|
||||
return '00:04:' . join(':', @octets);
|
||||
}
|
||||
|
||||
#---
|
||||
# =head3 kea_duid_ll_from_mac
|
||||
# Descriptions: The RFC 3315 DUID-LL that a client builds from the address of its own interface:
|
||||
# type 0003, hardware type 0001 for Ethernet, then the MAC. SLOF sends this one, and
|
||||
# the grub2 ieee1275 network stack builds the same one from the same interface, so a
|
||||
# single reservation covers both stages of a ppc64le netboot.
|
||||
# Arguments: $mac -- the mac attribute of the mac table
|
||||
# Returns: the DUID, or undef when the value holds no usable address. The provisioning NIC is the
|
||||
# first entry, which is the interface that netboots.
|
||||
#---
|
||||
sub kea_duid_ll_from_mac
|
||||
{
|
||||
my ($mac) = @_;
|
||||
|
||||
return unless defined($mac) && length($mac);
|
||||
( $mac ) = split( /\|/, $mac );
|
||||
( $mac ) = split( /!/, $mac );
|
||||
$mac = kea_normalize_mac($mac);
|
||||
return unless $mac;
|
||||
return '00:03:00:01:' . $mac;
|
||||
}
|
||||
|
||||
#: Whether the firmware of an architecture identifies itself by its link-layer address instead of
|
||||
#: by a UUID. SLOF reports no UUID at all, so a DUID-UUID reservation can never match a ppc64le
|
||||
#: node however the UUID is ordered. EDK2 and its AAVMF build, on x86_64 and on aarch64, send the
|
||||
#: UUID.
|
||||
sub dhcp6_firmware_duid_is_link_layer
|
||||
{
|
||||
my ($arch) = @_;
|
||||
|
||||
return ( defined($arch) && $arch =~ /\Appc/i ) ? 1 : 0;
|
||||
}
|
||||
|
||||
sub dhcp6_client_duid
|
||||
{
|
||||
my ( $setting, $uuid ) = @_;
|
||||
my ( $setting, $uuid, $mac, $arch ) = @_;
|
||||
|
||||
my $choice = lc( defined($setting) ? $setting : '' );
|
||||
$choice =~ s/^\s+|\s+$//g;
|
||||
@@ -4711,6 +4744,9 @@ sub dhcp6_client_duid
|
||||
# The warning is reported only when no duid attribute is set. Setting one is the remedy it
|
||||
# asks for, so firmware and canonical must silence it as a literal DUID already does.
|
||||
if ( $choice eq '' ) {
|
||||
# The warning below is about the order of vpd.uuid, which this firmware does not read.
|
||||
return ( kea_duid_ll_from_mac($mac), undef, undef )
|
||||
if dhcp6_firmware_duid_is_link_layer($arch);
|
||||
my $duid = kea_duid_from_uuid( $uuid, 'firmware' );
|
||||
return ( $duid, undef, dhcp6_uuid_order_warning($uuid) );
|
||||
}
|
||||
@@ -4720,8 +4756,11 @@ sub dhcp6_client_duid
|
||||
if ( $choice eq 'canonical' ) {
|
||||
return ( kea_duid_from_uuid($uuid), undef, undef );
|
||||
}
|
||||
if ( $choice eq 'll' ) {
|
||||
return ( kea_duid_ll_from_mac($mac), undef, undef );
|
||||
}
|
||||
return $choice if $choice =~ /\A[0-9a-f]{2}(?::[0-9a-f]{2}){2,129}\z/;
|
||||
return ( undef, "only firmware, canonical, or a DUID of colon-separated hexadecimal octets is supported" );
|
||||
return ( undef, "only firmware, canonical, ll, or a DUID of colon-separated hexadecimal octets is supported" );
|
||||
}
|
||||
|
||||
#---
|
||||
@@ -4736,7 +4775,8 @@ sub dhcp6_client_duid
|
||||
# $uuid -- vpd.uuid
|
||||
# $primary -- the DUID that $setting selects, which keeps the reserved address
|
||||
# Returns: an arrayref of { duid => <duid>, client => 'firmware'|'ipxe' }, the primary first.
|
||||
# A literal DUID gives one entry: there is no UUID to derive the other order from.
|
||||
# A literal DUID and a DUID-LL give one entry: neither is built from the UUID, so there
|
||||
# is no second order to derive.
|
||||
#---
|
||||
sub dhcp6_client_duid_list
|
||||
{
|
||||
@@ -4777,16 +4817,21 @@ sub dhcp6_client_duids
|
||||
|
||||
my $mactab = xCAT::Table->new('mac');
|
||||
my $vpdtab = xCAT::Table->new('vpd', -create => 0);
|
||||
my $settings = $mactab ? $mactab->getNodesAttribs($nodes, ['duid']) : undef;
|
||||
my $nttab = xCAT::Table->new('nodetype', -create => 0);
|
||||
my $settings = $mactab ? $mactab->getNodesAttribs($nodes, [ 'duid', 'mac' ]) : undef;
|
||||
my $uuids = $vpdtab ? $vpdtab->getNodesAttribs($nodes, ['uuid']) : undef;
|
||||
# The architecture, because it decides which identifier the firmware of the node sends.
|
||||
my $arches = $nttab ? $nttab->getNodesAttribs($nodes, ['arch']) : undef;
|
||||
|
||||
my %duids;
|
||||
foreach my $node (@$nodes) {
|
||||
my $macent = $settings && $settings->{$node} ? $settings->{$node}->[0] : undef;
|
||||
my $vpdent = $uuids && $uuids->{$node} ? $uuids->{$node}->[0] : undef;
|
||||
my $ntent = $arches && $arches->{$node} ? $arches->{$node}->[0] : undef;
|
||||
my $setting = $macent ? $macent->{duid} : undef;
|
||||
my $uuid = $vpdent ? $vpdent->{uuid} : undef;
|
||||
my ( $duid, $error, $warning ) = dhcp6_client_duid( $setting, $uuid );
|
||||
my ( $duid, $error, $warning ) = dhcp6_client_duid(
|
||||
$setting, $uuid, ( $macent ? $macent->{mac} : undef ), ( $ntent ? $ntent->{arch} : undef ) );
|
||||
$duids{$node} = {
|
||||
duid => $duid,
|
||||
duids => dhcp6_client_duid_list( $setting, $uuid, $duid ),
|
||||
|
||||
Reference in New Issue
Block a user