summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_namespace.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-10-26 14:25:12 -0700
committerChris Luke <chris_luke@comcast.com>2017-10-27 17:49:37 +0000
commitfc1c612d856cdab519d11edb1b317ca188b31ce6 (patch)
tree6ae5a650cfd185d6c088394e53ed2ea3aa438668 /src/vnet/session/application_namespace.c
parent8aa0d786a97eda2761c334330d71328919d4c674 (diff)
session: instantiate appns lookup table only once
Change-Id: I39d634b7691a524e5221c28997a737102298c281 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_namespace.c')
-rw-r--r--src/vnet/session/application_namespace.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c
index a8275515aa0..f66dc27ee4e 100644
--- a/src/vnet/session/application_namespace.c
+++ b/src/vnet/session/application_namespace.c
@@ -89,15 +89,16 @@ vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t * a)
return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
"sw_if_index or fib_id must be "
"configured");
- st = session_table_alloc ();
- session_table_init (st);
-
app_ns = app_namespace_get_from_id (a->ns_id);
if (!app_ns)
- app_ns = app_namespace_alloc (a->ns_id);
+ {
+ app_ns = app_namespace_alloc (a->ns_id);
+ st = session_table_alloc ();
+ session_table_init (st);
+ app_ns->local_table_index = session_table_index (st);
+ }
app_ns->ns_secret = a->secret;
app_ns->sw_if_index = a->sw_if_index;
- app_ns->local_table_index = session_table_index (st);
app_ns->ip4_fib_index =
fib_table_find (FIB_PROTOCOL_IP4, a->ip4_fib_id);
app_ns->ip6_fib_index =
@@ -140,8 +141,10 @@ void
app_namespaces_init (void)
{
u8 *ns_id = format (0, "default");
- app_namespace_lookup_table =
- hash_create_vec (0, sizeof (u8), sizeof (uword));
+
+ if (!app_namespace_lookup_table)
+ app_namespace_lookup_table =
+ hash_create_vec (0, sizeof (u8), sizeof (uword));
/*
* Allocate default namespace