vcl session: refactor passing of crypto context
Pass tls/quic crypto context using extended config instead of bloating
conect/listen messages.
Type: refactor
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I0bc637ae310e6c31ef1e16847501dcb81453ee94
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1ece9db..a0f4338 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -193,7 +193,6 @@
clib_memcpy_fast (&mp->ip, &s->transport.lcl_ip, sizeof (mp->ip));
mp->port = s->transport.lcl_port;
mp->proto = s->session_type;
- mp->ckpair_index = s->ckpair_index;
mp->vrf = s->vrf;
if (s->flags & VCL_SESSION_F_CONNECTED)
mp->flags = TRANSPORT_CFG_F_CONNECTED;
@@ -228,7 +227,6 @@
mp->port = s->transport.rmt_port;
mp->lcl_port = s->transport.lcl_port;
mp->proto = s->session_type;
- mp->ckpair_index = s->ckpair_index;
mp->vrf = s->vrf;
if (s->flags & VCL_SESSION_F_CONNECTED)
mp->flags |= TRANSPORT_CFG_F_CONNECTED;
@@ -1374,7 +1372,6 @@
session->session_type = proto;
session->session_state = VCL_STATE_CLOSED;
session->vpp_handle = ~0;
- session->ckpair_index = ~0;
session->is_dgram = vcl_proto_is_dgram (proto);
if (is_nonblocking)
@@ -3710,7 +3707,17 @@
rv = VPPCOM_EINVAL;
break;
}
- session->ckpair_index = *(uint32_t *) buffer;
+ if (!session->ext_config)
+ {
+ vcl_session_alloc_ext_cfg (session, TRANSPORT_ENDPT_EXT_CFG_CRYPTO);
+ }
+ else if (session->ext_config->type != TRANSPORT_ENDPT_EXT_CFG_CRYPTO)
+ {
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+
+ session->ext_config->crypto.ckpair_index = *(uint32_t *) buffer;
break;
case VPPCOM_ATTR_SET_VRF: