Commit f8747377 authored by GangCao's avatar GangCao Committed by Changpeng Liu
Browse files

iscsi: set the rsph with correct error information



In several error cases, the status_class and status_detail
is not properly set.

Change-Id: Ie9cf8ec13b971d7295862872e8c7e834d08e7f14
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457932


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent ba3adc43
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -1483,7 +1483,10 @@ iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn,
		if (strlen(target_short_name) >= MAX_TARGET_NAME) {
			SPDK_ERRLOG("Target Short Name (%s) is more than %u characters\n",
				    target_short_name, MAX_TARGET_NAME);
			return rc;
			/* Invalid request */
			rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
			rsph->status_detail = ISCSI_LOGIN_INVALID_LOGIN_REQUEST;
			return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
		}
		snprintf(conn->target_short_name, MAX_TARGET_NAME, "%s",
			 target_short_name);
@@ -1513,11 +1516,17 @@ iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn,
	rc = iscsi_op_login_negotiate_chap_param(conn, *target);
	pthread_mutex_unlock(&((*target)->mutex));

	if (rc == 0) {
		rc = iscsi_op_login_negotiate_digest_param(conn, *target);
	}

	if (rc != 0) {
		return rc;
		/* Invalid request */
		rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
		rsph->status_detail = ISCSI_LOGIN_INVALID_LOGIN_REQUEST;
	}

	return iscsi_op_login_negotiate_digest_param(conn, *target);
	return rc;
}

/*