From: Michael Brown Date: Sat, 16 Oct 2010 21:11:08 +0000 (+0100) Subject: [iscsi] Randomise a portion of the ISID to force new session instantiation X-Git-Tag: v1.20.1~2468 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f4ab0d22ab385ca5ba4d5783a6557676c60e417;p=thirdparty%2Fipxe.git [iscsi] Randomise a portion of the ISID to force new session instantiation 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 --- diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index e19f4d827..a483dd40a 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -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 */