aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_interface.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-03-22 21:24:31 -0700
committerDave Barach <openvpp@barachs.net>2018-03-23 14:20:10 +0000
commit0bee9ce4af04322c56f7511f24bda4874e78a4b4 (patch)
treebbe65c79d108741d64321492f436c94b2ba68871 /src/vnet/session/application_interface.c
parentbeca26622983018255d87b8031e39e517e4e4242 (diff)
session: allow builtin apps to register names
Change-Id: I4b428e170436671b329657283cf7653befc85c9f 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.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index f069b28a5cc..ecdbe16e6a6 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -453,10 +453,17 @@ vnet_application_attach (vnet_app_attach_args_t * a)
u64 secret;
int rv;
- app = application_lookup (a->api_client_index);
+ if (a->api_client_index != APP_INVALID_INDEX)
+ app = application_lookup (a->api_client_index);
+ else if (a->name)
+ app = application_lookup_name (a->name);
+ else
+ return clib_error_return_code (0, VNET_API_ERROR_INVALID_VALUE, 0,
+ "api index or name must be provided");
+
if (app)
- return clib_error_return_code (0, VNET_API_ERROR_APP_ALREADY_ATTACHED,
- 0, "app already attached");
+ return clib_error_return_code (0, VNET_API_ERROR_APP_ALREADY_ATTACHED, 0,
+ "app already attached");
secret = a->options[APP_OPTIONS_NAMESPACE_SECRET];
if ((rv = session_validate_namespace (a->namespace_id, secret,
@@ -464,7 +471,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
return clib_error_return_code (0, rv, 0, "namespace validation: %d", rv);
a->options[APP_OPTIONS_NAMESPACE] = app_ns_index;
app = application_new ();
- if ((rv = application_init (app, a->api_client_index, a->options,
+ if ((rv = application_init (app, a->api_client_index, a->name, a->options,
a->session_cb_vft)))
return clib_error_return_code (0, rv, 0, "app init: %d", rv);