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);
68 n_left_from = frame->n_vectors;
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];
139 if (ip0->
protocol == IP_PROTOCOL_UDP)
143 if (dhcp_client_port_network_order == udp0->
dst_port)
145 next0 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
149 if (ip1->
protocol == IP_PROTOCOL_UDP)
153 if (dhcp_client_port_network_order == udp1->
dst_port)
155 next1 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
159 if (ip2->
protocol == IP_PROTOCOL_UDP)
163 if (dhcp_client_port_network_order == udp2->
dst_port)
165 next2 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
169 if (ip3->
protocol == IP_PROTOCOL_UDP)
173 if (dhcp_client_port_network_order == udp3->
dst_port)
175 next3 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
184 t->
extracted = (next0 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
190 t->
extracted = (next1 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
196 t->
extracted = (next2 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
202 t->
extracted = (next3 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
207 to_next, n_left_to_next,
209 next0, next1, next2, next3);
212 while (n_left_from > 0 && n_left_to_next > 0)
242 if (ip0->
protocol == IP_PROTOCOL_UDP)
246 if (dhcp_client_port_network_order == udp0->
dst_port)
248 next0 = DHCP_CLIENT_DETECT_NEXT_EXTRACT;
257 t->
extracted = (next0 == DHCP_CLIENT_DETECT_NEXT_EXTRACT);
262 to_next, n_left_to_next,
270 DHCP_CLIENT_DETECT_ERROR_EXTRACT, extractions);
272 return frame->n_vectors;
284 s =
format (s,
"dhcp-client-detect: %s", (t->
extracted ?
"yes" :
"no"));
291 .name =
"ip4-dhcp-client-detect",
292 .vector_size =
sizeof (
u32),
305 [DHCP_CLIENT_DETECT_NEXT_EXTRACT] =
"ip4-udp-lookup",
311 .arc_name =
"ip4-unicast",
312 .node_name =
"ip4-dhcp-client-detect",
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
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.
#define VLIB_NODE_FN(node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vl_api_fib_path_type_t type
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)
#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)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
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)
VLIB buffer representation.
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[]
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)