iscsi: Check the combination of CHAP params for discovery before applied

In the upcoming JSON config file, CHAP parameters for discovery will
be specified simply by the value of them.

This is as same as JSON-RPC for target node but different from .INI
config file.

If CHAP parameters are specified by the value of them, the combination
of them must be checked before applied to iSCSI globals.

Change-Id: Idf663796f97581366da945abb8dc351f3975ceae
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403235
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-03-09 09:06:58 +09:00 committed by Jim Harris
parent ed3e889fcd
commit 4492fd6cc8
3 changed files with 10 additions and 1 deletions

View File

@ -773,6 +773,13 @@ spdk_iscsi_initialize_iscsi_globals(struct spdk_iscsi_opts *opts)
return -EINVAL;
}
if (!spdk_iscsi_check_chap_params(opts->no_discovery_auth, opts->req_discovery_auth,
opts->req_discovery_auth_mutual,
opts->discovery_auth_group)) {
SPDK_ERRLOG("CHAP params in opts are illegal combination\n");
return -EINVAL;
}
g_spdk_iscsi.authfile = strdup(opts->authfile);
if (!g_spdk_iscsi.authfile) {
SPDK_ERRLOG("failed to strdup for auth file %s\n", opts->authfile);

View File

@ -834,7 +834,7 @@ spdk_check_iscsi_name(const char *name)
return 0;
}
static bool
bool
spdk_iscsi_check_chap_params(bool disable, bool require, bool mutual, int group)
{
if (group < 0) {

View File

@ -115,6 +115,8 @@ spdk_iscsi_tgt_node_construct(int target_index,
bool disable_chap, bool require_chap, bool mutual_chap, int chap_group,
bool header_digest, bool data_digest);
bool spdk_iscsi_check_chap_params(bool disable, bool require, bool mutual, int group);
int spdk_iscsi_tgt_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list,
uint16_t num_maps);