21 #define foreach_dhcp_client_detect \ 26 #define _(sym,str) DHCP_CLIENT_DETECT_ERROR_##sym, 33 #define _(sym,string) string, 40 #define _(sym,str) DHCP_CLIENT_DETECT_NEXT_##sym, 60 u16 dhcp_client_port_network_order;
61 u32 n_left_from, *from, *to_next;
64 dhcp_client_port_network_order =
65 clib_net_to_host_u16 (UDP_DST_PORT_dhcp_to_client);
71 while (n_left_from > 0)
82 while (n_left_from >= 8 && n_left_to_next >= 4)
87 u32 next0, next1, next2, next3;
88 u32 bi0, bi1, bi2, bi3;
90 next0 = next1 = next2 = next3 = ~0;
91 bi0 = to_next[0] = from[0];
92 bi1 = to_next[1] = from[1];
93 bi2 = to_next[2] = from[2];
94 bi3 = to_next[3] = from[3];
143 if (ip0->
protocol == IP_PROTOCOL_UDP)
147 if (dhcp_client_port_network_order == udp0->
dst_port)
149 next0 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
153 if (ip1->
protocol == IP_PROTOCOL_UDP)
157 if (dhcp_client_port_network_order == udp1->
dst_port)
159 next1 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
163 if (ip2->
protocol == IP_PROTOCOL_UDP)
167 if (dhcp_client_port_network_order == udp2->
dst_port)
169 next2 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
173 if (ip3->
protocol == IP_PROTOCOL_UDP)
177 if (dhcp_client_port_network_order == udp3->
dst_port)
179 next3 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
188 t->
extracted = (next0 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
194 t->
extracted = (next1 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
200 t->
extracted = (next2 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
206 t->
extracted = (next3 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
211 to_next, n_left_to_next,
213 next0, next1, next2, next3);
216 while (n_left_from > 0 && n_left_to_next > 0)
247 if (ip0->
protocol == IP_PROTOCOL_UDP)
251 if (dhcp_client_port_network_order == udp0->
dst_port)
253 next0 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
262 t->
extracted = (next0 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
267 to_next, n_left_to_next,
275 DHCP_CLIENT_DETECT_ERROR_EXTRACT, extractions);
289 s =
format (s,
"dhcp-client-detect: %s", (t->
extracted ?
"yes" :
"no"));
297 .name =
"ip4-dhcp-client-detect",
298 .vector_size =
sizeof (
u32),
311 [DHCP_CLIENT_DETECT_NEXT_EXTRACT] =
"ip4-udp-lookup",
320 .arc_name =
"ip4-unicast",
321 .node_name =
"ip4-dhcp-client-detect",
VLIB_NODE_FUNCTION_MULTIARCH(dhcp_client_detect_node, dhcp_client_detect_node_fn)
struct dhcp_client_detect_trace_t_ dhcp_client_detect_trace_t
per-packet trace data
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
static uword dhcp_client_detect_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
dhcp_client_detect_next_t
static u8 * format_dhcp_client_detect_trace(u8 *s, va_list *args)
u32 node_index
Node index.
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define foreach_dhcp_client_detect
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define VNET_FEATURES(...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
vlib_node_registration_t dhcp_client_detect_node
(constructor) VLIB_REGISTER_NODE (dhcp_client_detect_node)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
dhcp_client_detect_error_t
static char * dhcp_client_detect_error_strings[]
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
VNET_FEATURE_INIT(ip4_dvr_reinject_feat_node, static)