]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: fix nvme-connect-all using hostnqn
authorJay Freyensee <james_p_freyensee@linux.intel.com>
Fri, 21 Oct 2016 15:50:05 +0000 (08:50 -0700)
committerKeith Busch <keith.busch@intel.com>
Fri, 21 Oct 2016 16:02:51 +0000 (12:02 -0400)
The example in the man pages:

nvme connect-all --transport=rdma --traddr=192.168.1.3 \
--hostnqn=host1-rogue-nqn

fails because nvme-cli fails to actually use hostnqn upon
connect.  This patch fixes that.

Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
fabrics.c

index 51e424e6103e21fa39552edffd01de8476cfd6f7..ab2e4776eddedac48739b7c8afeffefa56adee41 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -540,6 +540,13 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
                return -EINVAL;
        p += len;
 
+       if (cfg.hostnqn) {
+               len = sprintf(p, ",hostnqn=%s", cfg.hostnqn);
+               if (len < 0)
+                       return -EINVAL;
+               p += len;
+       }
+
        switch (e->trtype) {
        case NVMF_TRTYPE_LOOP: /* loop */
                len = sprintf(p, ",transport=loop");