};
/* *INDENT-ON* */
-static u8 *
-format_ipv6_fragmentation (u8 * s, va_list * args)
-{
- ip6_frag_hdr_t *h = va_arg (*args, ip6_frag_hdr_t *);
- u32 max_header_bytes = va_arg (*args, u32);
- u32 header_bytes;
-
- header_bytes = sizeof (h[0]);
- if (max_header_bytes != 0 && header_bytes > max_header_bytes)
- return format (s, "ipv6 frag header truncated");
-
- s =
- format (s,
- "fragmentation header: next_hdr: %u, rsv: %u, frag_offset_and_more: %u, id: %u",
- h->next_hdr, h->rsv, h->fragment_offset_and_more,
- clib_net_to_host_u32 (h->identification));
- return s;
-}
-
static clib_error_t *
ip6_init (vlib_main_t * vm)
{
ip_protocol_info_t *info =
vec_elt_at_index (ip_main.protocol_infos, *u);
ASSERT (NULL == info->format_header);
- info->format_header = format_ipv6_fragmentation;
+ info->format_header = format_ip6_frag_hdr;
}
return /* no error */ 0;
}
u32 fragment_first;
u32 fragment_last;
u32 total_data_len;
+ bool is_after_handoff;
+ ip4_header_t ip4_header;
} ip4_full_reass_trace_t;
extern vlib_node_registration_t ip4_full_reass_node;
u32 indent = 0;
if (~0 != t->reass_id)
{
- s = format (s, "reass id: %u, op id: %u, ", t->reass_id, t->op_id);
+ if (t->is_after_handoff)
+ {
+ s =
+ format (s, "%U\n", format_ip4_header, &t->ip4_header,
+ sizeof (t->ip4_header));
+ indent = 2;
+ }
+ s =
+ format (s, "%Ureass id: %u, op id: %u, ", format_white_space, indent,
+ t->reass_id, t->op_id);
indent = format_get_indent (s);
s =
format (s,
{
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
vnet_buffer_opaque_t *vnb = vnet_buffer (b);
+ bool is_after_handoff = false;
+ if (vlib_buffer_get_trace_thread (b) != vm->thread_index)
+ {
+ is_after_handoff = true;
+ }
ip4_full_reass_trace_t *t = vlib_add_trace (vm, node, b, sizeof (t[0]));
+ t->is_after_handoff = is_after_handoff;
+ if (t->is_after_handoff)
+ {
+ clib_memcpy (&t->ip4_header, vlib_buffer_get_current (b),
+ clib_min (sizeof (t->ip4_header), b->current_length));
+ }
if (reass)
{
t->reass_id = reass->id;
u32 total_data_len;
u32 thread_id;
u32 thread_id_to;
+ bool is_after_handoff;
+ ip6_header_t ip6_header;
+ ip6_frag_hdr_t ip6_frag_header;
} ip6_full_reass_trace_t;
static void
u32 indent = 0;
if (~0 != t->reass_id)
{
- s = format (s, "reass id: %u, op id: %u ", t->reass_id, t->op_id);
+ if (t->is_after_handoff)
+ {
+ s =
+ format (s, "%U\n", format_ip6_header, &t->ip6_header,
+ sizeof (t->ip6_header));
+ s =
+ format (s, " %U\n", format_ip6_frag_hdr, &t->ip6_frag_header,
+ sizeof (t->ip6_frag_header));
+ indent = 2;
+ }
+ s =
+ format (s, "%Ureass id: %u, op id: %u, ", format_white_space, indent,
+ t->reass_id, t->op_id);
indent = format_get_indent (s);
s = format (s, "first bi: %u, data len: %u, ip/fragment[%u, %u]",
t->trace_range.first_bi, t->total_data_len,
ip6_full_reass_add_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_full_reass_main_t * rm,
ip6_full_reass_t * reass, u32 bi,
+ ip6_frag_hdr_t * ip6_frag_header,
ip6_full_reass_trace_operation_e action,
u32 thread_id_to)
{
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
vnet_buffer_opaque_t *vnb = vnet_buffer (b);
+ bool is_after_handoff = false;
+ if (vlib_buffer_get_trace_thread (b) != vm->thread_index)
+ {
+ is_after_handoff = true;
+ }
ip6_full_reass_trace_t *t = vlib_add_trace (vm, node, b, sizeof (t[0]));
+ t->is_after_handoff = is_after_handoff;
+ if (t->is_after_handoff)
+ {
+ clib_memcpy (&t->ip6_header, vlib_buffer_get_current (b),
+ clib_min (sizeof (t->ip6_header), b->current_length));
+ if (ip6_frag_header)
+ {
+ clib_memcpy (&t->ip6_frag_header, ip6_frag_header,
+ sizeof (t->ip6_frag_header));
+ }
+ else
+ {
+ clib_memset (&t->ip6_frag_header, 0, sizeof (t->ip6_frag_header));
+ }
+ }
if (reass)
{
t->reass_id = reass->id;
if (PREDICT_FALSE (b->flags & VLIB_BUFFER_IS_TRACED))
{
ip6_full_reass_add_trace (vm, node, rm, reass, reass->first_bi,
- ICMP_ERROR_RT_EXCEEDED, ~0);
+ NULL, ICMP_ERROR_RT_EXCEEDED, ~0);
}
// fragment with offset zero received - send icmp message back
if (b->flags & VLIB_BUFFER_NEXT_PRESENT)
first_b->flags &= ~VLIB_BUFFER_EXT_HDR_VALID;
if (PREDICT_FALSE (first_b->flags & VLIB_BUFFER_IS_TRACED))
{
- ip6_full_reass_add_trace (vm, node, rm, reass, reass->first_bi,
+ ip6_full_reass_add_trace (vm, node, rm, reass, reass->first_bi, NULL,
FINALIZE, ~0);
#if 0
// following code does a hexdump of packet fragments to stdout ...
// overlapping fragment - not allowed by RFC 8200
if (PREDICT_FALSE (fb->flags & VLIB_BUFFER_IS_TRACED))
{
- ip6_full_reass_add_trace (vm, node, rm, reass, *bi0,
+ ip6_full_reass_add_trace (vm, node, rm, reass, *bi0, frag_hdr,
RANGE_OVERLAP, ~0);
}
ip6_full_reass_drop_all (vm, node, rm, reass);
{
if (PREDICT_FALSE (fb->flags & VLIB_BUFFER_IS_TRACED))
{
- ip6_full_reass_add_trace (vm, node, rm, reass, *bi0, RANGE_NEW, ~0);
+ ip6_full_reass_add_trace (vm, node, rm, reass, *bi0, frag_hdr,
+ RANGE_NEW, ~0);
}
}
if (~0 != reass->last_packet_octet &&
if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
{
ip6_full_reass_add_trace (vm, node, rm, NULL, bi0,
- HANDOFF,
+ frag_hdr, HANDOFF,
vnet_buffer (b0)->ip.
reass.owner_thread_index);
}