Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The role of the VLIB_BUFFER_TRACE_ transaction macro

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

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")

}

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report