[PATCH] redirect support in iser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Added redirect support to iser (duplicated a clause from iscsi/iscsid.c)

Signed-off-by: Alexander Nezhinsky <alexandern@xxxxxxxxxxxx>
---
 usr/iscsi/iser_text.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi/iser_text.c b/usr/iscsi/iser_text.c
index bcd7d4f..61a8dd2 100644
--- a/usr/iscsi/iser_text.c
+++ b/usr/iscsi/iser_text.c
@@ -412,6 +412,8 @@ static void iser_login_start(struct iscsi_connection *iscsi_conn,
 	int req_datasize = rx_pdu->membuf.size;
 	char *name, *alias, *session_type, *target_name;
 	struct iscsi_target *target;
+	char buf[NI_MAXHOST + NI_MAXSERV + 4];
+	int reason;
 
 	iscsi_conn->cid = be16_to_cpu(req_bhs->cid);
 	memcpy(iscsi_conn->isid, req_bhs->isid, sizeof(req_bhs->isid));
@@ -475,6 +477,14 @@ static void iser_login_start(struct iscsi_connection *iscsi_conn,
 		}
 		iscsi_conn->tid = target->tid;
 
+		if (target_redirected(target, iscsi_conn, buf, &reason)) {
+			iser_text_key_add(iscsi_conn, tx_pdu, "TargetAddress", buf);
+			rsp_bhs->status_class = ISCSI_STATUS_CLS_REDIRECT;
+			rsp_bhs->status_detail = reason;
+			iscsi_conn->state = STATE_EXIT;
+			return;
+		}
+
 		if (tgt_get_target_state(target->tid) != SCSI_TARGET_READY) {
 			rsp_bhs->status_class = ISCSI_STATUS_CLS_TARGET_ERR;
 			rsp_bhs->status_detail = ISCSI_LOGIN_STATUS_TARGET_ERROR;
--
1.6.5.5
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux