83 u32 n_left_from, *from, *to_next;
102 while (n_left_from > 0)
108 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, arc0, arc1;
131 to_next[0] = pi0 = from[0];
132 to_next[1] = pi1 = from[1];
147 error0 = error1 = IP4_ERROR_NONE;
159 error0 = IP4_ERROR_TIME_EXPIRED;
172 error1 = IP4_ERROR_TIME_EXPIRED;
187 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
191 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
202 IP4_ERROR_BAD_CHECKSUM : error0;
204 IP4_ERROR_BAD_CHECKSUM : error1;
209 IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
211 IP4_ERROR_FRAGMENT_OFFSET_ONE : error1;
214 ip_len0 = clib_net_to_host_u16 (ip0->
length);
215 ip_len1 = clib_net_to_host_u16 (ip1->
length);
218 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
219 error1 = ip_len1 <
sizeof (ip1[0]) ? IP4_ERROR_TOO_SHORT : error1;
224 len_diff0 = cur_len0 - ip_len0;
225 len_diff1 = cur_len1 - ip_len1;
227 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
228 error1 = len_diff1 < 0 ? IP4_ERROR_BAD_LENGTH : error1;
235 if (error0 == IP4_ERROR_TIME_EXPIRED)
238 ICMP4_time_exceeded_ttl_exceeded_in_transit,
243 next0 = error0 != IP4_ERROR_OPTIONS ?
248 if (error1 == IP4_ERROR_TIME_EXPIRED)
251 ICMP4_time_exceeded_ttl_exceeded_in_transit,
256 next1 = error1 != IP4_ERROR_OPTIONS ?
261 to_next, n_left_to_next,
262 pi0, pi1, next0, next1);
264 while (n_left_from > 0 && n_left_to_next > 0)
268 u32 sw_if_index0, pi0, ip_len0, cur_len0, next0;
284 error0 = IP4_ERROR_NONE;
296 error0 = IP4_ERROR_TIME_EXPIRED;
307 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
323 1 ? IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
326 ip_len0 = clib_net_to_host_u16 (ip0->
length);
329 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
332 len_diff0 = cur_len0 - ip_len0;
333 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
338 if (error0 == IP4_ERROR_TIME_EXPIRED)
341 ICMP4_time_exceeded_ttl_exceeded_in_transit,
346 next0 = error0 != IP4_ERROR_OPTIONS ?
351 to_next, n_left_to_next,
410 #define _(sym,string) string, 419 .vector_size =
sizeof (
u32),
443 .name =
"ip4-input-no-checksum",
444 .vector_size =
sizeof (
u32),
struct ip4_main_t::@123 host_config
Template information for VPP generated packets.
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
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.
ip_lookup_main_t lookup_main
vlib_error_t * errors
Vector of errors for this node.
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)
u8 mcast_feature_arc_index
Feature arc indices.
static pg_node_t * pg_get_node(uword node_index)
#define VLIB_INIT_FUNCTION(x)
static int ip4_get_fragment_offset(ip4_header_t *i)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#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)
uword os_get_cpu_number(void)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
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)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VLIB_NODE_FLAG_TRACE
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
u8 ucast_feature_arc_index
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_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
void ppp_register_input_protocol(vlib_main_t *vm, ppp_protocol_t protocol, u32 node_index)
u16 flags
Copy of main node flags.
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.
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u64 increment)
Increment a simple counter.
static u16 ip_csum_fold(ip_csum_t c)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)