diff --git a/lib/iscsi/portal_grp.c b/lib/iscsi/portal_grp.c index 5c3266dd8..48518eba2 100644 --- a/lib/iscsi/portal_grp.c +++ b/lib/iscsi/portal_grp.c @@ -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); 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->cpumask = cpumask; p->sock = -1; diff --git a/lib/iscsi/tgt_node.c b/lib/iscsi/tgt_node.c index 108539a00..5c645a4a9 100644 --- a/lib/iscsi/tgt_node.c +++ b/lib/iscsi/tgt_node.c @@ -403,18 +403,12 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn, host = p->host; /* wildcard? */ if (strcasecmp(host, "[::]") == 0 - || strcasecmp(host, "[*]") == 0 - || strcasecmp(host, "0.0.0.0") == 0 - || strcasecmp(host, "*") == 0) { - if ((strcasecmp(host, "[::]") == 0 - || strcasecmp(host, "[*]") == 0) - && spdk_sock_is_ipv6(conn->sock)) { + || strcasecmp(host, "0.0.0.0") == 0) { + if (spdk_sock_is_ipv6(conn->sock)) { snprintf(buf, sizeof buf, "[%s]", conn->target_addr); host = buf; - } else if ((strcasecmp(host, "0.0.0.0") == 0 - || strcasecmp(host, "*") == 0) - && spdk_sock_is_ipv4(conn->sock)) { + } else if (spdk_sock_is_ipv4(conn->sock)) { snprintf(buf, sizeof buf, "%s", conn->target_addr); host = buf; diff --git a/lib/net/sock.c b/lib/net/sock.c index 125816756..fb03a1261 100644 --- a/lib/net/sock.c +++ b/lib/net/sock.c @@ -140,13 +140,6 @@ spdk_sock_create(const char *ip, int port, enum spdk_sock_create_type type) if (p != NULL) *p = '\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);