aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iscsi
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2014-07-06 17:37:49 +0000
committerAlexander Motin <mav@FreeBSD.org>2014-07-06 17:37:49 +0000
commitffe82e05b393d25718aff79c2d2b1c7f453b9f76 (patch)
tree5346eff0128ea101760a11da63e9ead7ef3cf165 /sys/dev/iscsi
parent0558e4bb2b74b38cfd0b7372d13098a7d2e9c1b8 (diff)
Notes
Diffstat (limited to 'sys/dev/iscsi')
-rw-r--r--sys/dev/iscsi/iscsi.c8
-rw-r--r--sys/dev/iscsi/iscsi.h1
-rw-r--r--sys/dev/iscsi/iscsi_ioctl.h10
3 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 22f84623c9803..5fabdcc82582e 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1221,6 +1221,9 @@ iscsi_ioctl_daemon_wait(struct iscsi_softc *sc,
ISCSI_SESSION_UNLOCK(is);
request->idr_session_id = is->is_id;
+ memcpy(&request->idr_isid, &is->is_isid,
+ sizeof(request->idr_isid));
+ request->idr_tsih = 0; /* New or reinstated session. */
memcpy(&request->idr_conf, &is->is_conf,
sizeof(request->idr_conf));
@@ -1270,7 +1273,7 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc,
strlcpy(is->is_target_alias, handoff->idh_target_alias,
sizeof(is->is_target_alias));
- memcpy(is->is_isid, handoff->idh_isid, sizeof(is->is_isid));
+ is->is_tsih = handoff->idh_tsih;
is->is_statsn = handoff->idh_statsn;
is->is_initial_r2t = handoff->idh_initial_r2t;
is->is_immediate_data = handoff->idh_immediate_data;
@@ -1663,6 +1666,9 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
is->is_softc = sc;
sc->sc_last_session_id++;
is->is_id = sc->sc_last_session_id;
+ is->is_isid[0] = 0x80; /* RFC 3720, 10.12.5: 10b, "Random" ISID. */
+ arc4rand(&is->is_isid[1], 5, 0);
+ is->is_tsih = 0;
callout_init(&is->is_callout, 1);
callout_reset(&is->is_callout, 1 * hz, iscsi_callout, is);
TAILQ_INSERT_TAIL(&sc->sc_sessions, is, is_next);
diff --git a/sys/dev/iscsi/iscsi.h b/sys/dev/iscsi/iscsi.h
index e18f7f818c23e..0fe1515c2b6d2 100644
--- a/sys/dev/iscsi/iscsi.h
+++ b/sys/dev/iscsi/iscsi.h
@@ -64,6 +64,7 @@ struct iscsi_session {
size_t is_max_burst_length;
size_t is_first_burst_length;
uint8_t is_isid[6];
+ uint16_t is_tsih;
bool is_immediate_data;
size_t is_max_data_segment_length;
char is_target_alias[ISCSI_ALIAS_LEN];
diff --git a/sys/dev/iscsi/iscsi_ioctl.h b/sys/dev/iscsi/iscsi_ioctl.h
index 1171718230f78..b7cb47d4f975a 100644
--- a/sys/dev/iscsi/iscsi_ioctl.h
+++ b/sys/dev/iscsi/iscsi_ioctl.h
@@ -91,8 +91,8 @@ struct iscsi_session_state {
struct iscsi_daemon_request {
unsigned int idr_session_id;
struct iscsi_session_conf idr_conf;
- uint8_t idr_spare_isid[6];
- uint16_t idr_spare_tsih;
+ uint8_t idr_isid[6];
+ uint16_t idr_tsih;
uint16_t idr_spare_cid;
int idr_spare[4];
};
@@ -101,9 +101,9 @@ struct iscsi_daemon_handoff {
unsigned int idh_session_id;
int idh_socket;
char idh_target_alias[ISCSI_ALIAS_LEN];
- uint8_t idh_isid[6];
- uint16_t idr_spare_tsih;
- uint16_t idr_spare_cid;
+ uint8_t idh_spare_isid[6];
+ uint16_t idh_tsih;
+ uint16_t idh_spare_cid;
uint32_t idh_statsn;
int idh_header_digest;
int idh_data_digest;