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,
383 #define _(sym,string) string, 391 .vector_size =
sizeof (
u32),
413 .name =
"ip4-input-no-checksum",
414 .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)
Release pointer to next frame vector data.
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u32 increment)
Increment a simple counter.
u32 * config_index_by_sw_if_index
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
vnet_interface_main_t interface_main
ip_config_main_t rx_config_mains[VNET_N_CAST]
rx/tx interface/feature configuration.
ip_lookup_main_t lookup_main
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static clib_error_t * ip4_cli_init(vlib_main_t *vm)
static pg_node_t * pg_get_node(uword node_index)
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static int ip4_get_fragment_offset(ip4_header_t *i)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
A collection of simple counters.
#define vlib_call_init_function(vm, x)
void ppp_register_input_protocol(vlib_main_t *vm, ppp_protocol_t protocol, u32 node_index)
struct ip4_main_t::@126 host_config
Template information for VPP generated packets.
uword os_get_cpu_number(void)
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
static uword ip4_address_is_multicast(ip4_address_t *a)
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)
Finish enqueueing two buffers forward in the graph.
#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).
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)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
unformat_function_t * unformat_edit
void hdlc_register_input_protocol(vlib_main_t *vm, hdlc_protocol_t protocol, u32 node_index)
#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)
clib_error_t * ip4_source_and_port_range_check_init(vlib_main_t *vm)
#define ip4_partial_header_checksum_x1(ip0, sum0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
u32 flow_hash_seed
Seed for Jenkins hash used to compute ip4 flow hash.
u8 ttl
TTL to use for host generated packets.
static 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
static u16 ip_csum_fold(ip_csum_t c)