File 0002-fabrics-skip-connect-if-the-transport-types-don-t-ma.patch of Package nvme-cli.26914

From: Martin George <marting@netapp.com>
Date: Wed, 13 Apr 2022 20:46:35 +0530
Subject: fabrics: skip connect if the transport types don't match
Git-commit 58c39bbe25e0ec0d49c0a5225ab278bed08958ea
References: bsc#1199949 bsc#1199994

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 |    4 ++++
 1 file changed, 4 insertions(+)

--- a/fabrics.c
+++ b/fabrics.c
@@ -383,6 +383,10 @@ static int __discover(nvme_ctrl_t c, str
 			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);
 
openSUSE Build Service is sponsored by