From 59ef81fad3f05843a827a1f3fb207aaa7380e00d Mon Sep 17 00:00:00 2001 From: Martin George Date: Sat, 6 Apr 2024 18:17:25 +0530 Subject: [PATCH] nvme: check-tls-key fails despite having hostnqn file Nvme check-tls-key requires both hostnqn and subsysnqn to be specified along with the keydata. Ideally, it should be able to fetch the hostnqn string from the hostnqn file if no hostnqn option is passed, irrespective of whether the insert option is specified or not. Also passing the subsysnqn option is required not just for identity v1, but for v0 as well, irrespective of the insert option. Fix accordingly. Signed-off-by: Martin George --- nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvme.c b/nvme.c index 05c0a65ba1..8fc559bb4d 100644 --- a/nvme.c +++ b/nvme.c @@ -8715,14 +8715,14 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct } if (cfg.subsysnqn) { - if (cfg.insert && !cfg.hostnqn) { + if (!cfg.hostnqn) { cfg.hostnqn = nvmf_hostnqn_from_file(); if (!cfg.hostnqn) { nvme_show_error("Failed to read host NQN"); return -EINVAL; } } - } else if (cfg.insert || cfg.identity == 1) { + } else { nvme_show_error("Need to specify a subsystem NQN"); return -EINVAL; }