Commit 4df53290 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Daniel Verkamp
Browse files

iscsi: stop using "OK/NG" for comments in ACL



"OK/NG" may be only used in Japan. It may cause misunderstanding.
Hence remove "OK/NG" or change to "Allowed/Denied".

Access control of iSCSI target follows further refactoring.
Hence to save the amount of change, "OK/NG"s are mainly removed.

Change-Id: I1f2ef9bc2be21caa86a6ae98377b6d6b3f85386a
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/385075


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent b17d4d91
Loading
Loading
Loading
Loading
+6 −17
Original line number Diff line number Diff line
@@ -194,39 +194,32 @@ spdk_iscsi_tgt_node_access(struct spdk_iscsi_conn *conn,
		/* skip excluding self portal group tag */
		if (pg != target->map[i].pg)
			continue;
		/* iqn is initiator group? */
		igp = target->map[i].ig;
		TAILQ_FOREACH(iname, &igp->initiator_head, tailq) {
			/* deny initiators */
			/* denied if iqn is matched */
			if ((iname->name[0] == '!')
			    && (strcasecmp(&iname->name[1], "ALL") == 0
				|| strcasecmp(&iname->name[1], iqn) == 0)) {
				/* NG */
				SPDK_DEBUGLOG(SPDK_TRACE_ISCSI,
					      "access denied from %s (%s) to %s (%s:%s,%d)\n",
					      iqn, addr, target->name, conn->portal->host,
					      conn->portal->port, conn->portal->group->tag);
				return false;
				goto denied;
			}
			/* allow initiators */
			/* allowed if iqn is matched */
			if (strcasecmp(iname->name, "ALL") == 0
			    || strcasecmp(iname->name, iqn) == 0) {
				/* OK iqn, check netmask */
				/* iqn is allowed, then check netmask */
				TAILQ_FOREACH(imask, &igp->netmask_head, tailq) {
					SPDK_DEBUGLOG(SPDK_TRACE_ISCSI,
						      "netmask=%s, addr=%s\n",
						      imask->mask, addr);
					if (spdk_iscsi_tgt_node_allow_netmask(imask->mask, addr)) {
						/* OK netmask */
						return true;
					}
				}
				/* NG netmask in this group */
				/* netmask is denied in this initiator group */
			}
		}
	}

	/* NG */
denied:
	SPDK_DEBUGLOG(SPDK_TRACE_ISCSI, "access denied from %s (%s) to %s (%s:%s,%d)\n",
		      iqn, addr, target->name, conn->portal->host,
		      conn->portal->port, conn->portal->group->tag);
@@ -244,24 +237,20 @@ spdk_iscsi_tgt_node_visible(struct spdk_iscsi_tgt_node *target, const char *iqn)
		return false;

	for (i = 0; i < target->maxmap; i++) {
		/* iqn is initiator group? */
		igp = target->map[i].ig;
		TAILQ_FOREACH(iname, &igp->initiator_head, tailq) {
			if ((iname->name[0] == '!')
			    && (strcasecmp(&iname->name[1], "ALL") == 0
				|| strcasecmp(&iname->name[1], iqn) == 0)) {
				/* NG */
				return false;
			}
			if (strcasecmp(iname->name, "ALL") == 0
			    || strcasecmp(iname->name, iqn) == 0) {
				/* OK iqn, no check addr */
				return true;
			}
		}
	}

	/* NG */
	return false;
}