INIT call srand() once at iscsi_create_context()
currently the rng is not seeded at all which makes the isid not really random at all.
This commit is contained in:
@@ -88,6 +88,8 @@ iscsi_create_context(const char *initiator_name)
|
||||
|
||||
iscsi->fd = -1;
|
||||
|
||||
srand(time(NULL) ^ getpid() ^ (u_int32_t) iscsi);
|
||||
|
||||
/* initialize to a "random" isid */
|
||||
iscsi_set_isid_random(iscsi, rand(), 0);
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
||||
break;
|
||||
}
|
||||
if (pchr2) {pchr=pchr2+1;}
|
||||
iface_c++;
|
||||
} while (pchr2);
|
||||
|
||||
int res = setsockopt(iscsi->fd, SOL_SOCKET, SO_BINDTODEVICE, pchr, strlen(pchr));
|
||||
|
||||
Reference in New Issue
Block a user