lib/iscsi: Portal group holds CHAP params and passes them to connections

This is another preparation to support per portal group CHAP authentication
for discovery session.

Add CHAP params into struct spdk_iscsi_portal_grp, and initialize them
by global parameters at spdk_iscsi_portal_grp_create().

Copy CHAP params from portal group to connection at spdk_iscsi_conn_construct().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1ecb812266ac3d090f8e6db21d1d6a090f1811d9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469368
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-09-25 13:53:34 +09:00 committed by Jim Harris
parent a398d87467
commit b72893a6f2
3 changed files with 17 additions and 6 deletions

View File

@ -222,10 +222,10 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
conn->nop_outstanding = false;
conn->data_out_cnt = 0;
conn->data_in_cnt = 0;
conn->disable_chap = g_spdk_iscsi.disable_chap;
conn->require_chap = g_spdk_iscsi.require_chap;
conn->mutual_chap = g_spdk_iscsi.mutual_chap;
conn->chap_group = g_spdk_iscsi.chap_group;
conn->disable_chap = portal->group->disable_chap;
conn->require_chap = portal->group->require_chap;
conn->mutual_chap = portal->group->mutual_chap;
conn->chap_group = portal->group->chap_group;
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
conn->MaxRecvDataSegmentLength = 8192; /* RFC3720(12.12) */

View File

@ -366,6 +366,13 @@ spdk_iscsi_portal_grp_create(int tag)
pg->ref = 0;
pg->tag = tag;
pthread_mutex_lock(&g_spdk_iscsi.mutex);
pg->disable_chap = g_spdk_iscsi.disable_chap;
pg->require_chap = g_spdk_iscsi.require_chap;
pg->mutual_chap = g_spdk_iscsi.mutual_chap;
pg->chap_group = g_spdk_iscsi.chap_group;
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
TAILQ_INIT(&pg->head);
return pg;

View File

@ -53,8 +53,12 @@ struct spdk_iscsi_portal {
};
struct spdk_iscsi_portal_grp {
int ref;
int tag;
int ref;
int tag;
bool disable_chap;
bool require_chap;
bool mutual_chap;
int32_t chap_group;
TAILQ_ENTRY(spdk_iscsi_portal_grp) tailq;
TAILQ_HEAD(, spdk_iscsi_portal) head;
};