43 #define IP4_PG_EDIT_CHECKSUM (1 << 0) 44 #define IP4_PG_EDIT_LENGTH (1 << 1) 55 while (n_packets >= 2)
69 ip0 = (
void *) (p0->
data + ip_header_offset);
70 ip1 = (
void *) (p1->
data + ip_header_offset);
95 while (n_packets >= 1)
107 ip0 = (
void *) (p0->
data + ip_header_offset);
185 #define _(f) pg_edit_init (&p->f, ip4_header_t, f); 198 ip_version_and_header_length,
201 ip_version_and_header_length,
205 flags_and_fragment_offset,
208 flags_and_fragment_offset,
211 flags_and_fragment_offset,
214 flags_and_fragment_offset,
246 if (
unformat (input,
"%U: %U -> %U",
269 else if (
unformat (input,
"header-length %U",
279 else if (
unformat (input,
"length %U",
284 else if (
unformat (input,
"checksum %U",
294 else if (
unformat (input,
"fragment id %U offset %U",
356 memset (&cmp_mask, ~0,
sizeof (cmp_mask));
360 &fixed_header, &fixed_mask);
361 if (! memcmp (&fixed_mask, &cmp_mask,
sizeof (cmp_mask)))
sll srl srl sll sra u16x4 i
#define ip4_partial_header_checksum_x2(ip0, ip1, sum0, sum1)
static void * pg_get_edit_group(pg_stream_t *s, u32 group_index)
static void pg_edit_set_fixed(pg_edit_t *e, u64 value)
pg_edit_group_t * edit_groups
static int ip4_header_bytes(ip4_header_t *i)
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static_always_inline void compute_length_and_or_checksum(vlib_main_t *vm, u32 *packets, u32 n_packets, u32 ip_header_offset, u32 flags)
static pg_edit_group_t * pg_stream_get_group(pg_stream_t *s, u32 group_index)
unformat_function_t * unformat_pg_edit
#define static_always_inline
uword unformat_pg_payload(unformat_input_t *input, va_list *args)
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
void pg_edit_set_value(pg_edit_t *e, int hi_or_lo, u64 value)
void pg_edit_group_get_fixed_packet_data(pg_stream_t *s, u32 group_index, void *fixed_packet_data, void *fixed_packet_data_mask)
static ip_protocol_info_t * ip_get_protocol_info(ip_main_t *im, u32 protocol)
static u64 pg_edit_get_value(pg_edit_t *e, int hi_or_lo)
#define pg_edit_init_bitfield(e, type, field, field_offset, field_n_bits)
enum ip_protocol ip_protocol_t
static uword pg_edit_group_n_bytes(pg_stream_t *s, u32 group_index)
uword unformat_pg_ip4_header(unformat_input_t *input, va_list *args)
static void pg_free_edit_group(pg_stream_t *s)
uword edit_function_opaque
#define IP4_PG_EDIT_CHECKSUM
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void(* edit_function)(struct pg_main_t *pg, struct pg_stream_t *s, struct pg_edit_group_t *g, u32 *buffers, u32 n_buffers)
#define ip4_partial_header_checksum_x1(ip0, sum0)
static void ip4_pg_edit_function(pg_main_t *pg, pg_stream_t *s, pg_edit_group_t *g, u32 *packets, u32 n_packets)
uword unformat_pg_number(unformat_input_t *input, va_list *args)
static void pg_ip4_header_init(pg_ip4_header_t *p)
#define IP4_PG_EDIT_LENGTH
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
static u16 ip_csum_fold(ip_csum_t c)