Skip to content

Commit

Permalink
[iscsi] Change default initiator IQN
Browse files Browse the repository at this point in the history
The default initiator IQN is "iqn.2000-09.org.etherboot:UNKNOWN".
This is problematic for two reasons:

  a) the etherboot.org domain (and hence the associated IQN namespace)
     is not under the control of the iPXE project, and

  b) some targets (correctly) refuse to allow concurrent connections
     from different initiators using the same initiator IQN.

Solve both problems by changing the default initiator IQN to be

  iqn.2010-04.org.ipxe:<hostname> if a hostname is set, or

  iqn.2010-04.org.ipxe:<uuid> if no hostname is set.

Explicit initiator IQNs set via DHCP option 203 are not affected by
this change.

Unfortunately, this change is likely to break some existing
configurations, where ACL rules have been put in place referring to
the old default initiator IQN.  Users may need to update ACLs, or
force the use of the old IQN using an iPXE script line such as

  set initiator-iqn iqn.2000-09.org.etherboot:UNKNOWN

or a dhcpd.conf option such as

   option iscsi-initiator-iqn "iqn.2000-09.org.etherboot:UNKNOWN"

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 3, 2011
1 parent bbe265e commit 960dee6
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 241 deletions.
11 changes: 6 additions & 5 deletions src/drivers/block/ibft.c
Expand Up @@ -281,11 +281,12 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
*
* @v initiator Initiator portion of iBFT
* @v strings iBFT string block descriptor
* @v iscsi iSCSI session
* @ret rc Return status code
*/
static int ibft_fill_initiator ( struct ibft_initiator *initiator,
struct ibft_strings *strings ) {
const char *initiator_iqn = iscsi_initiator_iqn();
struct ibft_strings *strings,
struct iscsi_session *iscsi ) {
int rc;

/* Fill in common header */
Expand All @@ -297,7 +298,7 @@ static int ibft_fill_initiator ( struct ibft_initiator *initiator,

/* Fill in hostname */
if ( ( rc = ibft_set_string ( strings, &initiator->initiator_name,
initiator_iqn ) ) != 0 )
iscsi->initiator_iqn ) ) != 0 )
return rc;
DBG ( "iBFT initiator hostname = %s\n",
ibft_string ( strings, &initiator->initiator_name ) );
Expand Down Expand Up @@ -468,8 +469,8 @@ int ibft_describe ( struct iscsi_session *iscsi,
/* Fill in NIC, Initiator and Target blocks */
if ( ( rc = ibft_fill_nic ( &ibft->nic, &strings, netdev ) ) != 0 )
return rc;
if ( ( rc = ibft_fill_initiator ( &ibft->initiator,
&strings ) ) != 0 )
if ( ( rc = ibft_fill_initiator ( &ibft->initiator, &strings,
iscsi ) ) != 0 )
return rc;
if ( ( rc = ibft_fill_target ( &ibft->target, &strings,
iscsi ) ) != 0 )
Expand Down
5 changes: 4 additions & 1 deletion src/include/ipxe/iscsi.h
Expand Up @@ -543,6 +543,8 @@ struct iscsi_session {
/** Transport-layer socket */
struct interface socket;

/** Initiator IQN */
char *initiator_iqn;
/** Target address */
char *target_address;
/** Target port */
Expand Down Expand Up @@ -694,6 +696,7 @@ struct iscsi_session {
/** Target authenticated itself correctly */
#define ISCSI_STATUS_AUTH_REVERSE_OK 0x00040000

extern const char * iscsi_initiator_iqn ( void );
/** Default initiator IQN prefix */
#define ISCSI_DEFAULT_IQN_PREFIX "iqn.2010-04.org.ipxe"

#endif /* _IPXE_ISCSI_H */

0 comments on commit 960dee6

Please sign in to comment.