Skip to content

Commit

Permalink
session tcp: fix packet tracing
Browse files Browse the repository at this point in the history
Type: fix

Change-Id: Ib823d016c64998779fb1d00b8aad3acb5e8340be
Signed-off-by: Florin Coras <fcoras@cisco.com>
  • Loading branch information
florincoras authored and Dave Barach committed Jan 28, 2020
1 parent dda2dbe commit 30928f8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/vnet/session/session_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ format_session_queue_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
session_queue_trace_t *t = va_arg (*args, session_queue_trace_t *);

s = format (s, "SESSION_QUEUE: session index %d, server thread index %d",
s = format (s, "session index %d thread index %d",
t->session_index, t->server_thread_index);
return s;
}
Expand Down Expand Up @@ -543,7 +543,7 @@ session_tx_trace_frame (vlib_main_t * vm, vlib_node_runtime_t * node,

for (i = 0; i < clib_min (n_trace, n_segs); i++)
{
b = vlib_get_buffer (vm, to_next[i - n_segs]);
b = vlib_get_buffer (vm, to_next[i]);
vlib_trace_buffer (vm, node, next_index, b, 1 /* follow_chain */ );
t = vlib_add_trace (vm, node, b, sizeof (*t));
t->session_index = s->session_index;
Expand Down
2 changes: 1 addition & 1 deletion src/vnet/tcp/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ format_tcp_vars (u8 * s, va_list * args)
return s;
}

static u8 *
u8 *
format_tcp_connection_id (u8 * s, va_list * args)
{
tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
Expand Down
1 change: 1 addition & 0 deletions src/vnet/tcp/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ int tcp_configure_v6_source_address_range (vlib_main_t * vm,
ip6_address_t * end, u32 table_id);
void tcp_api_reference (void);
u8 *format_tcp_connection (u8 * s, va_list * args);
u8 *format_tcp_connection_id (u8 * s, va_list * args);

always_inline tcp_connection_t *
tcp_listener_get (u32 tli)
Expand Down
8 changes: 4 additions & 4 deletions src/vnet/tcp/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,12 +2029,12 @@ format_tcp_rx_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
tcp_rx_trace_t *t = va_arg (*args, tcp_rx_trace_t *);
tcp_connection_t *tc = &t->tcp_connection;
u32 indent = format_get_indent (s);

s = format (s, "%U\n%U%U",
format_tcp_header, &t->tcp_header, 128,
format_white_space, indent,
format_tcp_connection, &t->tcp_connection, 1);
s = format (s, "%U state %U\n%U%U", format_tcp_connection_id, tc,
format_tcp_state, tc->state, format_white_space, indent,
format_tcp_header, &t->tcp_header, 128);

return s;
}
Expand Down
13 changes: 7 additions & 6 deletions src/vnet/tcp/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ format_tcp_tx_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
tcp_tx_trace_t *t = va_arg (*args, tcp_tx_trace_t *);
tcp_connection_t *tc = &t->tcp_connection;
u32 indent = format_get_indent (s);

s = format (s, "%U\n%U%U",
format_tcp_header, &t->tcp_header, 128,
format_white_space, indent,
format_tcp_connection, &t->tcp_connection, 1);
s = format (s, "%U state %U\n%U%U", format_tcp_connection_id, tc,
format_tcp_state, tc->state, format_white_space, indent,
format_tcp_header, &t->tcp_header, 128);

return s;
}
Expand Down Expand Up @@ -2223,16 +2223,17 @@ static void
tcp46_output_trace_frame (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 * to_next, u32 n_bufs)
{
u32 n_trace = vlib_get_trace_count (vm, node);
tcp_connection_t *tc;
tcp_tx_trace_t *t;
vlib_buffer_t *b;
tcp_header_t *th;
int i;

for (i = 0; i < clib_min (n_trace, n_bufs); i++)
for (i = 0; i < n_bufs; i++)
{
b = vlib_get_buffer (vm, to_next[i]);
if (!(b->flags & VLIB_BUFFER_IS_TRACED))
continue;
th = vlib_buffer_get_current (b);
tc = tcp_connection_get (vnet_buffer (b)->tcp.connection_index,
vm->thread_index);
Expand Down

0 comments on commit 30928f8

Please sign in to comment.