Browse Source

[iscsi] Fix iBFT when no explicit initiator name setting exists

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>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
a19ac24971
1 changed files with 9 additions and 5 deletions
  1. 9
    5
      src/drivers/block/ibft.c

+ 9
- 5
src/drivers/block/ibft.c View File

338
  *
338
  *
339
  * @v initiator		Initiator portion of iBFT
339
  * @v initiator		Initiator portion of iBFT
340
  * @v strings		iBFT string block descriptor
340
  * @v strings		iBFT string block descriptor
341
+ * @v initiator_iqn	Initiator IQN
341
  * @ret rc		Return status code
342
  * @ret rc		Return status code
342
  */
343
  */
343
 static int ibft_fill_initiator ( struct ibft_initiator *initiator,
344
 static int ibft_fill_initiator ( struct ibft_initiator *initiator,
344
-				 struct ibft_strings *strings ) {
345
+				 struct ibft_strings *strings,
346
+				 const char *initiator_iqn ) {
345
 	int rc;
347
 	int rc;
346
 
348
 
347
 	/* Fill in common header */
349
 	/* Fill in common header */
352
 				    IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED );
354
 				    IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED );
353
 
355
 
354
 	/* Fill in initiator name */
356
 	/* Fill in initiator name */
355
-	if ( ( rc = ibft_set_string_setting ( NULL, strings,
356
-					      &initiator->initiator_name,
357
-					      &initiator_iqn_setting ) ) != 0 )
357
+	if ( ( rc = ibft_set_string ( strings, &initiator->initiator_name,
358
+				      initiator_iqn ) ) != 0 )
358
 		return rc;
359
 		return rc;
359
 	DBG ( "iBFT initiator name = %s\n",
360
 	DBG ( "iBFT initiator name = %s\n",
360
 	      ibft_string ( strings, &initiator->initiator_name ) );
361
 	      ibft_string ( strings, &initiator->initiator_name ) );
613
 	/* Fill in Initiator block */
614
 	/* Fill in Initiator block */
614
 	initiator = ( data + initiator_offset );
615
 	initiator = ( data + initiator_offset );
615
 	table->control.initiator = cpu_to_le16 ( initiator_offset );
616
 	table->control.initiator = cpu_to_le16 ( initiator_offset );
616
-	if ( ( rc = ibft_fill_initiator ( initiator, &strings ) ) != 0 )
617
+	iscsi = list_first_entry ( &ibft_model.descs, struct iscsi_session,
618
+				   desc.list );
619
+	if ( ( rc = ibft_fill_initiator ( initiator, &strings,
620
+					  iscsi->initiator_iqn ) ) != 0 )
617
 		goto err_initiator;
621
 		goto err_initiator;
618
 
622
 
619
 	/* Fill in NIC blocks */
623
 	/* Fill in NIC blocks */

Loading…
Cancel
Save