From: Sagi Grimberg Date: Tue, 16 Aug 2016 09:46:24 +0000 (+0300) Subject: fabrics: Allow ipv6 address resolution X-Git-Tag: v0.9~13 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=272dd519d2cca0060174c694f9bbf928e399186c;p=users%2Fsagi%2Fnvme-cli.git fabrics: Allow ipv6 address resolution While we're at it, make the adrfam condition a proper switch-case statement. Signed-off-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- diff --git a/fabrics.c b/fabrics.c index 8a174d41..461e126c 100644 --- a/fabrics.c +++ b/fabrics.c @@ -438,25 +438,29 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e) /* we can safely ignore the rest of the entries */ break; case NVMF_TRTYPE_RDMA: - if (e->adrfam != NVMF_ADDR_FAMILY_IP4) { + switch (e->adrfam) { + case NVMF_ADDR_FAMILY_IP4: + case NVMF_ADDR_FAMILY_IP6: + /* FALLTHRU */ + len = sprintf(p, ",transport=rdma"); + if (len < 0) + return -EINVAL; + p += len; + + len = sprintf(p, ",traddr=%s", e->traddr); + if (len < 0) + return -EINVAL; + p += len; + + len = sprintf(p, ",trsvcid=%s", e->trsvcid); + if (len < 0) + return -EINVAL; + p += len; + break; + default: fprintf(stderr, "skipping unsupported adrfam\n"); return -EINVAL; } - - len = sprintf(p, ",transport=rdma"); - if (len < 0) - return -EINVAL; - p += len; - - len = sprintf(p, ",traddr=%s", e->traddr); - if (len < 0) - return -EINVAL; - p += len; - - len = sprintf(p, ",trsvcid=%s", e->trsvcid); - if (len < 0) - return -EINVAL; - p += len; break; default: fprintf(stderr, "skipping unsupported transport %d\n",