Skip to content

Commit b512247

Browse files
committed
fabrics: add 'concat' option
Add an option 'concat' to enable secure concatenation for TCP. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 2f722b1 commit b512247

5 files changed

Lines changed: 18 additions & 1 deletion

File tree

doc/config-schema.json.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@
169169
"type": "boolean",
170170
"default": false
171171
},
172+
"concat": {
173+
"description": "Enable secure concatenation",
174+
"type": "boolean",
175+
"default": false
176+
},
172177
"persistent": {
173178
"description": "Create persistent discovery connection",
174179
"type": "boolean"

src/nvme/fabrics.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ static struct nvme_fabrics_config *merge_config(nvme_ctrl_t c,
260260
MERGE_CFG_OPTION(ctrl_cfg, cfg, hdr_digest, false);
261261
MERGE_CFG_OPTION(ctrl_cfg, cfg, data_digest, false);
262262
MERGE_CFG_OPTION(ctrl_cfg, cfg, tls, false);
263+
MERGE_CFG_OPTION(ctrl_cfg, cfg, concat, false);
263264

264265
return ctrl_cfg;
265266
}
@@ -289,6 +290,7 @@ void nvmf_update_config(nvme_ctrl_t c, const struct nvme_fabrics_config *cfg)
289290
UPDATE_CFG_OPTION(ctrl_cfg, cfg, hdr_digest, false);
290291
UPDATE_CFG_OPTION(ctrl_cfg, cfg, data_digest, false);
291292
UPDATE_CFG_OPTION(ctrl_cfg, cfg, tls, false);
293+
UPDATE_CFG_OPTION(ctrl_cfg, cfg, concat, false);
292294
}
293295

294296
static int __add_bool_argument(char **argstr, char *tok, bool arg)
@@ -637,7 +639,9 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
637639
(!strcmp(transport, "tcp") &&
638640
add_bool_argument(r, argstr, data_digest, cfg->data_digest)) ||
639641
(!strcmp(transport, "tcp") &&
640-
add_bool_argument(r, argstr, tls, cfg->tls))) {
642+
add_bool_argument(r, argstr, tls, cfg->tls)) ||
643+
(!strcmp(transport, "tcp") &&
644+
add_bool_argument(r, argstr, concat, cfg->concat))) {
641645
free(*argstr);
642646
return -1;
643647
}
@@ -705,6 +709,7 @@ static int __nvmf_supported_options(nvme_root_t r)
705709
nvme_msg(r, LOG_DEBUG, "%s ", v);
706710

707711
parse_option(r, v, cntlid);
712+
parse_option(r, v, concat);
708713
parse_option(r, v, ctrl_loss_tmo);
709714
parse_option(r, v, data_digest);
710715
parse_option(r, v, dhchap_ctrl_secret);

src/nvme/fabrics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @hdr_digest: Generate/verify header digest (TCP)
4343
* @data_digest: Generate/verify data digest (TCP)
4444
* @tls: Start TLS on the connection (TCP)
45+
* @concat: Enable secure concatenation (TCP)
4546
*/
4647
struct nvme_fabrics_config {
4748
char *host_traddr;
@@ -63,6 +64,7 @@ struct nvme_fabrics_config {
6364
bool hdr_digest;
6465
bool data_digest;
6566
bool tls;
67+
bool concat;
6668
};
6769

6870
/**

src/nvme/json.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ static void json_update_attributes(nvme_ctrl_t c,
6060
data_digest, val_obj);
6161
JSON_UPDATE_BOOL_OPTION(cfg, key_str,
6262
tls, val_obj);
63+
JSON_UPDATE_BOOL_OPTION(cfg, key_str,
64+
concat, val_obj);
6365
if (!strcmp("persistent", key_str) &&
6466
!nvme_ctrl_is_persistent(c))
6567
nvme_ctrl_set_persistent(c, true);
@@ -325,6 +327,7 @@ static void json_update_port(struct json_object *ctrl_array, nvme_ctrl_t c)
325327
JSON_BOOL_OPTION(cfg, port_obj, hdr_digest);
326328
JSON_BOOL_OPTION(cfg, port_obj, data_digest);
327329
JSON_BOOL_OPTION(cfg, port_obj, tls);
330+
JSON_BOOL_OPTION(cfg, port_obj, concat);
328331
if (nvme_ctrl_is_persistent(c))
329332
json_object_object_add(port_obj, "persistent",
330333
json_object_new_boolean(true));
@@ -501,6 +504,7 @@ static void json_dump_ctrl(struct json_object *ctrl_array, nvme_ctrl_t c)
501504
JSON_BOOL_OPTION(cfg, ctrl_obj, hdr_digest);
502505
JSON_BOOL_OPTION(cfg, ctrl_obj, data_digest);
503506
JSON_BOOL_OPTION(cfg, ctrl_obj, tls);
507+
JSON_BOOL_OPTION(cfg, ctrl_obj, concat);
504508
if (nvme_ctrl_is_persistent(c))
505509
json_object_object_add(ctrl_obj, "persistent",
506510
json_object_new_boolean(true));

src/nvme/private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ struct nvme_host {
125125

126126
struct nvme_fabric_options {
127127
bool cntlid;
128+
bool concat;
128129
bool ctrl_loss_tmo;
129130
bool data_digest;
130131
bool dhchap_ctrl_secret;

0 commit comments

Comments
 (0)