int verbose = va_arg (*args, int);
transport_proto_vft_t *tp_vft;
u8 *str = 0;
- tp_vft = transport_protocol_get_vft (ss->session_type);
+ tp_vft = transport_protocol_get_vft (session_get_transport_proto (ss));
if (verbose == 1 && ss->session_state >= SESSION_STATE_ACCEPTING)
str = format (0, "%-10u%-10u%-10lld",
vlib_cli_command_t * cmd)
{
session_manager_main_t *smm = &session_manager_main;
+ u8 *str = 0, one_session = 0, do_listeners = 0, sst, *app_name;
int verbose = 0, i;
- stream_session_t *pool;
- stream_session_t *s;
- u8 *str = 0, one_session = 0;
+ stream_session_t *pool, *s;
+ u32 transport_proto = ~0;
if (!smm->is_enabled)
{
;
else if (unformat (input, "verbose"))
verbose = 1;
+ else if (unformat (input, "listeners %U", unformat_transport_proto,
+ &transport_proto))
+ do_listeners = 1;
else if (unformat (input, "%U", unformat_stream_session, &s))
{
one_session = 1;
return 0;
}
+ if (do_listeners)
+ {
+ sst = session_type_from_proto_and_ip (transport_proto, 1);
+ vlib_cli_output (vm, "There are %d active %U listeners",
+ pool_elts (smm->listen_sessions[sst]),
+ format_transport_proto, transport_proto);
+ if (verbose)
+ {
+ vlib_cli_output (vm, "%-40s%-24s%-10s", "Listener", "App", "S-idx");
+ /* *INDENT-OFF* */
+ pool_foreach (s, smm->listen_sessions[sst], ({
+ app_name = application_name_from_index (s->app_index);
+ vlib_cli_output (vm, "%U%-25v%-10u", format_stream_session, s, 1,
+ app_name, s->session_index);
+ vec_free (app_name);
+ }));
+ /* *INDENT-ON* */
+ }
+ return 0;
+ }
+
for (i = 0; i < vec_len (smm->sessions); i++)
{
u32 once_per_pool;
session_enable_disable_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
+ unformat_input_t _line_input, *line_input = &_line_input;
u8 is_en = 1;
+ clib_error_t *error;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return clib_error_return (0, "expected enable | disable");
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (input, "enable"))
+ if (unformat (line_input, "enable"))
is_en = 1;
- else if (unformat (input, "disable"))
+ else if (unformat (line_input, "disable"))
is_en = 0;
else
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
+ {
+ error = clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, line_input);
+ unformat_free (line_input);
+ return error;
+ }
}
+ unformat_free (line_input);
return vnet_session_enable_disable (vm, is_en);
}