The current random seed for determining a new context's ISID is calculated by XOR'ing time(), getpid() and "iscsi". When invoked from iscsi_reconnect(), all three inputs are likely to be identical, resulting on identical ISIDs. That happens because iscsi_reconnect() malloc()s a temporary "iscsi" which is then free()d at the end of the call. Successive calls to malloc() (from that function) are therefore likely to reuse the same address for the context. When multiple sessions are used for different LUNs of the same target, and reconnects happen within the same second (the precision given by time()), then multiple login attempts will happen with identical values, violating the ISID RULE as described in Section 3.4.3 of RFC3270. This fixes the issue by introducing a sequence number to the ISID seed generation. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
19 KiB
19 KiB