From 5f4ab0d22ab385ca5ba4d5783a6557676c60e417 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 16 Oct 2010 22:11:08 +0100 Subject: [PATCH] [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 --- src/net/tcp/iscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index e19f4d82..a483dd40 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 */