82 u32 n_left_from, * from, * to_next;
100 while (n_left_from > 0)
105 to_next, n_left_to_next);
107 while (n_left_from >= 4 && n_left_to_next >= 2)
112 u32 sw_if_index0, pi0, ip_len0, cur_len0, next0;
113 u32 sw_if_index1, pi1, ip_len1, cur_len1, next1;
114 i32 len_diff0, len_diff1;
115 u8 error0, error1, cast0, cast1;
131 to_next[0] = pi0 = from[0];
132 to_next[1] = pi1 = from[1];
171 error0 = error1 = IP4_ERROR_NONE;
189 error0 = 0xffff !=
ip_csum_fold (sum0) ? IP4_ERROR_BAD_CHECKSUM : error0;
190 error1 = 0xffff !=
ip_csum_fold (sum1) ? IP4_ERROR_BAD_CHECKSUM : error1;
198 error0 = (ip0->
ttl <= 1 && cast0 ==
VNET_UNICAST) ? IP4_ERROR_TIME_EXPIRED : error0;
199 error1 = (ip1->
ttl <= 1 && cast1 ==
VNET_UNICAST) ? IP4_ERROR_TIME_EXPIRED : error1;
202 ip_len0 = clib_net_to_host_u16 (ip0->
length);
203 ip_len1 = clib_net_to_host_u16 (ip1->
length);
206 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
207 error1 = ip_len1 <
sizeof (ip1[0]) ? IP4_ERROR_TOO_SHORT : error1;
212 len_diff0 = cur_len0 - ip_len0;
213 len_diff1 = cur_len1 - ip_len1;
215 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
216 error1 = len_diff1 < 0 ? IP4_ERROR_BAD_LENGTH : error1;
223 if (error0 == IP4_ERROR_TIME_EXPIRED) {
225 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
232 if (error1 == IP4_ERROR_TIME_EXPIRED) {
234 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
241 to_next, n_left_to_next,
242 pi0, pi1, next0, next1);
244 while (n_left_from > 0 && n_left_to_next > 0)
249 u32 sw_if_index0, pi0, ip_len0, cur_len0, next0;
276 error0 = IP4_ERROR_NONE;
290 error0 = 0xffff !=
ip_csum_fold (sum0) ? IP4_ERROR_BAD_CHECKSUM : error0;
297 error0 = (ip0->
ttl <= 1 && cast0 ==
VNET_UNICAST) ? IP4_ERROR_TIME_EXPIRED : error0;
300 ip_len0 = clib_net_to_host_u16 (ip0->
length);
303 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
306 len_diff0 = cur_len0 - ip_len0;
307 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
312 if (error0 == IP4_ERROR_TIME_EXPIRED) {
314 ICMP4_time_exceeded_ttl_exceeded_in_transit, 0);
321 to_next, n_left_to_next,
348 #define _(sym,string) string, 356 .vector_size =
sizeof (
u32),
376 .name =
"ip4-input-no-checksum",
377 .vector_size =
sizeof (
u32),
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
always_inline uword ip4_address_is_multicast(ip4_address_t *a)
u32 * config_index_by_sw_if_index
always_inline pg_node_t * pg_get_node(uword node_index)
vnet_interface_main_t interface_main
always_inline int ip4_get_fragment_offset(ip4_header_t *i)
ip_config_main_t rx_config_mains[VNET_N_CAST]
ip_lookup_main_t lookup_main
static clib_error_t * ip4_cli_init(vlib_main_t *vm)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define vlib_call_init_function(vm, x)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
void ppp_register_input_protocol(vlib_main_t *vm, ppp_protocol_t protocol, u32 node_index)
always_inline u16 ip_csum_fold(ip_csum_t c)
always_inline void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u32 increment)
uword os_get_cpu_number(void)
vlib_simple_counter_main_t * sw_if_counters
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define foreach_ip4_error
#define CLIB_PREFETCH(addr, size, type)
clib_error_t * ip4_source_check_init(vlib_main_t *vm)
void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
unformat_function_t * unformat_edit
void hdlc_register_input_protocol(vlib_main_t *vm, hdlc_protocol_t protocol, u32 node_index)
struct ip4_main_t::@97 host_config
#define VLIB_NODE_FLAG_TRACE
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
#define vec_elt(v, i)
Get vector value at index i.
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
#define ip4_partial_header_checksum_x1(ip0, sum0)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
always_inline vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
always_inline void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vnet_config_main_t config_main