iscsi: Make names of CHAP parameters consistent

CHAP parameters in struct spdk_iscsi_conn had not been changed
even after iSCSI CHAP was refactored and enhanced.

Use names in iSCSI subsystem throughout.

Change-Id: Ic61b0db42adaa406ab48cf3857a4c2859c88690d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/437056
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-12-13 14:08:59 +09:00 committed by Darek Stojaczyk
parent a8fccf40bc
commit 0bf22fb8d9
2 changed files with 14 additions and 14 deletions

View File

@ -134,9 +134,9 @@ struct spdk_iscsi_conn {
bool sess_param_state_negotiated[MAX_SESSION_PARAMS]; bool sess_param_state_negotiated[MAX_SESSION_PARAMS];
bool conn_param_state_negotiated[MAX_CONNECTION_PARAMS]; bool conn_param_state_negotiated[MAX_CONNECTION_PARAMS];
struct iscsi_chap_auth auth; struct iscsi_chap_auth auth;
int authenticated; bool authenticated;
int req_auth; bool require_chap;
int req_mutual; bool mutual_chap;
uint32_t pending_task_cnt; uint32_t pending_task_cnt;
uint32_t data_out_cnt; uint32_t data_out_cnt;
uint32_t data_in_cnt; uint32_t data_in_cnt;

View File

@ -857,7 +857,7 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn,
goto error_return; goto error_return;
} }
/* OK initiator's secret */ /* OK initiator's secret */
conn->authenticated = 1; conn->authenticated = true;
/* mutual CHAP? */ /* mutual CHAP? */
identifier = spdk_iscsi_param_get_val(params, "CHAP_I"); identifier = spdk_iscsi_param_get_val(params, "CHAP_I");
@ -925,7 +925,7 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn,
in_val, data, alloc_len, total); in_val, data, alloc_len, total);
} else { } else {
/* not mutual */ /* not mutual */
if (conn->req_mutual) { if (conn->mutual_chap) {
SPDK_ERRLOG("required mutual CHAP\n"); SPDK_ERRLOG("required mutual CHAP\n");
goto error_return; goto error_return;
} }
@ -1172,20 +1172,20 @@ spdk_iscsi_negotiate_chap_param(struct spdk_iscsi_conn *conn, bool disable_chap,
int rc = 0; int rc = 0;
if (disable_chap) { if (disable_chap) {
conn->req_auth = 0; conn->require_chap = false;
rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "None", "None"); rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "None", "None");
if (rc < 0) { if (rc < 0) {
return rc; return rc;
} }
} else if (require_chap) { } else if (require_chap) {
conn->req_auth = 1; conn->require_chap = true;
rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "CHAP", "CHAP"); rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "CHAP", "CHAP");
if (rc < 0) { if (rc < 0) {
return rc; return rc;
} }
} }
if (mutual_chap) { if (mutual_chap) {
conn->req_mutual = 1; conn->mutual_chap = true;
} }
return rc; return rc;
@ -1505,7 +1505,7 @@ spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn,
struct iscsi_bhs_login_rsp *rsph; struct iscsi_bhs_login_rsp *rsph;
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs; rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
conn->authenticated = 0; conn->authenticated = false;
conn->auth.chap_phase = ISCSI_CHAP_PHASE_WAIT_A; conn->auth.chap_phase = ISCSI_CHAP_PHASE_WAIT_A;
conn->cid = cid; conn->cid = cid;
@ -1859,7 +1859,7 @@ spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn,
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
} }
if (strcasecmp(auth_method, "None") == 0) { if (strcasecmp(auth_method, "None") == 0) {
conn->authenticated = 1; conn->authenticated = true;
} else { } else {
rc = spdk_iscsi_auth_params(conn, params, auth_method, rc = spdk_iscsi_auth_params(conn, params, auth_method,
rsp_pdu->data, alloc_len, rsp_pdu->data, alloc_len,
@ -1872,7 +1872,7 @@ spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn,
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
} }
rsp_pdu->data_segment_len = rc; rsp_pdu->data_segment_len = rc;
if (conn->authenticated == 0) { if (!conn->authenticated) {
/* not complete */ /* not complete */
rsph->flags &= ~ISCSI_LOGIN_TRANSIT; rsph->flags &= ~ISCSI_LOGIN_TRANSIT;
} else { } else {
@ -1889,17 +1889,17 @@ spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn,
case ISCSI_OPERATIONAL_NEGOTIATION_PHASE: case ISCSI_OPERATIONAL_NEGOTIATION_PHASE:
/* LoginOperationalNegotiation */ /* LoginOperationalNegotiation */
if (conn->state == ISCSI_CONN_STATE_INVALID) { if (conn->state == ISCSI_CONN_STATE_INVALID) {
if (conn->req_auth) { if (conn->require_chap) {
/* Authentication failure */ /* Authentication failure */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR; rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = ISCSI_LOGIN_AUTHENT_FAIL; rsph->status_detail = ISCSI_LOGIN_AUTHENT_FAIL;
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
} else { } else {
/* AuthMethod=None */ /* AuthMethod=None */
conn->authenticated = 1; conn->authenticated = true;
} }
} }
if (conn->authenticated == 0) { if (!conn->authenticated) {
SPDK_ERRLOG("authentication error\n"); SPDK_ERRLOG("authentication error\n");
/* Authentication failure */ /* Authentication failure */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR; rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;