Blame SOURCES/0002-fabrics-skip-connect-if-transport-type-doesn-t-match.patch

2776a8
From edf0998f5a668b141c73a9648acf427105586372 Mon Sep 17 00:00:00 2001
2776a8
From: Martin George <marting@netapp.com>
2776a8
Date: Sat, 5 Jun 2021 15:16:26 +0530
2776a8
Subject: [PATCH] fabrics: skip connect if transport type doesn't match
2776a8
2776a8
Discovery log page data may include records belonging to different
2776a8
transport types. If during a nvme connect-all, a connect is attempted
2776a8
on a record that doesn't match the transport type passed here, it
2776a8
would end up in a connect failure for that record. For e.g. one would
2776a8
see the below error if a connect is attempted on a tcp record but the
2776a8
transport type passed here is 'fc' and its associated parameters:
2776a8
2776a8
nvme_tcp: malformed src address passed: nn-0xXXXX:pn-0xYYYY
2776a8
2776a8
Fix this by proceeding with the connect only if the appropriate
2776a8
transport type matches a given record during the connect-all.
2776a8
2776a8
Signed-off-by: Martin George <marting@netapp.com>
2776a8
---
2776a8
 fabrics.c | 4 ++++
2776a8
 1 file changed, 4 insertions(+)
2776a8
2776a8
diff --git a/fabrics.c b/fabrics.c
2776a8
index db42ddb..6cc142d 100644
2776a8
--- a/fabrics.c
2776a8
+++ b/fabrics.c
2776a8
@@ -1354,6 +1354,10 @@ static bool should_connect(struct nvmf_disc_rsp_page_entry *entry)
2776a8
 	if (cargs_match_found(entry))
2776a8
 		return false;
2776a8
 
2776a8
+	/* skip connect if the transport type doesn't match */
2776a8
+	if (strcmp(fabrics_cfg.transport, trtype_str(entry->trtype)))
2776a8
+		return false;
2776a8
+
2776a8
 	if (!fabrics_cfg.matching_only || !fabrics_cfg.traddr)
2776a8
 		return true;
2776a8
 
2776a8
-- 
2776a8
2.27.0
2776a8