diff --git a/etc/spdk/nvmf.conf.in b/etc/spdk/nvmf.conf.in index 6fb1ff7d03..b14f727e37 100644 --- a/etc/spdk/nvmf.conf.in +++ b/etc/spdk/nvmf.conf.in @@ -34,7 +34,7 @@ [Nvmf] # node name (not include optional part) # Users can optionally change this to fit their environment. - NodeBase "iqn.2013-06.com.intel.ch.spdk" + NodeBase "nqn.2016-06.io.spdk" # Set the optional in-capsule data byte length for I/O queue capsule size. # Accepted values must be divisible by 16 and less than or equal to diff --git a/include/spdk/nvmf_spec.h b/include/spdk/nvmf_spec.h index abd6f29fe2..755c76bdfc 100644 --- a/include/spdk/nvmf_spec.h +++ b/include/spdk/nvmf_spec.h @@ -456,6 +456,7 @@ struct spdk_nvmf_extended_identify_ctrlr_data { }; SPDK_STATIC_ASSERT(sizeof(struct spdk_nvmf_extended_identify_ctrlr_data) == 256, "Incorrect size"); +#define SPDK_NVMF_NQN_MAX_LEN 223 #define SPDK_NVMF_DISCOVERY_NQN "nqn.2014-08.org.nvmexpress.discovery" struct spdk_nvmf_discovery_identify_data { diff --git a/lib/nvmf/nvmf_internal.h b/lib/nvmf/nvmf_internal.h index 3ec9e9adba..f1b1bb861b 100644 --- a/lib/nvmf/nvmf_internal.h +++ b/lib/nvmf/nvmf_internal.h @@ -56,7 +56,7 @@ #define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE LARGE_BB_MAX_SIZE #define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1 -#define SPDK_NVMF_DEFAULT_NODEBASE "iqn.2013-10.com.intel.spdk" +#define SPDK_NVMF_DEFAULT_NODEBASE "nqn.2016-06.io.spdk" #define SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE 1024 #define SPDK_NVMF_DEFAULT_MAX_SESSIONS_PER_SUBSYSTEM 1 #define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128 diff --git a/lib/nvmf/request.c b/lib/nvmf/request.c index c087494506..e72b9f36dd 100644 --- a/lib/nvmf/request.c +++ b/lib/nvmf/request.c @@ -410,8 +410,8 @@ nvmf_process_connect(struct spdk_nvmf_request *req) connect_data->hostid[9], ntohs(*(uint16_t *)&connect_data->hostid[10]), ntohl(*(uint32_t *)&connect_data->hostid[12])); - SPDK_TRACELOG(SPDK_TRACE_NVMF, " subsiqn: \"%s\"\n", (char *)&connect_data->subnqn[0]); - SPDK_TRACELOG(SPDK_TRACE_NVMF, " hostiqn: \"%s\"\n", (char *)&connect_data->hostnqn[0]); + SPDK_TRACELOG(SPDK_TRACE_NVMF, " subnqn: \"%s\"\n", (char *)&connect_data->subnqn[0]); + SPDK_TRACELOG(SPDK_TRACE_NVMF, " hostnqn: \"%s\"\n", (char *)&connect_data->hostnqn[0]); response = &req->rsp->connect_rsp; diff --git a/lib/nvmf/subsystem_grp.c b/lib/nvmf/subsystem_grp.c index 242f36e447..f3e1003aab 100644 --- a/lib/nvmf/subsystem_grp.c +++ b/lib/nvmf/subsystem_grp.c @@ -155,54 +155,34 @@ nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, return 0; } -/* nvmf uses iSCSI IQN format to name target subsystems. We expect that - the nvmf subsiqn name provided diring connect requests will be +/* nvmf uses NQN format to name target subsystems. We expect that + the nvmf subnqn name provided diring connect requests will be equivalent to a individual controller name */ static int spdk_check_nvmf_name(const char *name) { - const unsigned char *up = (const unsigned char *) name; - size_t n; + size_t len; - /* valid iSCSI name? */ - for (n = 0; up[n] != 0; n++) { - if (up[n] > 0x00U && up[n] <= 0x2cU) - goto err0; - if (up[n] == 0x2fU) - goto err0; - if (up[n] >= 0x3bU && up[n] <= 0x40U) - goto err0; - if (up[n] >= 0x5bU && up[n] <= 0x60U) - goto err0; - if (up[n] >= 0x7bU && up[n] <= 0x7fU) - goto err0; - if (isspace(up[n])) - goto err0; + len = strlen(name); + if (len > SPDK_NVMF_NQN_MAX_LEN) { + SPDK_ERRLOG("Invalid NQN \"%s\": length %zu > max %d\n", name, len, SPDK_NVMF_NQN_MAX_LEN); + return -1; } - /* valid format? */ - if (strncasecmp(name, "iqn.", 4) == 0) { - /* iqn.YYYY-MM.reversed.domain.name */ - if (!isdigit(up[4]) || !isdigit(up[5]) || !isdigit(up[6]) - || !isdigit(up[7]) || up[8] != '-' || !isdigit(up[9]) - || !isdigit(up[10]) || up[11] != '.') { - SPDK_ERRLOG("invalid iqn format. " - "expect \"iqn.YYYY-MM.reversed.domain.name\"\n"); - return -1; - } - } else if (strncasecmp(name, "eui.", 4) == 0) { - /* EUI-64 -> 16bytes */ - /* XXX */ - } else if (strncasecmp(name, "naa.", 4) == 0) { - /* 64bit -> 16bytes, 128bit -> 32bytes */ - /* XXX */ + if (strncasecmp(name, "nqn.", 4) != 0) { + SPDK_ERRLOG("Invalid NQN \"%s\": NQN must begin with \"nqn.\".\n", name); + return -1; + } + + /* yyyy-mm. */ + if (!(isdigit(name[4]) && isdigit(name[5]) && isdigit(name[6]) && isdigit(name[7]) && + name[8] == '-' && isdigit(name[9]) && isdigit(name[10]) && name[11] == '.')) { + SPDK_ERRLOG("Invalid date code in NQN \"%s\"\n", name); + return -1; } return 0; -err0: - SPDK_ERRLOG("Invalid iSCSI character [val %x, index %d]\n", up[n], (int)n); - return -1; } static void @@ -289,9 +269,7 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp) goto err0; } - if (strncasecmp(name, "iqn.", 4) != 0 - && strncasecmp(name, "eui.", 4) != 0 - && strncasecmp(name, "naa.", 4) != 0) { + if (strncasecmp(name, "nqn.", 4) != 0) { ss_group->name = spdk_sprintf_alloc("%s:%s", g_nvmf_tgt.nodebase, name); } else { ss_group->name = strdup(name); diff --git a/test/nvmf/filesystem/filesystem.sh b/test/nvmf/filesystem/filesystem.sh index 080caee05d..ecf3849ec0 100755 --- a/test/nvmf/filesystem/filesystem.sh +++ b/test/nvmf/filesystem/filesystem.sh @@ -49,7 +49,7 @@ if [ -e "/dev/nvme-fabrics" ]; then chmod a+rw /dev/nvme-fabrics fi -echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=iqn.2013-06.com.intel.ch.spdk:cnode1' > /dev/nvme-fabrics +echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=nqn.2016-06.io.spdk:cnode1' > /dev/nvme-fabrics # file system test filesystem_test diff --git a/test/nvmf/fio/fio.sh b/test/nvmf/fio/fio.sh index 2f7497b8ed..7be84647f4 100755 --- a/test/nvmf/fio/fio.sh +++ b/test/nvmf/fio/fio.sh @@ -23,7 +23,7 @@ if [ -e "/dev/nvme-fabrics" ]; then chmod a+rw /dev/nvme-fabrics fi -echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=iqn.2013-06.com.intel.ch.spdk:cnode1' > /dev/nvme-fabrics +echo 'traddr='$NVMF_FIRST_TARGET_IP',transport=rdma,nr_io_queues=1,trsvcid='$NVMF_PORT',nqn=nqn.2016-06.io.spdk:cnode1' > /dev/nvme-fabrics $testdir/nvmf_fio.py 4096 1 rw 1 verify $testdir/nvmf_fio.py 4096 1 randrw 1 verify diff --git a/test/nvmf/nvmf.conf b/test/nvmf/nvmf.conf index 416ef01174..9827b3e8d6 100644 --- a/test/nvmf/nvmf.conf +++ b/test/nvmf/nvmf.conf @@ -6,7 +6,7 @@ #RpcConfiguration Yes [Nvmf] - NodeBase "iqn.2013-06.com.intel.ch.spdk" + NodeBase "nqn.2016-06.io.spdk" MaxConnectionsPerSession 4 [Port1]