[stgt] [PATCH 4/6] new iser, iscsi/iscsid.c, iscsi/iscsid.h

Alexander Nezhinsky alexandern at Voltaire.COM
Mon Jan 24 20:38:06 CET 2011


iscsi/iscsid.c, iscsi/iscsid.h: 
Checking that the incoming login is destined to the right 
target time (rdma or not).
Some additional conn states used by iser defined.

Signed-off-by: Alexander Nezhinsky <alexandern at voltaire.com>
---
 usr/iscsi/iscsid.c |   10 +++++++++-
 usr/iscsi/iscsid.h |    6 ++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index f739a12..ff3f32b 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -488,6 +488,14 @@ static void login_start(struct iscsi_connection *conn)
 			conn->state = STATE_EXIT;
 			return;
 		}
+		if (target->rdma) {
+			eprintf("Target %s is RDMA, but conn cid:%d from %s is TCP\n",
+				target_name, conn->cid, conn->initiator);
+			rsp->status_class = ISCSI_STATUS_CLS_INITIATOR_ERR;
+			rsp->status_detail = ISCSI_LOGIN_STATUS_TGT_NOT_FOUND;
+			conn->state = STATE_EXIT;
+			return;
+		}
 
 		conn->tid = target->tid;
 
@@ -2292,7 +2300,7 @@ out:
 	return ret;
 }
 
-static int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size)
+int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size)
 {
 	struct iscsi_session *session;
 	char *p;
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 2a7a3f8..be585bb 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -214,6 +214,9 @@ struct iscsi_connection {
 #define STATE_CLOSE		10
 #define STATE_EXIT		11
 #define STATE_SCSI		12
+#define STATE_INIT		13
+#define STATE_START		14
+#define STATE_READY		15
 
 #define AUTH_STATE_START	0
 #define AUTH_STATE_CHALLENGE	1
@@ -254,6 +257,8 @@ struct iscsi_target {
 	} redirect_info;
 
 	struct list_head isns_list;
+
+	int rdma;
 };
 
 enum task_flags {
@@ -296,6 +301,7 @@ extern void conn_read_pdu(struct iscsi_connection *conn);
 extern int iscsi_tx_handler(struct iscsi_connection *conn);
 extern void iscsi_rx_handler(struct iscsi_connection *conn);
 extern int iscsi_scsi_cmd_execute(struct iscsi_task *task);
+extern int iscsi_transportid(int tid, uint64_t itn_id, char *buf, int size);
 
 /* iscsid.c iscsi_task */
 extern void iscsi_free_task(struct iscsi_task *task);
--
1.6.5.5
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list