Przeglądaj źródła

[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 lat temu
rodzic
commit
a19ac24971
1 zmienionych plików z 9 dodań i 5 usunięć
  1. 9
    5
      src/drivers/block/ibft.c

+ 9
- 5
src/drivers/block/ibft.c Wyświetl plik

@@ -338,10 +338,12 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
338 338
  *
339 339
  * @v initiator		Initiator portion of iBFT
340 340
  * @v strings		iBFT string block descriptor
341
+ * @v initiator_iqn	Initiator IQN
341 342
  * @ret rc		Return status code
342 343
  */
343 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 347
 	int rc;
346 348
 
347 349
 	/* Fill in common header */
@@ -352,9 +354,8 @@ static int ibft_fill_initiator ( struct ibft_initiator *initiator,
352 354
 				    IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED );
353 355
 
354 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 359
 		return rc;
359 360
 	DBG ( "iBFT initiator name = %s\n",
360 361
 	      ibft_string ( strings, &initiator->initiator_name ) );
@@ -613,7 +614,10 @@ static int ibft_install ( int ( * install ) ( struct acpi_header *acpi ) ) {
613 614
 	/* Fill in Initiator block */
614 615
 	initiator = ( data + initiator_offset );
615 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 621
 		goto err_initiator;
618 622
 
619 623
 	/* Fill in NIC blocks */

Ładowanie…
Anuluj
Zapisz