]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: skip connect if transport type doesn't match
authorMartin George <marting@netapp.com>
Sat, 5 Jun 2021 09:46:26 +0000 (15:16 +0530)
committerKeith Busch <kbusch@kernel.org>
Fri, 11 Jun 2021 15:57:26 +0000 (09:57 -0600)
Discovery log page data may include records belonging to different
transport types. If during a nvme connect-all, a connect is attempted
on a record that doesn't match the transport type passed here, it
would end up in a connect failure for that record. For e.g. one would
see the below error if a connect is attempted on a tcp record but the
transport type passed here is 'fc' and its associated parameters:

nvme_tcp: malformed src address passed: nn-0xXXXX:pn-0xYYYY

Fix this by proceeding with the connect only if the appropriate
transport type matches a given record during the connect-all.

Signed-off-by: Martin George <marting@netapp.com>
fabrics.c

index db42ddbd6d9b3d9a0db3521ea32ed3c948a7fed6..6cc142d51a88ec2dc18f69b9ceee48abbcd590e9 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -1354,6 +1354,10 @@ static bool should_connect(struct nvmf_disc_rsp_page_entry *entry)
        if (cargs_match_found(entry))
                return false;
 
+       /* skip connect if the transport type doesn't match */
+       if (strcmp(fabrics_cfg.transport, trtype_str(entry->trtype)))
+               return false;
+
        if (!fabrics_cfg.matching_only || !fabrics_cfg.traddr)
                return true;