net&iscsi: force overwrite "*" and "[*]" by wildcard
SPDK have used "*" and "[*]" as wildcard address for iSCSI network portal. These abbreviations may be convenient but unusual. If "*" or "[*]" is used, output warning message and forcefully overwrite "*" or "[*]" by "0.0.0.0" or "[::]" respectively. After confirming that the usage of "*" and "[*]" is not used any more, the code for "*" and "[*]" will be deleted. Change-Id: Ibb8fb0d4598ffa1f7b1690ad6afd10d5ae162612 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/383556 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
58fb5a17f0
commit
335fb0e85f
@ -84,7 +84,22 @@ spdk_iscsi_portal_create(const char *host, const char *port, uint64_t cpumask)
|
|||||||
SPDK_ERRLOG("portal malloc error (%s, %s)\n", host, port);
|
SPDK_ERRLOG("portal malloc error (%s, %s)\n", host, port);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p->host = strdup(host);
|
|
||||||
|
/* check and overwrite abbreviation of wildcard */
|
||||||
|
if (strcasecmp(host, "[*]") == 0) {
|
||||||
|
SPDK_WARNLOG("Please use \"[::]\" as IPv6 wildcard\n");
|
||||||
|
SPDK_WARNLOG("Convert \"[*]\" to \"[::]\" automatically\n");
|
||||||
|
SPDK_WARNLOG("(Use of \"[*]\" will be deprecated in a future release)");
|
||||||
|
p->host = strdup("[::]");
|
||||||
|
} else if (strcasecmp(host, "*") == 0) {
|
||||||
|
SPDK_WARNLOG("Please use \"0.0.0.0\" as IPv4 wildcard\n");
|
||||||
|
SPDK_WARNLOG("Convert \"*\" to \"0.0.0.0\" automatically\n");
|
||||||
|
SPDK_WARNLOG("(Use of \"[*]\" will be deprecated in a future release)");
|
||||||
|
p->host = strdup("0.0.0.0");
|
||||||
|
} else {
|
||||||
|
p->host = strdup(host);
|
||||||
|
}
|
||||||
|
|
||||||
p->port = strdup(port);
|
p->port = strdup(port);
|
||||||
p->cpumask = cpumask;
|
p->cpumask = cpumask;
|
||||||
p->sock = -1;
|
p->sock = -1;
|
||||||
|
@ -403,18 +403,12 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn,
|
|||||||
host = p->host;
|
host = p->host;
|
||||||
/* wildcard? */
|
/* wildcard? */
|
||||||
if (strcasecmp(host, "[::]") == 0
|
if (strcasecmp(host, "[::]") == 0
|
||||||
|| strcasecmp(host, "[*]") == 0
|
|| strcasecmp(host, "0.0.0.0") == 0) {
|
||||||
|| strcasecmp(host, "0.0.0.0") == 0
|
if (spdk_sock_is_ipv6(conn->sock)) {
|
||||||
|| strcasecmp(host, "*") == 0) {
|
|
||||||
if ((strcasecmp(host, "[::]") == 0
|
|
||||||
|| strcasecmp(host, "[*]") == 0)
|
|
||||||
&& spdk_sock_is_ipv6(conn->sock)) {
|
|
||||||
snprintf(buf, sizeof buf, "[%s]",
|
snprintf(buf, sizeof buf, "[%s]",
|
||||||
conn->target_addr);
|
conn->target_addr);
|
||||||
host = buf;
|
host = buf;
|
||||||
} else if ((strcasecmp(host, "0.0.0.0") == 0
|
} else if (spdk_sock_is_ipv4(conn->sock)) {
|
||||||
|| strcasecmp(host, "*") == 0)
|
|
||||||
&& spdk_sock_is_ipv4(conn->sock)) {
|
|
||||||
snprintf(buf, sizeof buf, "%s",
|
snprintf(buf, sizeof buf, "%s",
|
||||||
conn->target_addr);
|
conn->target_addr);
|
||||||
host = buf;
|
host = buf;
|
||||||
|
@ -140,13 +140,6 @@ spdk_sock_create(const char *ip, int port, enum spdk_sock_create_type type)
|
|||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
ip = (const char *) &buf[0];
|
ip = (const char *) &buf[0];
|
||||||
if (strcasecmp(ip, "*") == 0) {
|
|
||||||
snprintf(buf, sizeof(buf), "::");
|
|
||||||
ip = (const char *) &buf[0];
|
|
||||||
}
|
|
||||||
} else if (strcasecmp(ip, "*") == 0) {
|
|
||||||
snprintf(buf, sizeof(buf), "0.0.0.0");
|
|
||||||
ip = (const char *) &buf[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(portnum, sizeof portnum, "%d", port);
|
snprintf(portnum, sizeof portnum, "%d", port);
|
||||||
|
Loading…
Reference in New Issue
Block a user