Commit 33a14041 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

iscsi: make Mutual infer CHAP for DiscoveryAuthMethod options



Previously users would have to pass CHAP and Mutual as
separate words on the DiscoveryAuthMethod line - but
this was problematic since then we would have to check
that the user did not specify Mutual without CHAP.

So instead just make Mutual infer CHAP.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I183d59145abb97198984541157522d6483b18e7c

Reviewed-on: https://review.gerrithub.io/385495


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 28544c4b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@
  Timeout 30

  # authentication information for discovery session
  # Options:
  # None, Auto, CHAP and Mutual.  Note that Mutual infers CHAP.
  DiscoveryAuthMethod Auto

  #MaxSessions 128
+18 −25
Original line number Diff line number Diff line
@@ -583,7 +583,6 @@ spdk_iscsi_read_parameters_from_config_file(struct spdk_conf_section *sp)
	int flush_timeout = 0;
	const char *ag_tag;
	int ag_tag_i;
	int i;

	val = spdk_conf_section_get_val(sp, "Comment");
	if (val != NULL) {
@@ -704,16 +703,16 @@ spdk_iscsi_read_parameters_from_config_file(struct spdk_conf_section *sp)
	}
	val = spdk_conf_section_get_val(sp, "DiscoveryAuthMethod");
	if (val != NULL) {
		g_spdk_iscsi.no_discovery_auth = 0;
		for (i = 0; ; i++) {
			val = spdk_conf_section_get_nmval(sp, "DiscoveryAuthMethod", 0, i);
			if (val == NULL)
				break;
		if (strcasecmp(val, "CHAP") == 0) {
			g_spdk_iscsi.no_discovery_auth = 0;
			g_spdk_iscsi.req_discovery_auth = 1;
			g_spdk_iscsi.req_discovery_auth_mutual = 0;
		} else if (strcasecmp(val, "Mutual") == 0) {
			g_spdk_iscsi.no_discovery_auth = 0;
			g_spdk_iscsi.req_discovery_auth = 1;
			g_spdk_iscsi.req_discovery_auth_mutual = 1;
		} else if (strcasecmp(val, "Auto") == 0) {
			g_spdk_iscsi.no_discovery_auth = 0;
			g_spdk_iscsi.req_discovery_auth = 0;
			g_spdk_iscsi.req_discovery_auth_mutual = 0;
		} else if (strcasecmp(val, "None") == 0) {
@@ -724,7 +723,6 @@ spdk_iscsi_read_parameters_from_config_file(struct spdk_conf_section *sp)
			SPDK_ERRLOG("unknown auth %s, ignoring\n", val);
		}
	}
	}
	val = spdk_conf_section_get_val(sp, "DiscoveryAuthGroup");
	if (val != NULL) {
		ag_tag = val;
@@ -807,11 +805,6 @@ spdk_iscsi_app_read_parameters(void)

	g_spdk_iscsi.flush_timeout *= (spdk_get_ticks_hz() >> 20);

	if (g_spdk_iscsi.req_discovery_auth_mutual && !g_spdk_iscsi.req_discovery_auth) {
		SPDK_ERRLOG("Mutual specified but not CHAP, disabling mutual\n");
		g_spdk_iscsi.req_discovery_auth_mutual = 0;
	}

	spdk_iscsi_log_globals();

	/* portal groups */