Skip to content

Commit 511040e

Browse files
hreineckeigaw
authored andcommitted
fabrics: allow dhchap authentication for unique discovery controller
When we have a unique discovery controller we can use dhchap authentication, so remove the limitations and ensure we're only setting the dhchap host key when a unique discovery controller is referenced. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent cd4911e commit 511040e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,9 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
757757
(hostid && add_argument(ctx, argstr, hostid, hostid)) ||
758758
(discover && !discovery_nqn &&
759759
add_bool_argument(ctx, argstr, discovery, true)) ||
760-
(!discover && hostkey &&
760+
(hostkey &&
761761
add_argument(ctx, argstr, dhchap_secret, hostkey)) ||
762-
(!discover && ctrlkey &&
762+
(ctrlkey &&
763763
add_argument(ctx, argstr, dhchap_ctrl_secret, ctrlkey)) ||
764764
(!discover &&
765765
add_int_argument(ctx, argstr, nr_io_queues,
@@ -2090,7 +2090,7 @@ static int __create_discovery_ctrl(struct nvme_global_ctx *ctx,
20902090
strcmp(trcfg->subsysnqn, NVME_DISC_SUBSYS_NAME));
20912091
tmo = set_discovery_kato(fctx, cfg);
20922092

2093-
if (fctx->hostkey) {
2093+
if (nvme_ctrl_is_unique_discovery_ctrl(c) && fctx->hostkey) {
20942094
nvme_ctrl_set_dhchap_host_key(c, fctx->hostkey);
20952095
if (fctx->ctrlkey)
20962096
nvme_ctrl_set_dhchap_ctrl_key(c, fctx->ctrlkey);

0 commit comments

Comments
 (0)