Skip to content

Commit

Permalink
[iscsi] Fix iBFT when no explicit initiator name setting exists
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed May 10, 2017
1 parent 785389c commit a19ac24
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/drivers/block/ibft.c
Expand Up @@ -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 */
Expand All @@ -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 ) );
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit a19ac24

Please sign in to comment.