22 int verbose = va_arg (*args,
int);
23 session_event_t _e, *e = &_e;
26 if (!ss->server_rx_fifo || !ss->server_tx_fifo)
31 if (verbose > 2 && ss->server_rx_fifo->has_event)
34 s =
format (s,
" session node event: %s\n",
35 found ?
"found" :
"not found");
39 if (verbose > 2 && ss->server_tx_fifo->has_event)
42 s =
format (s,
" session node event: %s\n",
43 found ?
"found" :
"not found");
60 int verbose = va_arg (*args,
int);
65 str =
format (0,
"%-10u%-10u",
72 ss->connection_index, ss->thread_index, verbose);
81 tp, ss->connection_index, str);
88 tp, ss->connection_index, str);
92 clib_warning (
"Session in state: %d!", ss->session_state);
102 u8 *proto = va_arg (*args,
u8 *);
103 u32 *fib_index = va_arg (*args,
u32 *);
104 ip46_address_t *lcl = va_arg (*args, ip46_address_t *);
105 ip46_address_t *rmt = va_arg (*args, ip46_address_t *);
106 u16 *lcl_port = va_arg (*args,
u16 *);
107 u16 *rmt_port = va_arg (*args,
u16 *);
108 u8 *is_ip4 = va_arg (*args,
u8 *);
126 if (
unformat (input,
"vrf %u", &vrf))
156 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
157 ip46_address_t lcl, rmt;
163 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
168 clib_host_to_net_u16 (lcl_port),
169 clib_host_to_net_u16 (rmt_port), proto);
172 clib_host_to_net_u16 (lcl_port),
173 clib_host_to_net_u16 (rmt_port), proto);
187 u32 suggested_proto = va_arg (*args,
u32);
190 ip46_address_t lcl, rmt;
191 u32 lcl_port = 0, rmt_port = 0, fib_index = 0;
195 &lcl, &rmt, &lcl_port, &rmt_port, &is_ip4))
198 proto = (proto == (
u8) ~ 0) ? suggested_proto : proto;
199 if (proto == (
u8) ~ 0)
203 clib_host_to_net_u16 (lcl_port),
204 clib_host_to_net_u16 (rmt_port), proto);
207 clib_host_to_net_u16 (lcl_port),
208 clib_host_to_net_u16 (rmt_port), proto);
222 u8 *str = 0, one_session = 0, do_listeners = 0, sst, do_elog = 0;
224 u32 transport_proto = ~0, track_index;
238 if (
unformat (input,
"verbose %d", &verbose))
240 else if (
unformat (input,
"verbose"))
268 if (track_index != ~0)
282 if (s->session_state != SESSION_STATE_LISTENING
283 || s->session_type != sst)
285 app_wrk = app_worker_get (s->app_wrk_index);
286 app_name = application_name_from_index (app_wrk->app_index);
287 vlib_cli_output (vm,
"%U%-25v%", format_stream_session, s, 1,
308 if (once_per_pool && verbose == 1)
310 str =
format (str,
"%-50s%-15s%-10s%-10s",
311 "Connection",
"State",
"Rx-f",
"Tx-f");
339 .path =
"show session",
340 .short_help =
"show session [verbose [nnn]]",
350 server->
cb_fns.session_disconnect_callback (s);
359 u32 thread_index = 0, clear_all = 0;
361 u32 session_index = ~0;
371 if (
unformat (input,
"thread %d", &thread_index))
373 else if (
unformat (input,
"session %d", &session_index))
382 if (!clear_all && session_index == ~0)
385 if (session_index != ~0)
390 session_index, thread_index);
400 clear_session (session);
412 .path =
"clear session",
413 .short_help =
"clear session thread <thread> session <index>",
424 u8 is_rx = 0, *str = 0;
462 .path =
"show session fifo trace",
463 .short_help =
"show session fifo trace <session>",
473 u8 is_rx = 0, *str = 0;
509 .path =
"session replay fifo",
510 .short_help =
"session replay fifo <session>",
528 if (
unformat (line_input,
"enable"))
530 else if (
unformat (line_input,
"disable"))
549 .short_help =
"session [enable|disable]",
app_worker_t * app_worker_get(u32 wrk_index)
u8 * format_transport_connection(u8 *s, va_list *args)
u8 * format_session_fifos(u8 *s, va_list *args)
struct _transport_connection transport_connection_t
format_function_t format_svm_fifo
elog_time_stamp_t init_time
Timestamps.
session_manager_main_t session_manager_main
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static clib_error_t * clear_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
transport_connection_t * session_get_transport(stream_session_t *s)
static void session_pool_remove_peeker(u32 thread_index)
u8 is_enabled
Session manager is enabled.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
transport_connection_t * session_lookup_connection6(u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup connection with ip6 and transport layer information.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
#define clib_error_return(e, args...)
static clib_error_t * show_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
struct _stream_session_t stream_session_t
u8 * format_stream_session(u8 *s, va_list *args)
Format stream session as per the following format.
stream_session_t * sessions
Worker session pool.
transport_connection_t * session_lookup_connection4(u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup connection with ip4 and transport layer information.
static transport_proto_t session_get_transport_proto(stream_session_t *s)
stream_session_t * session_lookup_safe6(u32 fib_index, ip6_address_t *lcl, ip6_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip6 and transport layer information.
uword unformat_transport_connection(unformat_input_t *input, va_list *args)
static u32 transport_elog_track_index(transport_connection_t *tc)
static stream_session_t * session_get_if_valid(u64 si, u32 thread_index)
u8 * svm_fifo_replay(u8 *s, svm_fifo_t *f, u8 no_read, u8 verbose)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
uword unformat_stream_session_id(unformat_input_t *input, va_list *args)
static int clear_session(stream_session_t *s)
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
uword unformat_stream_session(unformat_input_t *input, va_list *args)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
stream_session_t * session_lookup_safe4(u32 fib_index, ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto)
Lookup session with ip4 and transport layer information.
application_t * application_get(u32 app_index)
#define VLIB_CLI_COMMAND(x,...)
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
u64 cpu
CPU cycle counter.
session_cb_vft_t cb_fns
Callbacks: shoulder-taps for the server/client.
u8 * format_transport_half_open_connection(u8 *s, va_list *args)
u8 * svm_fifo_dump_trace(u8 *s, svm_fifo_t *f)
session_manager_worker_t * wrk
Worker contexts.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u8 * format_elog_track(u8 *s, va_list *args)
u8 * format_transport_listen_connection(u8 *s, va_list *args)
static clib_error_t * session_replay_fifo_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * show_session_fifo_trace_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 app_index
Index of owning app.
#define vec_foreach(var, vec)
Vector iterator.
u8 session_node_lookup_fifo_event(svm_fifo_t *f, session_event_t *e)
static clib_error_t * session_enable_disable_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword pool_elts(void *v)
Number of active elements in a pool.