]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Randomise a portion of the ISID to force new session instantiation
authorMichael Brown <mcb30@ipxe.org>
Sat, 16 Oct 2010 21:11:08 +0000 (22:11 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sat, 16 Oct 2010 21:11:08 +0000 (22:11 +0100)
When a connection to an iSCSI target is broken without gracefully
closing the TCP socket, a subsequent connection attempt may fail
because the target believes that we are attempting session
reinstatement (see RFC3720 section 5.3.1).  This has been observed
using the Microsoft iSCSI target.

Section 9.1.1 of RFC3720 states that initiators should use a stable
ISID, however section 5.3.1 shows that the only way to explicitly
request that a new session be created is to use a new ISID.

Fix by randomising the "qualifier" portion of the ISID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/tcp/iscsi.c

index e19f4d8279c8eabf66fd09ec7a8b4e47f361e806..a483dd40a324caf08961906e186b256bd99bcbec 100644 (file)
@@ -707,7 +707,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 );
-       /* isid_iana_qual left as zero */
+       request->isid_iana_qual = ( random() & 0xffff );
        /* tsih left as zero */
        request->itt = htonl ( iscsi->itt );
        /* cid left as zero */