40 #ifndef included_ip4_packet_h 41 #define included_ip4_packet_h 151 #define IP4_HEADER_FLAG_MORE_FRAGMENTS (1 << 13) 152 #define IP4_HEADER_FLAG_DONT_FRAGMENT (1 << 14) 153 #define IP4_HEADER_FLAG_CONGESTION (1 << 15) 179 u64 checksum_data_64[2];
180 u32 checksum_data_64_32[1];
187 u32 checksum_data_32[5];
193 #define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS \ 194 ((4 << 4) | (sizeof (ip4_header_t) / sizeof (u32))) 196 #define IP4_ROUTER_ALERT_OPTION 20 260 if (csum == 0 && save == 0xffff)
272 #define ip4_partial_header_checksum_x1(ip0,sum0) \ 274 if (BITS (ip_csum_t) > 32) \ 276 sum0 = ip0->checksum_data_64[0]; \ 277 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \ 278 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \ 282 sum0 = ip0->checksum_data_32[0]; \ 283 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \ 284 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \ 285 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \ 286 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \ 290 #define ip4_partial_header_checksum_x2(ip0,ip1,sum0,sum1) \ 292 if (BITS (ip_csum_t) > 32) \ 294 sum0 = ip0->checksum_data_64[0]; \ 295 sum1 = ip1->checksum_data_64[0]; \ 296 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \ 297 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64[1]); \ 298 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \ 299 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64_32[0]); \ 303 sum0 = ip0->checksum_data_32[0]; \ 304 sum1 = ip1->checksum_data_32[0]; \ 305 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \ 306 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[1]); \ 307 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \ 308 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[2]); \ 309 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \ 310 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[3]); \ 311 sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \ 312 sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[4]); \ 319 return (a->
data[0] & 0xf0) == 0xe0;
327 a->
as_u32 = clib_host_to_net_u32 ((0xe << 28) + g);
336 ethernet_address[0] = 0x01;
337 ethernet_address[1] = 0x00;
338 ethernet_address[2] = 0x5e;
339 ethernet_address[3] = d[1] & 0x7f;
340 ethernet_address[4] = d[2];
341 ethernet_address[5] = d[3];
364 u32 src0, dst0, src1, dst1;
static uword ip4_address_is_multicast(const ip4_address_t *a)
struct _tcp_header tcp_header_t
static void ip4_tcp_reply_x1(ip4_header_t *ip0, tcp_header_t *tcp0)
static int ip4_get_fragment_offset_bytes(const ip4_header_t *i)
static int ip4_is_fragment(const ip4_header_t *i)
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
static void * ip4_next_header(ip4_header_t *i)
static int ip4_get_fragment_offset(const ip4_header_t *i)
static void ip4_tcp_reply_x2(ip4_header_t *ip0, ip4_header_t *ip1, tcp_header_t *tcp0, tcp_header_t *tcp1)
#define IP4_HEADER_FLAG_MORE_FRAGMENTS
static void ip4_multicast_ethernet_address(u8 *ethernet_address, const ip4_address_t *a)
static ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
#define clib_memcpy(a, b, c)
static int ip4_get_fragment_more(const ip4_header_t *i)
static void ip4_multicast_address_set_for_group(ip4_address_t *a, ip_multicast_group_t g)
static void ip4_addr_fib_init(ip4_address_fib_t *addr_fib, const ip4_address_t *address, u32 fib_index)
static int ip4_is_first_fragment(const ip4_header_t *i)
static uword ip4_address_netmask_length(const ip4_address_t *a)
static int ip4_header_bytes(const ip4_header_t *i)
static u16 ip4_header_checksum(ip4_header_t *i)
static u16 ip_csum_fold(ip_csum_t c)