From: Jay Freyensee Date: Fri, 21 Oct 2016 15:50:05 +0000 (-0700) Subject: nvme-cli: fix nvme-connect-all using hostnqn X-Git-Tag: v1.0~13 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9478feb8fad8878ab765758e49a48c5b18bfdd16;p=users%2Fsagi%2Fnvme-cli.git nvme-cli: fix nvme-connect-all using hostnqn 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 --- diff --git a/fabrics.c b/fabrics.c index 51e424e6..ab2e4776 100644 --- 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");