File 0008-fabrics-skip-connect-if-transport-type-doesn-t-match.patch of Package nvme-cli.22909

From: Martin George <marting@netapp.com>
Date: Sat, 5 Jun 2021 15:16:26 +0530
Subject: fabrics: skip connect if transport type doesn't match
References: bsc#1187287 bsc#1187860
Git-commit: edf0998f5a668b141c73a9648acf427105586372

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

--- a/fabrics.c
+++ b/fabrics.c
@@ -1237,6 +1237,10 @@ static bool should_connect(struct nvmf_d
 	if (cargs_match_found(entry))
 		return false;
 
+	/* skip connect if the transport type doesn't match */
+	if (strcmp(cfg.transport, trtype_str(entry->trtype)))
+		return false;
+
 	if (!cfg.matching_only || !cfg.traddr)
 		return true;
 
openSUSE Build Service is sponsored by