X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fapplication.c;h=906a73e9d7929e96382a321ec360de32ee84e688;hb=a5a9efd4d;hp=c62496e1d5f46e61c26f709ac800cc99d56b69bb;hpb=a107f4039e74ea030ebd40e7a9920ac62855e3e0;p=vpp.git diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index c62496e1d5f..906a73e9d79 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -484,7 +484,6 @@ application_alloc_and_init (app_init_args_t * a) { ssvm_segment_type_t seg_type = SSVM_SEGMENT_MEMFD; segment_manager_props_t *props; - vl_api_registration_t *reg; application_t *app; u64 *options; @@ -494,17 +493,7 @@ application_alloc_and_init (app_init_args_t * a) * Make sure we support the requested configuration */ if (options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN) - { - seg_type = SSVM_SEGMENT_PRIVATE; - } - else if (!a->use_sock_api) - { - reg = vl_api_client_index_to_registration (a->api_client_index); - if (!reg) - return VNET_API_ERROR_APP_UNSUPPORTED_CFG; - if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI) - seg_type = SSVM_SEGMENT_SHM; - } + seg_type = SSVM_SEGMENT_PRIVATE; if ((options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD) && seg_type != SSVM_SEGMENT_MEMFD) @@ -633,11 +622,11 @@ application_detach_process (application_t * app, u32 api_client_index) app->app_index, api_client_index); /* *INDENT-OFF* */ - pool_foreach (wrk_map, app->worker_maps, ({ + pool_foreach (wrk_map, app->worker_maps) { app_wrk = app_worker_get (wrk_map->wrk_index); if (app_wrk->api_client_index == api_client_index) vec_add1 (wrks, app_wrk->wrk_index); - })); + } /* *INDENT-ON* */ if (!vec_len (wrks)) @@ -855,8 +844,8 @@ vnet_application_attach (vnet_app_attach_args_t * a) } secret = a->options[APP_OPTIONS_NAMESPACE_SECRET]; - if ((rv = - app_validate_namespace (a->namespace_id, secret, &app_ns_index))) + if ((rv = app_validate_namespace (a->namespace_id, secret, + &app_ns_index))) return rv; a->options[APP_OPTIONS_NAMESPACE] = app_ns_index; } @@ -1331,26 +1320,6 @@ application_get_segment_manager_properties (u32 app_index) return &app->sm_properties; } -clib_error_t * -vnet_app_add_tls_cert (vnet_app_add_tls_cert_args_t * a) -{ - /* Deprected, will be remove after 20.01 */ - app_cert_key_pair_t *ckpair; - ckpair = app_cert_key_pair_get_default (); - ckpair->cert = vec_dup (a->cert); - return 0; -} - -clib_error_t * -vnet_app_add_tls_key (vnet_app_add_tls_key_args_t * a) -{ - /* Deprected, will be remove after 20.01 */ - app_cert_key_pair_t *ckpair; - ckpair = app_cert_key_pair_get_default (); - ckpair->key = vec_dup (a->key); - return 0; -} - static void application_format_listeners (application_t * app, int verbose) { @@ -1368,7 +1337,7 @@ application_format_listeners (application_t * app, int verbose) } /* *INDENT-OFF* */ - pool_foreach (wrk_map, app->worker_maps, ({ + pool_foreach (wrk_map, app->worker_maps) { app_wrk = app_worker_get (wrk_map->wrk_index); if (hash_elts (app_wrk->listeners_table) == 0) continue; @@ -1376,7 +1345,7 @@ application_format_listeners (application_t * app, int verbose) vlib_cli_output (vm, "%U", format_app_worker_listener, app_wrk, handle, sm_index, verbose); })); - })); + } /* *INDENT-ON* */ } @@ -1393,10 +1362,10 @@ application_format_connects (application_t * app, int verbose) } /* *INDENT-OFF* */ - pool_foreach (wrk_map, app->worker_maps, ({ + pool_foreach (wrk_map, app->worker_maps) { app_wrk = app_worker_get (wrk_map->wrk_index); app_worker_format_connects (app_wrk, verbose); - })); + } /* *INDENT-ON* */ } @@ -1499,10 +1468,10 @@ format_application (u8 * s, va_list * args) format_memory_size, props->tx_fifo_size); /* *INDENT-OFF* */ - pool_foreach (wrk_map, app->worker_maps, ({ + pool_foreach (wrk_map, app->worker_maps) { app_wrk = app_worker_get (wrk_map->wrk_index); s = format (s, "%U", format_app_worker, app_wrk); - })); + } /* *INDENT-ON* */ return s; @@ -1522,9 +1491,9 @@ application_format_all_listeners (vlib_main_t * vm, int verbose) application_format_listeners (0, verbose); /* *INDENT-OFF* */ - pool_foreach (app, app_main.app_pool, ({ + pool_foreach (app, app_main.app_pool) { application_format_listeners (app, verbose); - })); + } /* *INDENT-ON* */ } @@ -1542,9 +1511,9 @@ application_format_all_clients (vlib_main_t * vm, int verbose) application_format_connects (0, verbose); /* *INDENT-OFF* */ - pool_foreach (app, app_main.app_pool, ({ + pool_foreach (app, app_main.app_pool) { application_format_connects (app, verbose); - })); + } /* *INDENT-ON* */ } @@ -1556,9 +1525,9 @@ show_certificate_command_fn (vlib_main_t * vm, unformat_input_t * input, session_cli_return_if_not_enabled (); /* *INDENT-OFF* */ - pool_foreach (ckpair, app_main.cert_key_pair_store, ({ + pool_foreach (ckpair, app_main.cert_key_pair_store) { vlib_cli_output (vm, "%U", format_cert_key_pair, ckpair); - })); + } /* *INDENT-ON* */ return 0; } @@ -1569,12 +1538,12 @@ appliction_format_app_mq (vlib_main_t * vm, application_t * app) app_worker_map_t *map; app_worker_t *wrk; /* *INDENT-OFF* */ - pool_foreach (map, app->worker_maps, ({ + pool_foreach (map, app->worker_maps) { wrk = app_worker_get (map->wrk_index); vlib_cli_output (vm, "[A%d][%d]%U", app->app_index, map->wrk_index, format_svm_msg_q, wrk->event_queue); - })); + } /* *INDENT-ON* */ } @@ -1593,9 +1562,9 @@ appliction_format_all_app_mq (vlib_main_t * vm) } /* *INDENT-OFF* */ - pool_foreach (app, app_main.app_pool, ({ + pool_foreach (app, app_main.app_pool) { appliction_format_app_mq (vm, app); - })); + } /* *INDENT-ON* */ return 0; } @@ -1671,9 +1640,9 @@ show_app_command_fn (vlib_main_t * vm, unformat_input_t * input, { vlib_cli_output (vm, "%U", format_application, 0, 0); /* *INDENT-OFF* */ - pool_foreach (app, app_main.app_pool, ({ + pool_foreach (app, app_main.app_pool) { vlib_cli_output (vm, "%U", format_application, app, 0); - })); + } /* *INDENT-ON* */ } @@ -1717,8 +1686,10 @@ int vnet_app_add_cert_key_pair (vnet_app_add_cert_key_pair_args_t * a) { app_cert_key_pair_t *ckpair = app_cert_key_pair_alloc (); - ckpair->cert = vec_dup (a->cert); - ckpair->key = vec_dup (a->key); + vec_validate (ckpair->cert, a->cert_len - 1); + clib_memcpy_fast (ckpair->cert, a->cert, a->cert_len); + vec_validate (ckpair->key, a->key_len - 1); + clib_memcpy_fast (ckpair->key, a->key, a->key_len); a->index = ckpair->cert_key_index; return 0; } @@ -1760,7 +1731,7 @@ vnet_app_del_cert_key_pair (u32 index) clib_error_t * application_init (vlib_main_t * vm) { - /* Add a certificate with index 0 to support legacy apis */ + /* Index 0 was originally used by legacy apis, maintain as invalid */ (void) app_cert_key_pair_alloc (); app_main.last_crypto_engine = CRYPTO_ENGINE_LAST; app_main.app_by_name = hash_create_vec (0, sizeof (u8), sizeof (uword));