Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The role of the VLIB_BUFFER_TRACE_ transaction macro

Shulou Source: shulou.com Published: 2022-06-01 05:21:42 10月04日 Update

You can record the number of node passed by mbuf and the index of node passed by mbuf in mbuf by enabling macro index:

If (VLIB_BUFFER_TRACE_TRAJECTORY & & frame)

{

Int i

Int log_index

U32 * from

From = vlib_frame_vector_args (frame)

For (I = 0; I)

< frame->

Nasty vectors; iSuppli +)

{

Vlib_buffer_t * b = vlib_get_buffer (vm, from [I])

ASSERT (b-> pre_data [0])

< 32); log_index = b->

Pre_data [0] + 1

B-> pre_ data [log _ index] = node- > node_index

}

N = node- > function (vm, node, frame)

}

Print the recorded node information with the following function

Void vlib_dump_context_trace (vlib_main_t*vm, U32 bi)

{

Vlib_node_main_t * vnm = & vm- > node_main

Vlib_buffer_t * b

U8 i, n

If (VLIB_BUFFER_TRACE_TRAJECTORY)

{

B = vlib_get_buffer (vm, bi)

N = b-> pre_data [0]

Fformat (stderr, "Context trace for bi% d b 0x%llx, visited%d\ n"

Bi, b, n)

If (n = = 0 | | n > 20)

{

Fformat (stderr, "n is unreasonable\ n")

Return

}

For (I = 0; I)

< n; i++) { u32 node_index; node_index = b->

Pre_ data [I + 1]

If (node_index > vec_len (vnm- > nodes))

{

Fformat (stderr, "Skip bogusnode index% d\ n", node_index)

Continue

}

Fformat (stderr, "% v (% d)\ n", vnm- > Nodes [node _ index]-> name

Node_index)

}

}

Else

{

Fformat (stderr

"in vlib/buffers.h,#define VLIB_BUFFER_TRACE_TRAJECTORY 1\ n")

}

}

Tags: Number information function can be passed used function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Shulou Tech Info Docker OPPO Reno