diff options
author | Florin Coras <fcoras@cisco.com> | 2018-09-07 13:29:17 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-09-08 12:12:13 +0000 |
commit | da3eec1672d66131ec85f8420f4df070e6cf326d (patch) | |
tree | fc74793d1b21d925117d287e5f5e29432b35987d /src/vnet/session/application_interface.c | |
parent | 74cac8839efae6a69baea031fb01602ef8907e8a (diff) |
session: detect namespace for transport apps
Change-Id: I770607cb213d538a29d7bd5762682981b01e9d18
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_interface.c')
-rw-r--r-- | src/vnet/session/application_interface.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c index ab87def4062..6c517e8f92b 100644 --- a/src/vnet/session/application_interface.c +++ b/src/vnet/session/application_interface.c @@ -130,11 +130,25 @@ api_parse_session_handle (u64 handle, u32 * session_index, u32 * thread_index) } static void -session_endpoint_update_for_app (session_endpoint_t * sep, +session_endpoint_update_for_app (session_endpoint_extended_t * sep, application_t * app) { app_namespace_t *app_ns; - app_ns = app_namespace_get (app->ns_index); + u32 ns_index; + + ns_index = app->ns_index; + + /* App is a transport proto, so fetch the calling app's ns */ + if (app->flags & APP_OPTIONS_FLAGS_IS_TRANSPORT_APP) + { + app_worker_t *owner_wrk; + application_t *owner_app; + + owner_wrk = app_worker_get (sep->app_wrk_index); + owner_app = application_get (owner_wrk->app_index); + ns_index = owner_app->ns_index; + } + app_ns = app_namespace_get (ns_index); if (app_ns) { /* Ask transport and network to bind to/connect using local interface @@ -164,7 +178,7 @@ vnet_bind_inline (vnet_bind_args_t * a) app_wrk = application_get_worker (app, a->wrk_map_index); a->sep_ext.app_wrk_index = app_wrk->wrk_index; - session_endpoint_update_for_app (&a->sep, app); + session_endpoint_update_for_app (&a->sep_ext, app); if (!session_endpoint_in_ns (&a->sep)) return VNET_API_ERROR_INVALID_VALUE_2; @@ -257,7 +271,7 @@ application_connect (vnet_connect_args_t * a) return VNET_API_ERROR_INVALID_VALUE; client = application_get (a->app_index); - session_endpoint_update_for_app (&a->sep, client); + session_endpoint_update_for_app (&a->sep_ext, client); client_wrk = application_get_worker (client, a->wrk_map_index); /* |