40 #ifndef included_ip_input_h 41 #define included_ip_input_h 63 u32 * next0,
u32 * next1,
int verify_checksum)
66 u32 ip_len0, cur_len0;
67 u32 ip_len1, cur_len1;
68 i32 len_diff0, len_diff1;
70 error0 = error1 = IP4_ERROR_NONE;
75 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
79 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
82 error0 = IP4_ERROR_TIME_EXPIRED;
84 error1 = IP4_ERROR_TIME_EXPIRED;
95 IP4_ERROR_BAD_CHECKSUM : error0;
97 IP4_ERROR_BAD_CHECKSUM : error1;
102 IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
104 IP4_ERROR_FRAGMENT_OFFSET_ONE : error1;
107 ip_len0 = clib_net_to_host_u16 (ip0->
length);
108 ip_len1 = clib_net_to_host_u16 (ip1->
length);
111 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
112 error1 = ip_len1 <
sizeof (ip1[0]) ? IP4_ERROR_TOO_SHORT : error1;
117 len_diff0 = cur_len0 - ip_len0;
118 len_diff1 = cur_len1 - ip_len1;
120 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
121 error1 = len_diff1 < 0 ? IP4_ERROR_BAD_LENGTH : error1;
125 if (error0 == IP4_ERROR_TIME_EXPIRED)
128 ICMP4_time_exceeded_ttl_exceeded_in_transit,
133 *next0 = error0 != IP4_ERROR_OPTIONS ?
138 if (error1 == IP4_ERROR_TIME_EXPIRED)
141 ICMP4_time_exceeded_ttl_exceeded_in_transit,
146 *next1 = error1 != IP4_ERROR_OPTIONS ?
160 u32 ip_len0, cur_len0;
164 error0 = IP4_ERROR_NONE;
169 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
179 IP4_ERROR_BAD_CHECKSUM : error0;
184 IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
187 ip_len0 = clib_net_to_host_u16 (ip0->
length);
190 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
194 len_diff0 = cur_len0 - ip_len0;
196 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
200 if (error0 == IP4_ERROR_TIME_EXPIRED)
203 ICMP4_time_exceeded_ttl_exceeded_in_transit,
208 *next0 = error0 != IP4_ERROR_OPTIONS ?
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 int ip4_get_fragment_offset(ip4_header_t *i)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
void icmp4_error_set_vnet_buffer(vlib_buffer_t *b, u8 type, u8 code, u32 data)
#define ip4_partial_header_checksum_x1(ip0, sum0)
static u16 ip_csum_fold(ip_csum_t c)