Skip to content

Commit 2e67fa3

Browse files
committed
nvme: expose tls mode in use
It is not possible to determine the active TLS mode from the presence or absence of sysfs attributes like tls_key, tls_configured_key, or dhchap_secret. With the introduction of the concat mode and optional DH-CHAP authentication, different configurations can result in identical sysfs state. This makes user space detection unreliable. Read the TLS mode used from the newly added sysfs entry. (cherry picked from d0c4d3aedb1c) Signed-off-by: Daniel Wagner <[email protected]>
1 parent 085b90b commit 2e67fa3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/nvme/tree.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,20 @@ static char *nvme_ctrl_lookup_phy_slot(nvme_root_t r, const char *address)
19801980
return NULL;
19811981
}
19821982

1983+
static void nvme_read_sysfs_tls_mode(nvme_root_t r, nvme_ctrl_t c)
1984+
{
1985+
_cleanup_free_ char *mode = NULL;
1986+
1987+
mode = nvme_get_ctrl_attr(c, "tls_mode");
1988+
if (!mode)
1989+
return;
1990+
1991+
if (!strcmp(mode, "tls"))
1992+
c->cfg.tls = true;
1993+
else if (!strcmp(mode, "concat"))
1994+
c->cfg.concat = true;
1995+
}
1996+
19831997
static void nvme_read_sysfs_dhchap(nvme_root_t r, nvme_ctrl_t c)
19841998
{
19851999
char *host_key, *ctrl_key;
@@ -2088,6 +2102,7 @@ static int nvme_reconfigure_ctrl(nvme_root_t r, nvme_ctrl_t c, const char *path,
20882102
c->phy_slot = nvme_ctrl_lookup_phy_slot(r, c->address);
20892103
nvme_read_sysfs_dhchap(r, c);
20902104
nvme_read_sysfs_tls(r, c);
2105+
nvme_read_sysfs_tls_mode(r, c);
20912106

20922107
errno = 0; /* cleanup after nvme_get_ctrl_attr() */
20932108
return 0;

0 commit comments

Comments
 (0)