]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Fix iBFT when no explicit initiator name setting exists
authorMichael Brown <mcb30@ipxe.org>
Wed, 10 May 2017 14:30:51 +0000 (15:30 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 10 May 2017 15:01:47 +0000 (16:01 +0100)
Commit 7cfdd76 ("[block] Describe all SAN devices via ACPI tables")
changed the definition of the iSCSI initiator IQN in the iBFT to
represent a common initiator IQN used for all iSCSI sessions, and
attempted to calculate this common initiator IQN by fetching the
common ${initiator-iqn} setting.

This fails when no explicit ${initiator-iqn} has been specified
(i.e. when an initiator IQN has instead been constructed from either
the hostname or system UUID), and results in an empty initiator IQN in
the iBFT.

Fix by using the initiator IQN of an arbitrary iSCSI session
present in the iBFT.

Debugged-by: Tal Aloni <tal.aloni.il@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/block/ibft.c

index bb7812b3b096190fa669fee7920a0523bd07654f..f9918363a1059e3aed1c8697bfd354705cdcc453 100644 (file)
@@ -338,10 +338,12 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
  *
  * @v initiator                Initiator portion of iBFT
  * @v strings          iBFT string block descriptor
+ * @v initiator_iqn    Initiator IQN
  * @ret rc             Return status code
  */
 static int ibft_fill_initiator ( struct ibft_initiator *initiator,
-                                struct ibft_strings *strings ) {
+                                struct ibft_strings *strings,
+                                const char *initiator_iqn ) {
        int rc;
 
        /* Fill in common header */
@@ -352,9 +354,8 @@ static int ibft_fill_initiator ( struct ibft_initiator *initiator,
                                    IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED );
 
        /* Fill in initiator name */
-       if ( ( rc = ibft_set_string_setting ( NULL, strings,
-                                             &initiator->initiator_name,
-                                             &initiator_iqn_setting ) ) != 0 )
+       if ( ( rc = ibft_set_string ( strings, &initiator->initiator_name,
+                                     initiator_iqn ) ) != 0 )
                return rc;
        DBG ( "iBFT initiator name = %s\n",
              ibft_string ( strings, &initiator->initiator_name ) );
@@ -613,7 +614,10 @@ static int ibft_install ( int ( * install ) ( struct acpi_header *acpi ) ) {
        /* Fill in Initiator block */
        initiator = ( data + initiator_offset );
        table->control.initiator = cpu_to_le16 ( initiator_offset );
-       if ( ( rc = ibft_fill_initiator ( initiator, &strings ) ) != 0 )
+       iscsi = list_first_entry ( &ibft_model.descs, struct iscsi_session,
+                                  desc.list );
+       if ( ( rc = ibft_fill_initiator ( initiator, &strings,
+                                         iscsi->initiator_iqn ) ) != 0 )
                goto err_initiator;
 
        /* Fill in NIC blocks */