43 #define IP4_PG_EDIT_CHECKSUM (1 << 0) 44 #define IP4_PG_EDIT_LENGTH (1 << 1) 54 while (n_packets >= 2)
68 ip0 = (
void *) (p0->
data + ip_header_offset);
69 ip1 = (
void *) (p1->
data + ip_header_offset);
98 while (n_packets >= 1)
110 ip0 = (
void *) (p0->
data + ip_header_offset);
189 #define _(f) pg_edit_init (&p->f, ip4_header_t, f); 202 ip_version_and_header_length, 0, 4);
204 ip_version_and_header_length, 4, 4);
207 flags_and_fragment_offset, 0, 13);
209 flags_and_fragment_offset, 13, 1);
211 flags_and_fragment_offset, 14, 1);
213 flags_and_fragment_offset, 15, 1);
243 if (
unformat (input,
"%U: %U -> %U",
263 else if (
unformat (input,
"header-length %U",
272 else if (
unformat (input,
"length %U",
276 else if (
unformat (input,
"checksum %U",
284 else if (
unformat (input,
"fragment id %U offset %U",
351 &fixed_header, &fixed_mask);
352 if (!memcmp (&fixed_mask, &cmp_mask,
sizeof (cmp_mask)))
#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
void(* edit_function)(struct pg_main_t *pg, struct pg_stream_t *s, struct pg_edit_group_t *g, u32 *buffers, u32 n_buffers)
uword unformat_pg_edit(unformat_input_t *input, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
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
vl_api_address_union_t src_address
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
static vlib_main_t * vlib_get_main(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define ip4_partial_header_checksum_x1(ip0, sum0)
VLIB buffer representation.
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 int ip4_header_bytes(const ip4_header_t *i)
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)