[stgt] [PATCH 2/8] If param check fails during iscsi login text processing, answer that key with Reject. According to iscsi spec (5.2) the target can choose between responding bad values with key=Reject, sending an admissible value and closing the connection by returning a login error. Here the Reject option is implemented. Any objections?

nezhinsky at gmail.com nezhinsky at gmail.com
Wed Apr 25 16:52:15 CEST 2012


From: Alexander Nezhinsky <alexandern at mellanox.com>


Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
 usr/iscsi/iscsid.c    |    5 +++++
 usr/iscsi/iser_text.c |    5 +++++
 2 files changed, 10 insertions(+)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 4ed3711..144d2bd 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -341,6 +341,10 @@ static void text_scan_login(struct iscsi_connection *conn)
 			}
 
 			err = param_check_val(session_keys, idx, &val);
+			if (err) {
+				text_key_add_reject(conn, key);
+				continue;
+			}
 			if (idx == ISCSI_PARAM_MAX_XMIT_DLENGTH &&
 			    conn->session_type == SESSION_DISCOVERY)
 				conn->session_param[idx].val = val;
@@ -454,6 +458,7 @@ static void login_start(struct iscsi_connection *conn)
 	}
 	conn->initiator = strdup(name);
 	alias = text_key_find(conn, "InitiatorAlias");
+
 	session_type = text_key_find(conn, "SessionType");
 	target_name = text_key_find(conn, "TargetName");
 
diff --git a/usr/iscsi/iser_text.c b/usr/iscsi/iser_text.c
index dd91a41..c703492 100644
--- a/usr/iscsi/iser_text.c
+++ b/usr/iscsi/iser_text.c
@@ -284,6 +284,11 @@ static void iser_login_oper_scan(struct iscsi_connection *iscsi_conn,
 			}
 
 			err = param_check_val(session_keys, idx, &val);
+			if (err) {
+				iser_text_key_add_reject(iscsi_conn, tx_pdu, key);
+				continue;
+			}
+
 			param_set_val(session_keys, iscsi_conn->session_param, idx, &val);
 
 			switch (iscsi_conn->session_param[idx].state) {
-- 
1.7.9.6

--
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