session: ckpair store & crypto engine as mq params 90/23290/3
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>
Wed, 6 Nov 2019 13:47:40 +0000 (14:47 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 7 Nov 2019 17:13:17 +0000 (17:13 +0000)
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 <nathan.skrzypczak@gmail.com>
src/vnet/api_errno.h
src/vnet/session/application_interface.h
src/vnet/session/session_api.c
src/vnet/session/session_node.c
src/vnet/session/session_types.h

index a345142..2fbedf2 100644 (file)
@@ -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
 {
index 74bca80..5c26060 100644 (file)
@@ -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,
index 0b610f3..add9370 100755 (executable)
@@ -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 ### */
index e5faf3c..865c8b7 100644 (file)
@@ -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);
index 2e8a455..4b187a6 100644 (file)
@@ -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                      \