X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvnet%2Fsession%2Fapplication_interface.c;h=c8fa37f0b9df2d3f5ba71b1c28af71daa0b45336;hb=f7f4e399e04774a6ca00b67006610f5b8f7a37c6;hp=f069b28a5cc0d8260f8c3c50817fe7252e73d5c1;hpb=e1b819efac7f8434f17d0482b631c2450e3dd5bb;p=vpp.git diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c index f069b28a5cc..c8fa37f0b9d 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); @@ -521,14 +528,18 @@ vnet_unbind_uri (vnet_unbind_args_t * a) { session_endpoint_extended_t sep = SESSION_ENDPOINT_EXT_NULL; stream_session_t *listener; + u32 table_index; int rv; rv = parse_uri (a->uri, &sep); if (rv) return rv; - /* NOTE: only default table supported for uri */ - listener = session_lookup_listener (0, (session_endpoint_t *) & sep); + /* NOTE: only default fib tables supported for uri apis */ + table_index = session_lookup_get_index_for_fib (fib_ip_proto (!sep.is_ip4), + 0); + listener = session_lookup_listener (table_index, + (session_endpoint_t *) & sep); if (!listener) return VNET_API_ERROR_ADDRESS_NOT_IN_USE; @@ -587,7 +598,7 @@ vnet_bind (vnet_bind_args_t * a) { int rv; if ((rv = vnet_bind_i (a->app_index, &a->sep, &a->handle))) - return clib_error_return_code (0, rv, 0, "bind failed"); + return clib_error_return_code (0, rv, 0, "bind failed: %d", rv); return 0; } @@ -596,7 +607,7 @@ vnet_unbind (vnet_unbind_args_t * a) { int rv; if ((rv = vnet_unbind_i (a->app_index, a->handle))) - return clib_error_return_code (0, rv, 0, "unbind failed"); + return clib_error_return_code (0, rv, 0, "unbind failed: %d", rv); return 0; } @@ -607,7 +618,7 @@ vnet_connect (vnet_connect_args_t * a) int rv; if ((rv = application_connect (a->app_index, a->api_context, sep))) - return clib_error_return_code (0, rv, 0, "connect failed"); + return clib_error_return_code (0, rv, 0, "connect failed: %d", rv); return 0; }