diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2023-06-28 10:47:32 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-07-26 01:09:17 +0000 |
commit | 0028e6f31624246e831b5b1a13dc46ab1d864fa7 (patch) | |
tree | 5e20818e09e5eb269a785770b1166d7ead129eec /src/vnet/session | |
parent | cc8249c5fde1b00b043066617d35325dd1606cd6 (diff) |
session: use session error type instead of vnet error
Type: improvement
Change-Id: Ie0bad9e03ac2e29da23af01ee7f63cb44489ad9c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/application.c | 68 | ||||
-rw-r--r-- | src/vnet/session/application.h | 5 | ||||
-rw-r--r-- | src/vnet/session/application_interface.c | 22 | ||||
-rw-r--r-- | src/vnet/session/application_interface.h | 24 | ||||
-rw-r--r-- | src/vnet/session/application_namespace.c | 15 | ||||
-rw-r--r-- | src/vnet/session/application_namespace.h | 3 | ||||
-rw-r--r-- | src/vnet/session/application_worker.c | 5 | ||||
-rw-r--r-- | src/vnet/session/session_api.c | 31 | ||||
-rw-r--r-- | src/vnet/session/session_lookup.c | 10 | ||||
-rw-r--r-- | src/vnet/session/session_lookup.h | 2 | ||||
-rw-r--r-- | src/vnet/session/session_rules_table.c | 12 | ||||
-rw-r--r-- | src/vnet/session/session_rules_table.h | 6 | ||||
-rw-r--r-- | src/vnet/session/session_types.h | 4 |
13 files changed, 116 insertions, 91 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 59989214231..cf867401ea2 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -765,8 +765,8 @@ application_verify_cfg (ssvm_segment_type_t st) return 1; } -static int -application_alloc_and_init (app_init_args_t * a) +static session_error_t +application_alloc_and_init (app_init_args_t *a) { ssvm_segment_type_t seg_type = SSVM_SEGMENT_MEMFD; segment_manager_props_t *props; @@ -787,15 +787,15 @@ application_alloc_and_init (app_init_args_t * a) { clib_warning ("mq eventfds can only be used if socket transport is " "used for binary api"); - return VNET_API_ERROR_APP_UNSUPPORTED_CFG; + return SESSION_E_NOSUPPORT; } if (!application_verify_cfg (seg_type)) - return VNET_API_ERROR_APP_UNSUPPORTED_CFG; + return SESSION_E_NOSUPPORT; if (opts[APP_OPTIONS_PREALLOC_FIFO_PAIRS] && opts[APP_OPTIONS_PREALLOC_FIFO_HDRS]) - return VNET_API_ERROR_APP_UNSUPPORTED_CFG; + return SESSION_E_NOSUPPORT; /* Check that the obvious things are properly set up */ application_verify_cb_fns (a->session_cb_vft); @@ -1048,8 +1048,8 @@ application_alloc_worker_and_init (application_t * app, app_worker_t ** wrk) return 0; } -int -vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a) +session_error_t +vnet_app_worker_add_del (vnet_app_worker_add_del_args_t *a) { fifo_segment_t *fs; app_worker_map_t *wrk_map; @@ -1060,7 +1060,7 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a) app = application_get (a->app_index); if (!app) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; if (a->is_add) { @@ -1083,11 +1083,11 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a) { wrk_map = app_worker_map_get (app, a->wrk_map_index); if (!wrk_map) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; app_wrk = app_worker_get (wrk_map->wrk_index); if (!app_wrk) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; application_api_table_del (app_wrk->api_client_index); if (appns_sapi_enabled ()) @@ -1100,8 +1100,8 @@ vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a) return 0; } -static int -app_validate_namespace (u8 * namespace_id, u64 secret, u32 * app_ns_index) +static session_error_t +app_validate_namespace (u8 *namespace_id, u64 secret, u32 *app_ns_index) { app_namespace_t *app_ns; if (vec_len (namespace_id) == 0) @@ -1113,12 +1113,12 @@ app_validate_namespace (u8 * namespace_id, u64 secret, u32 * app_ns_index) *app_ns_index = app_namespace_index_from_id (namespace_id); if (*app_ns_index == APP_NAMESPACE_INVALID_INDEX) - return VNET_API_ERROR_APP_INVALID_NS; + return SESSION_E_INVALID_NS; app_ns = app_namespace_get (*app_ns_index); if (!app_ns) - return VNET_API_ERROR_APP_INVALID_NS; + return SESSION_E_INVALID_NS; if (app_ns->ns_secret != secret) - return VNET_API_ERROR_APP_WRONG_NS_SECRET; + return SESSION_E_WRONG_NS_SECRET; return 0; } @@ -1142,8 +1142,8 @@ app_name_from_api_index (u32 api_client_index) * to external app and a segment manager for shared memory fifo based * communication with the external app. */ -int -vnet_application_attach (vnet_app_attach_args_t * a) +session_error_t +vnet_application_attach (vnet_app_attach_args_t *a) { fifo_segment_t *fs; application_t *app = 0; @@ -1152,17 +1152,17 @@ vnet_application_attach (vnet_app_attach_args_t * a) u32 app_ns_index = 0; u8 *app_name = 0; u64 secret; - int rv; + session_error_t rv; 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 VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; if (app) - return VNET_API_ERROR_APP_ALREADY_ATTACHED; + return SESSION_E_APP_ATTACHED; /* Socket api sets the name and validates namespace prior to attach */ if (!a->use_sock_api) @@ -1216,8 +1216,8 @@ vnet_application_attach (vnet_app_attach_args_t * a) /** * Detach application from vpp */ -int -vnet_application_detach (vnet_app_detach_args_t * a) +session_error_t +vnet_application_detach (vnet_app_detach_args_t *a) { application_t *app; @@ -1225,7 +1225,7 @@ vnet_application_detach (vnet_app_detach_args_t * a) if (!app) { clib_warning ("app not attached"); - return VNET_API_ERROR_APPLICATION_NOT_ATTACHED; + return SESSION_E_NOAPP; } app_interface_check_thread_and_barrier (vnet_application_detach, a); @@ -1299,8 +1299,8 @@ session_endpoint_update_for_app (session_endpoint_cfg_t * sep, } } -int -vnet_listen (vnet_listen_args_t * a) +session_error_t +vnet_listen (vnet_listen_args_t *a) { app_listener_t *app_listener; app_worker_t *app_wrk; @@ -1353,8 +1353,8 @@ vnet_listen (vnet_listen_args_t * a) return 0; } -int -vnet_connect (vnet_connect_args_t * a) +session_error_t +vnet_connect (vnet_connect_args_t *a) { app_worker_t *client_wrk; application_t *client; @@ -1377,7 +1377,7 @@ vnet_connect (vnet_connect_args_t * a) */ if (application_has_local_scope (client)) { - int rv; + session_error_t rv; a->sep_ext.original_tp = a->sep_ext.transport_proto; a->sep_ext.transport_proto = TRANSPORT_PROTO_NONE; @@ -1392,8 +1392,8 @@ vnet_connect (vnet_connect_args_t * a) return app_worker_connect_session (client_wrk, &a->sep_ext, &a->sh); } -int -vnet_unlisten (vnet_unlisten_args_t * a) +session_error_t +vnet_unlisten (vnet_unlisten_args_t *a) { app_worker_t *app_wrk; app_listener_t *al; @@ -1423,7 +1423,7 @@ vnet_unlisten (vnet_unlisten_args_t * a) return app_worker_stop_listen (app_wrk, al); } -int +session_error_t vnet_shutdown_session (vnet_shutdown_args_t *a) { app_worker_t *app_wrk; @@ -1444,8 +1444,8 @@ vnet_shutdown_session (vnet_shutdown_args_t *a) return 0; } -int -vnet_disconnect_session (vnet_disconnect_args_t * a) +session_error_t +vnet_disconnect_session (vnet_disconnect_args_t *a) { app_worker_t *app_wrk; session_t *s; @@ -2082,7 +2082,7 @@ vnet_app_del_cert_key_pair (u32 index) u32 *app_index; if (!(ckpair = app_cert_key_pair_get_if_valid (index))) - return (VNET_API_ERROR_INVALID_VALUE); + return SESSION_E_INVALID; vec_foreach (app_index, ckpair->app_interests) { diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h index e100fe89e63..c3d6180022f 100644 --- a/src/vnet/session/application.h +++ b/src/vnet/session/application.h @@ -327,7 +327,8 @@ int app_worker_own_session (app_worker_t * app_wrk, session_t * s); void app_worker_free (app_worker_t * app_wrk); int app_worker_connect_session (app_worker_t *app, session_endpoint_cfg_t *sep, session_handle_t *rsh); -int app_worker_start_listen (app_worker_t * app_wrk, app_listener_t * lstnr); +session_error_t app_worker_start_listen (app_worker_t *app_wrk, + app_listener_t *lstnr); int app_worker_stop_listen (app_worker_t * app_wrk, app_listener_t * al); int app_worker_init_accepted (session_t * s); int app_worker_accept_notify (app_worker_t * app_wrk, session_t * s); @@ -374,7 +375,7 @@ u8 *format_app_worker_listener (u8 * s, va_list * args); u8 *format_crypto_engine (u8 * s, va_list * args); u8 *format_crypto_context (u8 * s, va_list * args); void app_worker_format_connects (app_worker_t * app_wrk, int verbose); -int vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a); +session_error_t vnet_app_worker_add_del (vnet_app_worker_add_del_args_t *a); uword unformat_application_proto (unformat_input_t * input, va_list * args); diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c index 74f456a1eab..86f3dcdece6 100644 --- a/src/vnet/session/application_interface.c +++ b/src/vnet/session/application_interface.c @@ -73,8 +73,8 @@ unformat_vnet_uri (unformat_input_t * input, va_list * args) static u8 *cache_uri; static session_endpoint_cfg_t *cache_sep; -int -parse_uri (char *uri, session_endpoint_cfg_t * sep) +session_error_t +parse_uri (char *uri, session_endpoint_cfg_t *sep) { unformat_input_t _input, *input = &_input; @@ -92,7 +92,7 @@ parse_uri (char *uri, session_endpoint_cfg_t * sep) if (!unformat (input, "%U", unformat_vnet_uri, sep)) { unformat_free (input); - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; } unformat_free (input); @@ -120,36 +120,36 @@ vnet_bind_uri (vnet_listen_args_t * a) return vnet_listen (a); } -int -vnet_unbind_uri (vnet_unlisten_args_t * a) +session_error_t +vnet_unbind_uri (vnet_unlisten_args_t *a) { session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL; application_t *app; session_t *listener; u32 table_index; - int rv; + session_error_t rv; if ((rv = parse_uri (a->uri, &sep))) return rv; app = application_get (a->app_index); if (!app) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; table_index = application_session_table (app, fib_ip_proto (!sep.is_ip4)); listener = session_lookup_listener (table_index, (session_endpoint_t *) & sep); if (!listener) - return VNET_API_ERROR_ADDRESS_NOT_IN_USE; + return SESSION_E_ADDR_NOT_IN_USE; a->handle = listen_session_get_handle (listener); return vnet_unlisten (a); } -int -vnet_connect_uri (vnet_connect_args_t * a) +session_error_t +vnet_connect_uri (vnet_connect_args_t *a) { session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL; - int rv; + session_error_t rv; if ((rv = parse_uri (a->uri, &sep))) return rv; diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 510068b7769..d76b9f7fd8b 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -271,18 +271,18 @@ typedef enum session_fd_flag_ #undef _ } session_fd_flag_t; -int parse_uri (char *uri, session_endpoint_cfg_t * sep); -int vnet_bind_uri (vnet_listen_args_t *); -int vnet_unbind_uri (vnet_unlisten_args_t * a); -int vnet_connect_uri (vnet_connect_args_t * a); - -int vnet_application_attach (vnet_app_attach_args_t * a); -int vnet_application_detach (vnet_app_detach_args_t * a); -int vnet_listen (vnet_listen_args_t * a); -int vnet_connect (vnet_connect_args_t * a); -int vnet_unlisten (vnet_unlisten_args_t * a); -int vnet_shutdown_session (vnet_shutdown_args_t *a); -int vnet_disconnect_session (vnet_disconnect_args_t * a); +session_error_t parse_uri (char *uri, session_endpoint_cfg_t *sep); +session_error_t vnet_bind_uri (vnet_listen_args_t *); +session_error_t vnet_unbind_uri (vnet_unlisten_args_t *a); +session_error_t vnet_connect_uri (vnet_connect_args_t *a); + +session_error_t vnet_application_attach (vnet_app_attach_args_t *a); +session_error_t vnet_application_detach (vnet_app_detach_args_t *a); +session_error_t vnet_listen (vnet_listen_args_t *a); +session_error_t vnet_connect (vnet_connect_args_t *a); +session_error_t vnet_unlisten (vnet_unlisten_args_t *a); +session_error_t vnet_shutdown_session (vnet_shutdown_args_t *a); +session_error_t vnet_disconnect_session (vnet_disconnect_args_t *a); int vnet_app_add_cert_key_pair (vnet_app_add_cert_key_pair_args_t * a); int vnet_app_del_cert_key_pair (u32 index); diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c index 13b540cd3b8..03e41fdb22d 100644 --- a/src/vnet/session/application_namespace.c +++ b/src/vnet/session/application_namespace.c @@ -81,21 +81,20 @@ app_namespace_alloc (const u8 *ns_id) return app_ns; } -int -vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t * a) +session_error_t +vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t *a) { app_namespace_t *app_ns; session_table_t *st; u32 ns_index; - int rv; + session_error_t rv; if (a->is_add) { if (a->sw_if_index != APP_NAMESPACE_INVALID_INDEX && !vnet_get_sw_interface_or_null (vnet_get_main (), a->sw_if_index)) - return VNET_API_ERROR_INVALID_SW_IF_INDEX; - + return SESSION_E_INVALID; if (a->sw_if_index != APP_NAMESPACE_INVALID_INDEX) { @@ -108,7 +107,7 @@ vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t * a) } if (a->sw_if_index == APP_NAMESPACE_INVALID_INDEX && a->ip4_fib_id == APP_NAMESPACE_INVALID_INDEX) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; app_ns = app_namespace_get_from_id (a->ns_id); if (!app_ns) @@ -148,11 +147,11 @@ vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t * a) { ns_index = app_namespace_index_from_id (a->ns_id); if (ns_index == APP_NAMESPACE_INVALID_INDEX) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; app_ns = app_namespace_get (ns_index); if (!app_ns) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; application_namespace_cleanup (app_ns); diff --git a/src/vnet/session/application_namespace.h b/src/vnet/session/application_namespace.h index 02a4a0780d4..261325cbe0e 100644 --- a/src/vnet/session/application_namespace.h +++ b/src/vnet/session/application_namespace.h @@ -82,7 +82,8 @@ const u8 *app_namespace_id (app_namespace_t * app_ns); const u8 *app_namespace_id_from_index (u32 index); u32 app_namespace_index_from_id (const u8 *ns_id); void app_namespaces_init (void); -int vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t * a); +session_error_t +vnet_app_namespace_add_del (vnet_app_namespace_add_del_args_t *a); u32 app_namespace_get_fib_index (app_namespace_t * app_ns, u8 fib_proto); session_table_t *app_namespace_get_local_table (app_namespace_t * app_ns); diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c index 1927f2f78d3..c3941d1fd7b 100644 --- a/src/vnet/session/application_worker.c +++ b/src/vnet/session/application_worker.c @@ -202,9 +202,8 @@ app_worker_init_listener (app_worker_t * app_wrk, session_t * ls) return 0; } -int -app_worker_start_listen (app_worker_t * app_wrk, - app_listener_t * app_listener) +session_error_t +app_worker_start_listen (app_worker_t *app_wrk, app_listener_t *app_listener) { session_t *ls; int rv; diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 3d70733ceb2..ff11bcb690a 100644 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -534,7 +534,8 @@ vl_api_app_attach_t_handler (vl_api_app_attach_t * mp) if ((rv = vnet_application_attach (a))) { - clib_warning ("attach returned: %d", rv); + clib_warning ("attach returned: %U", format_session_error, rv); + rv = VNET_API_ERROR_UNSPECIFIED; vec_free (a->namespace_id); goto done; } @@ -641,7 +642,9 @@ vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp) rv = vnet_app_worker_add_del (&args); if (rv) { - clib_warning ("app worker add/del returned: %d", rv); + clib_warning ("app worker add/del returned: %U", format_session_error, + rv); + rv = VNET_API_ERROR_UNSPECIFIED; goto done; } @@ -709,6 +712,12 @@ vl_api_application_detach_t_handler (vl_api_application_detach_t * mp) a->app_index = app->app_index; a->api_client_index = mp->client_index; rv = vnet_application_detach (a); + if (rv) + { + clib_warning ("vnet_application_detach: %U", format_session_error, + rv); + rv = VNET_API_ERROR_UNSPECIFIED; + } } done: @@ -934,7 +943,10 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) rv = vnet_session_rule_add_del (&args); if (rv) - clib_warning ("rule add del returned: %d", rv); + { + clib_warning ("rule add del returned: %U", format_session_error, rv); + rv = VNET_API_ERROR_UNSPECIFIED; + } vec_free (table_args->tag); REPLY_MACRO (VL_API_SESSION_RULE_ADD_DEL_REPLY); } @@ -1149,6 +1161,12 @@ vl_api_app_del_cert_key_pair_t_handler (vl_api_app_del_cert_key_pair_t * mp) } ckpair_index = clib_net_to_host_u32 (mp->index); rv = vnet_app_del_cert_key_pair (ckpair_index); + if (rv) + { + clib_warning ("vnet_app_del_cert_key_pair: %U", format_session_error, + rv); + rv = VNET_API_ERROR_UNSPECIFIED; + } done: REPLY_MACRO (VL_API_APP_DEL_CERT_KEY_PAIR_REPLY); @@ -1367,7 +1385,7 @@ sapi_add_del_worker_handler (app_namespace_t * app_ns, app = application_get_if_valid (mp->app_index); if (!app) { - rv = VNET_API_ERROR_INVALID_VALUE; + rv = SESSION_E_INVALID; goto done; } @@ -1382,7 +1400,8 @@ sapi_add_del_worker_handler (app_namespace_t * app_ns, rv = vnet_app_worker_add_del (&args); if (rv) { - clib_warning ("app worker add/del returned: %d", rv); + clib_warning ("app worker add/del returned: %U", format_session_error, + rv); goto done; } @@ -1730,7 +1749,7 @@ appns_sapi_add_ns_socket (app_namespace_t * app_ns) if (err) { clib_error_report (err); - return VNET_API_ERROR_SYSCALL_ERROR_1; + return SESSION_E_SYSCALL; } } diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c index 68f98d0f046..a8845996a08 100644 --- a/src/vnet/session/session_lookup.c +++ b/src/vnet/session/session_lookup.c @@ -1311,8 +1311,8 @@ session_lookup_connection (u32 fib_index, ip46_address_t * lcl, lcl_port, rmt_port, proto); } -int -vnet_session_rule_add_del (session_rule_add_del_args_t * args) +session_error_t +vnet_session_rule_add_del (session_rule_add_del_args_t *args) { app_namespace_t *app_ns = app_namespace_get (args->appns_index); session_rules_table_t *srt; @@ -1322,14 +1322,14 @@ vnet_session_rule_add_del (session_rule_add_del_args_t * args) int rv = 0; if (!app_ns) - return VNET_API_ERROR_APP_INVALID_NS; + return SESSION_E_INVALID_NS; if (args->scope > 3) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; if (args->transport_proto != TRANSPORT_PROTO_TCP && args->transport_proto != TRANSPORT_PROTO_UDP) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; if ((args->scope & SESSION_RULE_SCOPE_GLOBAL) || args->scope == 0) { diff --git a/src/vnet/session/session_lookup.h b/src/vnet/session/session_lookup.h index c1037dff8c9..86148d1830a 100644 --- a/src/vnet/session/session_lookup.h +++ b/src/vnet/session/session_lookup.h @@ -130,7 +130,7 @@ typedef struct _session_rule_add_del_args u8 transport_proto; } session_rule_add_del_args_t; -int vnet_session_rule_add_del (session_rule_add_del_args_t * args); +session_error_t vnet_session_rule_add_del (session_rule_add_del_args_t *args); void session_lookup_set_tables_appns (app_namespace_t * app_ns); void session_lookup_init (void); diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c index 5108c00d728..9b90c2cd9ff 100644 --- a/src/vnet/session/session_rules_table.c +++ b/src/vnet/session/session_rules_table.c @@ -386,11 +386,11 @@ session_rules_table_lookup6 (session_rules_table_t * srt, * @param srt table where rule should be added * @param args rule arguments * - * @return 0 if success, clib_error_t error otherwise + * @return 0 if success, session_error_t error otherwise */ -int -session_rules_table_add_del (session_rules_table_t * srt, - session_rule_table_add_del_args_t * args) +session_error_t +session_rules_table_add_del (session_rules_table_t *srt, + session_rule_table_add_del_args_t *args) { u8 fib_proto = args->rmt.fp_proto, *rt; u32 ri_from_tag, ri; @@ -398,7 +398,7 @@ session_rules_table_add_del (session_rules_table_t * srt, ri_from_tag = session_rules_table_rule_for_tag (srt, args->tag); if (args->is_add && ri_from_tag != SESSION_RULES_TABLE_INVALID_INDEX) - return VNET_API_ERROR_INVALID_VALUE; + return SESSION_E_INVALID; if (fib_proto == FIB_PROTOCOL_IP4) { @@ -509,7 +509,7 @@ session_rules_table_add_del (session_rules_table_t * srt, } } else - return VNET_API_ERROR_INVALID_VALUE_2; + return SESSION_E_INVALID; return 0; } diff --git a/src/vnet/session/session_rules_table.h b/src/vnet/session/session_rules_table.h index 206ef2f380f..d61f2c60ca9 100644 --- a/src/vnet/session/session_rules_table.h +++ b/src/vnet/session/session_rules_table.h @@ -18,6 +18,7 @@ #include <vnet/vnet.h> #include <vnet/fib/fib.h> +#include <vnet/session/session_types.h> #include <vnet/session/transport.h> #include <vnet/session/mma_16.h> #include <vnet/session/mma_40.h> @@ -111,8 +112,9 @@ void session_rules_table_show_rule (vlib_main_t * vm, ip46_address_t * lcl_ip, u16 lcl_port, ip46_address_t * rmt_ip, u16 rmt_port, u8 is_ip4); -int session_rules_table_add_del (session_rules_table_t * srt, - session_rule_table_add_del_args_t * args); +session_error_t +session_rules_table_add_del (session_rules_table_t *srt, + session_rule_table_add_del_args_t *args); u8 *session_rules_table_rule_tag (session_rules_table_t * srt, u32 ri, u8 is_ip4); void session_rules_table_init (session_rules_table_t * srt); diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h index 9ad40fcca7f..8755a146bce 100644 --- a/src/vnet/session/session_types.h +++ b/src/vnet/session/session_types.h @@ -484,9 +484,11 @@ STATIC_ASSERT (sizeof (session_dgram_hdr_t) == (SESSION_CONN_ID_LEN + 10), _ (NOLISTEN, "not listening") \ _ (NOSESSION, "session does not exist") \ _ (NOAPP, "app not attached") \ + _ (APP_ATTACHED, "app already attached") \ _ (PORTINUSE, "lcl port in use") \ _ (IPINUSE, "ip in use") \ _ (ALREADY_LISTENING, "ip port pair already listened on") \ + _ (ADDR_NOT_IN_USE, "address not in use") \ _ (INVALID, "invalid value") \ _ (INVALID_RMT_IP, "invalid remote ip") \ _ (INVALID_APPWRK, "invalid app worker") \ @@ -506,6 +508,8 @@ STATIC_ASSERT (sizeof (session_dgram_hdr_t) == (SESSION_CONN_ID_LEN + 10), _ (NOCRYPTOENG, "no crypto engine") \ _ (NOCRYPTOCKP, "cert key pair not found ") \ _ (LOCAL_CONNECT, "could not connect with local scope") \ + _ (WRONG_NS_SECRET, "wrong ns secret") \ + _ (SYSCALL, "system call error") \ _ (TRANSPORT_NO_REG, "transport was not registered") typedef enum session_error_p_ |