public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-fabrics: restrict host_iface options match criteria
@ 2022-07-22 10:03 Daniel Wagner
  0 siblings, 0 replies; only message in thread
From: Daniel Wagner @ 2022-07-22 10:03 UTC (permalink / raw)
  To: linux-nvme; +Cc: Daniel Wagner

Enforce consistent use of host_iface in setups where the hosts has
several networking interface and the target just one. That means the
user needs to set the host_iface for all connections in such
scenarios.

This keeps the match logic simple and also avoids passing in invalid
pointers to strcmp.

Fixes: 4e9499337d40 ("nvme-fabrics: consider also host_iface when checking ip options")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/nvme/host/fabrics.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 01e96322e363..fb054929553c 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -962,7 +962,9 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl,
 	if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
 	    strcmp(opts->traddr, ctrl->opts->traddr) ||
 	    strcmp(opts->trsvcid, ctrl->opts->trsvcid) ||
-	    strcmp(opts->host_iface, ctrl->opts->host_iface))
+	    (((opts->mask & NVMF_OPT_HOST_IFACE) &&
+	      (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) &&
+	       strcmp(opts->host_iface, ctrl->opts->host_iface)))
 		return false;
 
 	/*
-- 
2.37.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-22 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22 10:03 [PATCH] nvme-fabrics: restrict host_iface options match criteria Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox