Skip to content

Commit

Permalink
fabrics: use SECTYPE to determine whether to use TLS
Browse files Browse the repository at this point in the history
The NVMe specfications are clear that the discovery log page entry
SECTYPE field indicates whether TLS is supported.
Currently the TREQ field is used, which results in enabling TLS
even when SECTYPE = "No Security" and TREQ = "Not required".
Only enable TLS if SECTYPE indicates a TLS version is enabled.

From the NVMe/TCP transport specification, version 1.0c:
Security Type (SECTYPE): Specifies the type of security used by the
NVMe/TCP port. If SECTYPE is a value of 0h (No Security), then the host
shall set up a normal TCP connection.

From TP 8018:
The SECTYPE value of 0h (i.e., No Security) specifies that TLS is not
supported.

From TP 8025 (the "TLS Permitted" host case):
If the SECTYPE field in the TSAS field in the discovery log entry for
the remote entity is cleared to zero and the TSC field is not set to 01b
(i.e., Required), then initiate TCP connections without TLS.

Fixes: 3962a45 ("fabrics: add fabrics config option 'tls'")
Signed-off-by: Caleb Sander <[email protected]>
  • Loading branch information
calebsander authored and igaw committed Oct 31, 2023
1 parent da8c28e commit 1f5db47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,7 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
c->cfg.disable_sqflow = true;

if (e->trtype == NVMF_TRTYPE_TCP &&
(e->treq & NVMF_TREQ_REQUIRED ||
e->treq & NVMF_TREQ_NOT_REQUIRED))
e->tsas.tcp.sectype != NVMF_TCP_SECTYPE_NONE)
c->cfg.tls = true;

ret = nvmf_add_ctrl(h, c, cfg);
Expand Down

0 comments on commit 1f5db47

Please sign in to comment.