From 45ec9f49bc7ee0bd3ac4f2a07ecb1d0b9280c036 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Wed, 6 Nov 2019 14:47:40 +0100 Subject: session: ckpair store & crypto engine as mq params Type: feature This patch adds the logic to pass to connect & listen msg in the mq the following parameters * ckpair index * crypto engine (for now only used in quic) Change-Id: I7213d8b581cb4532a9a6b18c4b3fe021287b7733 Signed-off-by: Nathan Skrzypczak --- src/vnet/api_errno.h | 3 ++- src/vnet/session/application_interface.h | 2 ++ src/vnet/session/session_api.c | 8 +++++--- src/vnet/session/session_node.c | 2 ++ src/vnet/session/session_types.h | 1 + 5 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/vnet/api_errno.h b/src/vnet/api_errno.h index a3451421c50..2fbedf2eed6 100644 --- a/src/vnet/api_errno.h +++ b/src/vnet/api_errno.h @@ -151,7 +151,8 @@ _(RSRC_IN_USE, -155, "Resource In Use") \ _(KEY_LENGTH, -156, "invalid Key Length") \ _(FIB_PATH_UNSUPPORTED_NH_PROTO, -157, "Unsupported FIB Path protocol") \ _(API_ENDIAN_FAILED, -159, "Endian mismatch detected") \ -_(NO_CHANGE, -160, "No change in table") +_(NO_CHANGE, -160, "No change in table") \ +_(MISSING_CERT_KEY, -161, "Missing certifcate or key") typedef enum { diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 74bca8002a6..5c26060d756 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -296,6 +296,7 @@ typedef struct session_listen_msg_ u8 is_ip4; ip46_address_t ip; u32 ckpair_index; + u8 crypto_engine; } __clib_packed session_listen_msg_t; STATIC_ASSERT (sizeof (session_listen_msg_t) <= SESSION_CTRL_MSG_MAX_SIZE, @@ -376,6 +377,7 @@ typedef struct session_connect_msg_ u8 hostname[16]; u64 parent_handle; u32 ckpair_index; + u8 crypto_engine; } __clib_packed session_connect_msg_t; STATIC_ASSERT (sizeof (session_connect_msg_t) <= SESSION_CTRL_MSG_MAX_SIZE, diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 0b610f3f313..add9370e3c8 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -1403,7 +1403,7 @@ done: /* *INDENT-OFF* */ REPLY_MACRO2 (VL_API_APP_ADD_CERT_KEY_PAIR_REPLY, ({ if (!rv) - rmp->index = a->index; + rmp->index = clib_host_to_net_u32 (a->index); })); /* *INDENT-ON* */ } @@ -1412,16 +1412,18 @@ static void vl_api_app_del_cert_key_pair_t_handler (vl_api_app_del_cert_key_pair_t * mp) { vl_api_app_del_cert_key_pair_reply_t *rmp; + u32 ckpair_index; int rv = 0; if (session_main_is_enabled () == 0) { rv = VNET_API_ERROR_FEATURE_DISABLED; goto done; } - rv = vnet_app_del_cert_key_pair (mp->index); + ckpair_index = clib_net_to_host_u32 (mp->index); + rv = vnet_app_del_cert_key_pair (ckpair_index); done: - REPLY_MACRO (VL_API_APP_ADD_CERT_KEY_PAIR_REPLY); + REPLY_MACRO (VL_API_APP_DEL_CERT_KEY_PAIR_REPLY); } /* ### WILL BE DEPRECATED POST 20.01 ### */ diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index e5faf3c1663..865c8b7a607 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -55,6 +55,7 @@ session_mq_listen_handler (void *data) a->sep.sw_if_index = ENDPOINT_INVALID_INDEX; a->sep.transport_proto = mp->proto; a->sep_ext.ckpair_index = mp->ckpair_index; + a->sep_ext.crypto_engine = mp->crypto_engine; a->app_index = app->app_index; a->wrk_map_index = mp->wrk_index; @@ -115,6 +116,7 @@ session_mq_connect_handler (void *data) a->sep.peer.sw_if_index = ENDPOINT_INVALID_INDEX; a->sep_ext.parent_handle = mp->parent_handle; a->sep_ext.ckpair_index = mp->ckpair_index; + a->sep_ext.crypto_engine = mp->crypto_engine; if (mp->hostname_len) { vec_validate (a->sep_ext.hostname, mp->hostname_len - 1); diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h index 2e8a455d4c0..4b187a69480 100644 --- a/src/vnet/session/session_types.h +++ b/src/vnet/session/session_types.h @@ -46,6 +46,7 @@ typedef struct _session_endpoint_cfg u8 *hostname; u64 parent_handle; u32 ckpair_index; + u8 crypto_engine; } session_endpoint_cfg_t; #define SESSION_IP46_ZERO \ -- cgit 1.2.3-korg