summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/test/test_vcl.py8
-rw-r--r--src/vcl/vcl_bapi.c50
-rw-r--r--src/vcl/vcl_private.c2
3 files changed, 41 insertions, 19 deletions
diff --git a/src/vcl/test/test_vcl.py b/src/vcl/test/test_vcl.py
index d7a44ed7d1e..d9346ba77fa 100644
--- a/src/vcl/test/test_vcl.py
+++ b/src/vcl/test/test_vcl.py
@@ -120,9 +120,9 @@ class VCLTestCase(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id=b"1", secret=1234,
+ self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id=b"2", secret=5678,
+ self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
sw_if_index=self.loop1.sw_if_index)
# Add inter-table routes
@@ -161,9 +161,9 @@ class VCLTestCase(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id=b"1", secret=1234,
+ self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id=b"2", secret=5678,
+ self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
sw_if_index=self.loop1.sw_if_index)
# Add inter-table routes
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index efa5cc170ef..af2eb035a67 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -73,8 +73,9 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
vcl_worker_t *wrk = vcl_worker_get (0);
svm_msg_q_t *ctrl_mq;
u64 segment_handle;
- int *fds = 0, i;
+ int *fds = 0, i, rv;
u32 n_fds = 0;
+ char *segment_name = 0;
if (mp->retval)
{
@@ -108,9 +109,16 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
goto failed;
if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_MEMFD, fds[n_fds++]))
- goto failed;
+ {
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name,
+ SSVM_SEGMENT_MEMFD, fds[n_fds++]);
+ vec_free (segment_name);
+ if (rv != 0)
+ goto failed;
+ }
+
if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
{
@@ -123,8 +131,12 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
}
else
{
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_SHM, -1))
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
+ -1);
+ vec_free (segment_name);
+ if (rv != 0)
goto failed;
}
@@ -143,10 +155,11 @@ static void
vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
mp)
{
- int n_fds = 0, *fds = 0, i;
+ int n_fds = 0, *fds = 0, i, rv;
u64 segment_handle;
vcl_worker_t *wrk;
u32 wrk_index;
+ char *segment_name = 0;
if (mp->retval)
{
@@ -189,9 +202,15 @@ vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
goto failed;
if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT)
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_MEMFD, fds[n_fds++]))
- goto failed;
+ {
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name,
+ SSVM_SEGMENT_MEMFD, fds[n_fds++]);
+ vec_free (segment_name);
+ if (rv != 0)
+ goto failed;
+ }
if (mp->fd_flags & SESSION_FD_F_MQ_EVENTFD)
{
@@ -204,8 +223,12 @@ vl_api_app_worker_add_del_reply_t_handler (vl_api_app_worker_add_del_reply_t *
}
else
{
- if (vcl_segment_attach (segment_handle, (char *) mp->segment_name,
- SSVM_SEGMENT_SHM, -1))
+ segment_name = vl_api_from_api_to_new_c_string (&mp->segment_name);
+ rv =
+ vcl_segment_attach (segment_handle, segment_name, SSVM_SEGMENT_SHM,
+ -1);
+ vec_free (segment_name);
+ if (rv != 0)
goto failed;
}
vcm->app_state = STATE_APP_READY;
@@ -313,8 +336,7 @@ vppcom_app_send_attach (void)
bmp->options[APP_OPTIONS_TLS_ENGINE] = tls_engine;
if (nsid_len)
{
- bmp->namespace_id_len = nsid_len;
- clib_memcpy_fast (bmp->namespace_id, vcm->cfg.namespace_id, nsid_len);
+ vl_api_vec_to_api_string (vcm->cfg.namespace_id, &bmp->namespace_id);
bmp->options[APP_OPTIONS_NAMESPACE_SECRET] = vcm->cfg.namespace_secret;
}
vl_msg_api_send_shmem (wrk->vl_input_queue, (u8 *) & bmp);
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index f041a868929..3cb76c6bb7d 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -383,7 +383,7 @@ vcl_segment_attach (u64 segment_handle, char *name, ssvm_segment_type_t type,
int rv;
memset (a, 0, sizeof (*a));
- a->segment_name = (char *) name;
+ a->segment_name = name;
a->segment_type = type;
if (type == SSVM_SEGMENT_MEMFD)