Skip to content

Commit

Permalink
fabrics: do not attempt to import keys if tls is not enabled
Browse files Browse the repository at this point in the history
There is no point in trying to import a key if the TLS option
is not enabled.

Signed-off-by: Daniel Wagner <[email protected]>
  • Loading branch information
igaw committed Nov 15, 2024
1 parent 21f5e86 commit 2d92c35
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,17 +627,19 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)

ctrlkey = nvme_ctrl_get_dhchap_key(c);

ret = __nvme_import_keys_from_config(h, c, &keyring_id, &key_id);
if (ret) {
errno = -ret;
return -1;
}
if (cfg->tls) {
ret = __nvme_import_keys_from_config(h, c, &keyring_id, &key_id);
if (ret) {
errno = -ret;
return -1;
}

if (key_id == 0) {
if (cfg->tls_configured_key)
key_id = cfg->tls_configured_key;
else
key_id = cfg->tls_key;
if (key_id == 0) {
if (cfg->tls_configured_key)
key_id = cfg->tls_configured_key;
else
key_id = cfg->tls_key;
}
}

if (add_argument(r, argstr, transport, transport) ||
Expand Down

0 comments on commit 2d92c35

Please sign in to comment.