* that "supports" app's namespace. This will fix our local connection
* endpoint.
*/
- fib_index = sep->is_ip4 ? app_ns->ip4_fib_index : app_ns->ip6_fib_index;
+
+ /* If in default namespace and user requested a fib index use it */
+ if (ns_index == 0 && sep->fib_index != ENDPOINT_INVALID_INDEX)
+ fib_index = sep->fib_index;
+ else
+ fib_index = sep->is_ip4 ? app_ns->ip4_fib_index : app_ns->ip6_fib_index;
sep->peer.fib_index = fib_index;
sep->fib_index = fib_index;
return 0;
}
+static u8 *
+app_name_from_api_index (u32 api_client_index)
+{
+ vl_api_registration_t *regp;
+ regp = vl_api_client_index_to_registration (api_client_index);
+ if (regp)
+ return format (0, "%s%c", regp->name, 0);
+
+ clib_warning ("api client index %u does not have an api registration!",
+ api_client_index);
+ return format (0, "unknown%c", 0);
+}
+
/**
* Attach application to vpp
*
int rv;
if (a->api_client_index != APP_INVALID_INDEX)
- {
- app = application_lookup (a->api_client_index);
- if (!app)
- {
- vl_api_registration_t *regp;
- regp = vl_api_client_index_to_registration (a->api_client_index);
- app_name = format (0, "%s%c", regp->name, 0);
- a->name = app_name;
- }
- }
+ 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_APP_ALREADY_ATTACHED, 0,
"app already attached");
+ if (a->api_client_index != APP_INVALID_INDEX)
+ {
+ app_name = app_name_from_api_index (a->api_client_index);
+ a->name = app_name;
+ }
+
secret = a->options[APP_OPTIONS_NAMESPACE_SECRET];
if ((rv = app_validate_namespace (a->namespace_id, secret, &app_ns_index)))
return clib_error_return_code (0, rv, 0, "namespace validation: %d", rv);