40 #ifndef included_ip_input_h 41 #define included_ip_input_h 64 u32 * next0,
u32 * next1,
int verify_checksum)
67 u32 ip_len0, cur_len0;
68 u32 ip_len1, cur_len1;
69 i32 len_diff0, len_diff1;
71 error0 = error1 = IP4_ERROR_NONE;
76 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
80 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
83 error0 = IP4_ERROR_TIME_EXPIRED;
85 error1 = IP4_ERROR_TIME_EXPIRED;
96 IP4_ERROR_BAD_CHECKSUM : error0;
98 IP4_ERROR_BAD_CHECKSUM : error1;
103 IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
105 IP4_ERROR_FRAGMENT_OFFSET_ONE : error1;
108 ip_len0 = clib_net_to_host_u16 (ip0->
length);
109 ip_len1 = clib_net_to_host_u16 (ip1->
length);
112 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
113 error1 = ip_len1 <
sizeof (ip1[0]) ? IP4_ERROR_TOO_SHORT : error1;
118 len_diff0 = cur_len0 - ip_len0;
119 len_diff1 = cur_len1 - ip_len1;
121 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
122 error1 = len_diff1 < 0 ? IP4_ERROR_BAD_LENGTH : error1;
126 if (error0 == IP4_ERROR_TIME_EXPIRED)
129 ICMP4_time_exceeded_ttl_exceeded_in_transit,
134 *next0 = error0 != IP4_ERROR_OPTIONS ?
139 if (error1 == IP4_ERROR_TIME_EXPIRED)
142 ICMP4_time_exceeded_ttl_exceeded_in_transit,
147 *next1 = error1 != IP4_ERROR_OPTIONS ?
161 u32 ip_len0, cur_len0;
165 error0 = IP4_ERROR_NONE;
170 IP4_ERROR_OPTIONS : IP4_ERROR_VERSION;
180 IP4_ERROR_BAD_CHECKSUM : error0;
185 IP4_ERROR_FRAGMENT_OFFSET_ONE : error0;
188 ip_len0 = clib_net_to_host_u16 (ip0->
length);
191 error0 = ip_len0 <
sizeof (ip0[0]) ? IP4_ERROR_TOO_SHORT : error0;
195 len_diff0 = cur_len0 - ip_len0;
197 error0 = len_diff0 < 0 ? IP4_ERROR_BAD_LENGTH : error0;
201 if (error0 == IP4_ERROR_TIME_EXPIRED)
204 ICMP4_time_exceeded_ttl_exceeded_in_transit,
209 *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)