Skip to content

Commit dd1daf3

Browse files
dwsuseigaw
authored andcommitted
util: added error code for ENOKEY
The kernel returns ENOKEY when the PSK TLS is missing, thus add the corresponding ENVME error code. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 5b4c2cb commit dd1daf3

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/nvme/fabrics.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ static int __nvmf_add_ctrl(nvme_root_t r, const char *argstr)
831831
return -ENVME_CONNECT_CONNREFUSED;
832832
case EADDRNOTAVAIL:
833833
return -ENVME_CONNECT_ADDRNOTAVAIL;
834+
case ENOKEY:
835+
return -ENVME_CONNECT_NOKEY;
834836
default:
835837
return -ENVME_CONNECT_WRITE;
836838
}

src/nvme/util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ static const char * const libnvme_status[] = {
626626
[ENVME_CONNECT_CONNREFUSED] = "connection refused",
627627
[ENVME_CONNECT_ADDRNOTAVAIL] = "cannot assign requested address",
628628
[ENVME_CONNECT_IGNORED] = "connection ignored",
629+
[ENVME_CONNECT_NOKEY] = "pre-shared TLS key is missing"
629630
};
630631

631632
const char *nvme_errno_to_string(int status)

src/nvme/util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* @ENVME_CONNECT_CONNREFUSED: connection refused
4242
* @ENVME_CONNECT_ADDRNOTAVAIL: cannot assign requested address
4343
* @ENVME_CONNECT_IGNORED: connect attempt is ignored due to configuration
44+
* @ENVME_CONNECT_NOKEY: the TLS key is missing
4445
*/
4546
enum nvme_connect_err {
4647
ENVME_CONNECT_RESOLVE = 1000,
@@ -63,6 +64,7 @@ enum nvme_connect_err {
6364
ENVME_CONNECT_CONNREFUSED,
6465
ENVME_CONNECT_ADDRNOTAVAIL,
6566
ENVME_CONNECT_IGNORED,
67+
ENVME_CONNECT_NOKEY,
6668
};
6769

6870
/**

0 commit comments

Comments
 (0)