]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: skip connect if the transport types don't match
authorMartin George <marting@netapp.com>
Wed, 13 Apr 2022 15:16:35 +0000 (20:46 +0530)
committerMartin George <marting@netapp.com>
Wed, 13 Apr 2022 15:45:02 +0000 (21:15 +0530)
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 following error if a connect is attempted on a tcp record,
but the transport type passed here is 'fc' and its associated params:

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

Fix this by proceeding with the connect only if the transport types
match for a given record during the connect-all.

[marting: backport from monolithic branch]
Signed-off-by: Martin George <marting@netapp.com>
fabrics.c

index f512ffabd081796130f050dbf8915955640be043..e679dd96d6d2fb2fc2da39822328bff4816d6dee 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -386,6 +386,10 @@ static int __discover(nvme_ctrl_t c, struct nvme_fabrics_config *defcfg,
                        nvme_ctrl_t child;
                        int tmo = defcfg->keep_alive_tmo;
 
+                       /* Skip connect if the transport types don't match */
+                       if (strcmp(nvme_ctrl_get_transport(c), nvmf_trtype_str(e->trtype)))
+                               continue;
+
                        if (e->subtype == NVME_NQN_DISC)
                                set_discovery_kato(defcfg);