Commit 4492fd6c authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/403235


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent ed3e889f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+2 −0
Original line number Diff line number Diff line
@@ -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);