summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-01 16:01:40 -0700
committerFlorin Coras <fcoras@cisco.com>2021-05-01 16:25:18 -0700
commit87f63898b4ad54c081e8aaeb35e465b2fe23b9b3 (patch)
tree0781a5e2a1723fc0a714ab74e422ee362f627e00 /src
parentf89bbbe300dad7bc479db535e7822199f98aca30 (diff)
vcl: attr api to set endpt ext config
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I06cd3721c1b534e9449bf96760c02ca30628c21e
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vcl_private.c8
-rw-r--r--src/vcl/vcl_private.h2
-rw-r--r--src/vcl/vppcom.c20
-rw-r--r--src/vcl/vppcom.h1
4 files changed, 25 insertions, 6 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 464061cfb5a..3538a092bac 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -317,14 +317,14 @@ 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)
+ transport_endpt_ext_cfg_type_t type, u32 len)
{
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 = clib_mem_alloc (len);
+ clib_memset (s->ext_config, 0, len);
+ s->ext_config->len = len;
s->ext_config->type = type;
return 0;
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 12504c51982..6060ef82357 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -665,7 +665,7 @@ 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);
+ transport_endpt_ext_cfg_type_t type, u32 len);
static inline vcl_worker_t *
vcl_worker_get (u32 wrk_index)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 5e37dcfef39..96a207b741f 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -3697,7 +3697,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
}
if (!session->ext_config)
{
- vcl_session_alloc_ext_cfg (session, TRANSPORT_ENDPT_EXT_CFG_CRYPTO);
+ vcl_session_alloc_ext_cfg (session, TRANSPORT_ENDPT_EXT_CFG_CRYPTO,
+ sizeof (transport_endpt_ext_cfg_t));
}
else if (session->ext_config->type != TRANSPORT_ENDPT_EXT_CFG_CRYPTO)
{
@@ -3744,6 +3745,23 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
*buflen);
break;
+ case VPPCOM_ATTR_SET_ENDPT_EXT_CFG:
+ if (!(buffer && buflen && (*buflen > 0)))
+ {
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+ if (session->ext_config)
+ {
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+ vcl_session_alloc_ext_cfg (session, TRANSPORT_ENDPT_EXT_CFG_NONE,
+ *buflen + sizeof (u32));
+ clib_memcpy (session->ext_config->data, buffer, *buflen);
+ session->ext_config->len = *buflen;
+ break;
+
default:
rv = VPPCOM_EINVAL;
break;
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index d956b5f93f7..ae4888566c7 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -143,6 +143,7 @@ typedef enum
VPPCOM_ATTR_SET_VRF,
VPPCOM_ATTR_GET_VRF,
VPPCOM_ATTR_GET_DOMAIN,
+ VPPCOM_ATTR_SET_ENDPT_EXT_CFG,
} vppcom_attr_op_t;
typedef struct _vcl_poll