Skip to content

Commit 3fc3554

Browse files
hreineckekawasaki
authored andcommitted
common/nvme: TLS target support
Add --tls option to _create_nvmet_subsystem and allow to specify the tls requirements in _create_nvmet_port. Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 42a310e commit 3fc3554

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

common/nvme

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ _fc_host_traddr() {
479479
}
480480

481481
_create_nvmet_port() {
482+
local tls="${1:-none}"
482483
local trtype="${nvme_trtype}"
483484
local traddr="${def_traddr}"
484485
local adrfam="${def_adrfam}"
@@ -515,7 +516,13 @@ _create_nvmet_port() {
515516
[[ "${adrfam}" != "loop" ]] ; then
516517
echo "${trsvcid}" > "${portcfs}/addr_trsvcid"
517518
fi
518-
519+
if [[ "${trtype}" == "tcp" ]] && \
520+
[[ "${tls}" != "none" ]]; then
521+
echo "tls1.3" > "${portcfs}/addr_tsas"
522+
if [[ "${tls}" != "required" ]]; then
523+
echo "not required" > "${portcfs}/addr_treq"
524+
fi
525+
fi
519526
echo "${port}"
520527
}
521528

@@ -907,6 +914,7 @@ _nvmet_target_setup() {
907914
local port p
908915
local resv_enable=""
909916
local num_ports=1
917+
local tls="none"
910918
local -a ARGS
911919

912920
while [[ $# -gt 0 ]]; do
@@ -939,6 +947,14 @@ _nvmet_target_setup() {
939947
num_ports="$2"
940948
shift 2
941949
;;
950+
--tls)
951+
tls="not-required"
952+
shift 1
953+
;;
954+
--force-tls)
955+
tls="required"
956+
shift 1
957+
;;
942958
*)
943959
echo "WARNING: unknown argument: $1"
944960
shift
@@ -985,7 +1001,7 @@ _nvmet_target_setup() {
9851001

9861002
p=0
9871003
while (( p < num_ports )); do
988-
port="$(_create_nvmet_port)"
1004+
port="$(_create_nvmet_port ${tls})"
9891005
_add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
9901006
p=$(( p + 1 ))
9911007
done

0 commit comments

Comments
 (0)