瀏覽代碼

[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 <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 年之前
父節點
當前提交
5f4ab0d22a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      src/net/tcp/iscsi.c

+ 1
- 1
src/net/tcp/iscsi.c 查看文件

707
 	ISCSI_SET_LENGTHS ( request->lengths, 0, len );
707
 	ISCSI_SET_LENGTHS ( request->lengths, 0, len );
708
 	request->isid_iana_en = htonl ( ISCSI_ISID_IANA |
708
 	request->isid_iana_en = htonl ( ISCSI_ISID_IANA |
709
 					IANA_EN_FEN_SYSTEMS );
709
 					IANA_EN_FEN_SYSTEMS );
710
-	/* isid_iana_qual left as zero */
710
+	request->isid_iana_qual = ( random() & 0xffff );
711
 	/* tsih left as zero */
711
 	/* tsih left as zero */
712
 	request->itt = htonl ( iscsi->itt );
712
 	request->itt = htonl ( iscsi->itt );
713
 	/* cid left as zero */
713
 	/* cid left as zero */

Loading…
取消
儲存