summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-08-05 10:22:52 +0200
committerFlorin Coras <florin.coras@gmail.com>2021-09-21 05:13:26 +0000
commitb3ea73e766013bed70340688ce361d9096045b44 (patch)
treed4e7b3a2c9a45b412b605b210181b9545cfbc16f /src/vnet/session/session_api.c
parenta9f5f85c95dbb0d05a5fa6a31847b50b511e5156 (diff)
session: implement app_ns deletion
Type: feature Change-Id: If0edbb21a0283d66c648a9e190d238c8cfa56353 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vnet/session/session_api.c')
-rw-r--r--src/vnet/session/session_api.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index c0ed1250dab..c031545323e 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -930,7 +930,7 @@ vl_api_app_namespace_add_del_v3_t_handler (
mp->netns[sizeof (mp->netns) - 1] = 0;
ns_id = format (0, "%s", &mp->namespace_id);
netns = format (0, "%s", &mp->netns);
- sock_name = format (0, "%s", &mp->sock_name);
+ sock_name = vl_api_from_api_to_new_vec (mp, &mp->sock_name);
vnet_app_namespace_add_del_args_t args = {
.ns_id = ns_id,
.netns = netns,
@@ -1762,6 +1762,23 @@ error:
return err;
}
+void
+appns_sapi_del_ns_socket (app_namespace_t *app_ns)
+{
+ app_ns_api_handle_t *handle;
+ clib_socket_t *cs;
+
+ pool_foreach (cs, app_ns->app_sockets)
+ {
+ handle = (app_ns_api_handle_t *) &cs->private_data;
+ clib_file_del_by_index (&file_main, handle->aah_file_index);
+
+ clib_socket_close (cs);
+ clib_socket_free (cs);
+ }
+ pool_free (app_ns->app_sockets);
+}
+
int
appns_sapi_add_ns_socket (app_namespace_t * app_ns)
{
@@ -1799,7 +1816,7 @@ appns_sapi_add_ns_socket (app_namespace_t * app_ns)
* Create and initialize socket to listen on
*/
cs = appns_sapi_alloc_socket (app_ns);
- cs->config = (char *) app_ns->sock_name;
+ cs->config = (char *) vec_dup (app_ns->sock_name);
cs->flags = CLIB_SOCKET_F_IS_SERVER |
CLIB_SOCKET_F_ALLOW_GROUP_WRITE |
CLIB_SOCKET_F_SEQPACKET | CLIB_SOCKET_F_PASSCRED;