summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_private.c15
-rw-r--r--src/vcl/vcl_private.h5
-rw-r--r--src/vcl/vppcom.c15
3 files changed, 30 insertions, 5 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 721416b045a..464061cfb5a 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -316,6 +316,21 @@ vcl_session_write_ready (vcl_session_t * s)
}
int
+vcl_session_alloc_ext_cfg (vcl_session_t *s,
+ transport_endpt_ext_cfg_type_t type)
+{
+ if (s->ext_config)
+ return -1;
+
+ s->ext_config = clib_mem_alloc (sizeof (transport_endpt_ext_cfg_t));
+ clib_memset (s->ext_config, 0, sizeof (*s->ext_config));
+ s->ext_config->len = sizeof (*s->ext_config);
+ s->ext_config->type = type;
+
+ return 0;
+}
+
+int
vcl_segment_attach (u64 segment_handle, char *name, ssvm_segment_type_t type,
int fd)
{
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 1da334a1da9..12504c51982 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -160,7 +160,6 @@ typedef struct vcl_session_
vppcom_epoll_t vep;
u32 attributes; /**< see @ref vppcom_session_attr_t */
int libc_epfd;
- u32 ckpair_index;
u32 vrf;
u32 sndbuf_size; // VPP-TBD: Hack until support setsockopt(SO_SNDBUF)
@@ -389,6 +388,8 @@ vcl_session_free (vcl_worker_t * wrk, vcl_session_t * s)
/* Debug level set to 1 to avoid debug messages while ldp is cleaning up */
VDBG (1, "session %u [0x%llx] removed", s->session_index, s->vpp_handle);
vcl_session_detach_fifos (s);
+ if (s->ext_config)
+ clib_mem_free (s->ext_config);
pool_put (wrk->sessions, s);
}
@@ -663,6 +664,8 @@ void vcl_segment_table_del (u64 segment_handle);
int vcl_session_read_ready (vcl_session_t * session);
int vcl_session_write_ready (vcl_session_t * session);
+int vcl_session_alloc_ext_cfg (vcl_session_t *s,
+ transport_endpt_ext_cfg_type_t type);
static inline vcl_worker_t *
vcl_worker_get (u32 wrk_index)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1ece9db9940..a0f4338f902 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -193,7 +193,6 @@ vcl_send_session_listen (vcl_worker_t * wrk, vcl_session_t * s)
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 @@ vcl_send_session_connect (vcl_worker_t * wrk, vcl_session_t * s)
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 @@ vppcom_session_create (u8 proto, u8 is_nonblocking)
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 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
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: