summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown2010-10-18 15:37:11 +0200
committerMichael Brown2010-10-18 15:40:27 +0200
commit19c59bb1317e58c44ce606dadbd0ee8dcfcf19ac (patch)
treec2b1cd12fdeaac0fa22634cfe69c885011a2ca82 /src/net
parent[romprefix] Add missing FILE_LICENCE declaration to undiloader.S (diff)
downloadipxe-19c59bb1317e58c44ce606dadbd0ee8dcfcf19ac.tar.gz
ipxe-19c59bb1317e58c44ce606dadbd0ee8dcfcf19ac.tar.xz
ipxe-19c59bb1317e58c44ce606dadbd0ee8dcfcf19ac.zip
[iscsi] Ensure ISID is consistent within an iSCSI session
Commit 5f4ab0d ("[iscsi] Randomise a portion of the ISID to force new session instantiation") introduced a regression by randomising the ISID on each call to iscsi_start_login(), which may be called more than once per connection, rather than on each call to iscsi_open_connection(), which is guaranteed to be called only once per connection. This is incorrect behaviour that causes our connection to be rejected by some iSCSI targets (observed with a COMSTAR target under OpenSolaris). Fix by generating the ISID in iscsi_open_connection(), and storing the randomised ISID as part of the session state. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tcp/iscsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index a483dd40a..5e003a816 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -246,6 +246,9 @@ static int iscsi_open_connection ( struct iscsi_session *iscsi ) {
if ( iscsi->target_username )
iscsi->status |= ISCSI_STATUS_AUTH_REVERSE_REQUIRED;
+ /* Assign new ISID */
+ iscsi->isid_iana_qual = ( random() & 0xffff );
+
/* Assign fresh initiator task tag */
iscsi_new_itt ( iscsi );
@@ -707,7 +710,7 @@ static void iscsi_start_login ( struct iscsi_session *iscsi ) {
ISCSI_SET_LENGTHS ( request->lengths, 0, len );
request->isid_iana_en = htonl ( ISCSI_ISID_IANA |
IANA_EN_FEN_SYSTEMS );
- request->isid_iana_qual = ( random() & 0xffff );
+ request->isid_iana_qual = htons ( iscsi->isid_iana_qual );
/* tsih left as zero */
request->itt = htonl ( iscsi->itt );
/* cid left as zero */