summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-07 13:29:17 -0700
committerDamjan Marion <dmarion@me.com>2018-09-08 12:12:13 +0000
commitda3eec1672d66131ec85f8420f4df070e6cf326d (patch)
treefc74793d1b21d925117d287e5f5e29432b35987d /src
parent74cac8839efae6a69baea031fb01602ef8907e8a (diff)
session: detect namespace for transport apps
Change-Id: I770607cb213d538a29d7bd5762682981b01e9d18 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/application_interface.c22
-rw-r--r--src/vnet/session/application_interface.h1
-rw-r--r--src/vnet/tls/tls.c1
3 files changed, 20 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);
/*
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 1eefb0c3860..5b28a29c45b 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -123,6 +123,7 @@ typedef enum
_(ACCEPT_REDIRECT, "Use FIFO with redirects") \
_(ADD_SEGMENT, "Add segment and signal app if needed") \
_(IS_BUILTIN, "Application is builtin") \
+ _(IS_TRANSPORT_APP, "Application is a transport proto") \
_(IS_PROXY, "Application is proxying") \
_(USE_GLOBAL_SCOPE, "App can use global session scope") \
_(USE_LOCAL_SCOPE, "App can use local session scope") \
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 2d7126a6dfe..a31466baf29 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -714,6 +714,7 @@ tls_init (vlib_main_t * vm)
a->options[APP_OPTIONS_TX_FIFO_SIZE] = fifo_size;
a->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
a->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
+ a->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_IS_TRANSPORT_APP;
if (vnet_application_attach (a))
{