summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-19 20:57:06 -0800
committerDamjan Marion <dmarion@me.com>2019-02-20 16:26:46 +0000
commit51a423dc2b0d4aad0bbd8f7e757d2ca49221ff83 (patch)
treee29457b7aad9743ae5eaec4c85c199dd86b428ba /src/vnet/session/application.c
parent84442eed6d0debaa0597e6e58f21f4b45c40ad7a (diff)
session: fix local sessions disconnects
Change-Id: Ib4ca472aa2413ced7f82d87e4fee65ca86ab1f2b Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application.c')
-rw-r--r--src/vnet/session/application.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index e79851cab4c..3bf722b81a0 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1155,7 +1155,9 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
{
if (session_handle_is_local (a->handle))
{
+ app_worker_t *client_wrk, *server_wrk;
local_session_t *ls;
+ u32 wrk_index = ~0;
/* Disconnect reply came to worker 1 not main thread */
app_interface_check_thread_and_barrier (vnet_disconnect_session, a);
@@ -1163,7 +1165,22 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
if (!(ls = app_worker_get_local_session_from_handle (a->handle)))
return 0;
- return app_worker_local_session_disconnect (a->app_index, ls);
+ client_wrk = app_worker_get_if_valid (ls->client_wrk_index);
+ server_wrk = app_worker_get (ls->app_wrk_index);
+
+ if (server_wrk->app_index == a->app_index)
+ wrk_index = server_wrk->wrk_index;
+ else if (client_wrk && client_wrk->app_index == a->app_index)
+ wrk_index = client_wrk->wrk_index;
+
+ if (wrk_index == ~0)
+ {
+ clib_warning ("app %u does not own session 0x%lx", a->app_index,
+ application_local_session_handle (ls));
+ return VNET_API_ERROR_INVALID_VALUE;
+ }
+
+ return app_worker_local_session_disconnect (wrk_index, ls);
}
else
{