]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: check-tls-key fails despite having hostnqn file
authorMartin George <marting@netapp.com>
Sat, 6 Apr 2024 12:47:25 +0000 (18:17 +0530)
committerDaniel Wagner <wagi@monom.org>
Tue, 9 Apr 2024 09:05:40 +0000 (11:05 +0200)
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 <marting@netapp.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 05c0a65ba1794507b51fb50a90e8e68f6fe385e4..8fc559bb4d338ee9449b07721ce08cab32071ed5 100644 (file)
--- 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;
        }