43 #define UDP_PG_EDIT_LENGTH (1 << 0) 44 #define UDP_PG_EDIT_CHECKSUM (1 << 1) 53 u32 ip_offset, udp_offset;
56 ip_offset = (g - 1)->start_byte_offset;
58 while (n_packets >= 1)
69 ip0 = (
void *) (p0->
data + ip_offset);
70 udp0 = (
void *) (p0->
data + udp_offset);
71 udp_len0 = clib_net_to_host_u16 (ip0->
length) -
sizeof (ip0[0]);
86 (sum0, clib_host_to_net_u32 (udp_len0 + (ip0->
protocol << 16)));
98 sum0 = sum0 != 0 ? sum0 : 0xffff;
144 #define _(f) pg_edit_init (&p->f, udp_header_t, f); 167 if (!
unformat (input,
"UDP: %U -> %U",
180 else if (
unformat (input,
"checksum %U",
static ip_csum_t ip_incremental_checksum_buffer(vlib_main_t *vm, vlib_buffer_t *first_buffer, u32 first_buffer_offset, u32 n_bytes_to_checksum, ip_csum_t sum)
#define UDP_PG_EDIT_CHECKSUM
static void * pg_get_edit_group(pg_stream_t *s, u32 group_index)
static vlib_main_t * vlib_get_main(void)
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)
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static pg_edit_group_t * pg_stream_get_group(pg_stream_t *s, u32 group_index)
uword unformat_pg_payload(unformat_input_t *input, va_list *args)
#define UDP_PG_EDIT_LENGTH
static void * pg_create_edit_group(pg_stream_t *s, int n_edit_bytes, int n_packet_bytes, u32 *group_index)
static u64 pg_edit_get_value(pg_edit_t *e, int hi_or_lo)
static void udp_pg_edit_function_inline(pg_main_t *pg, pg_stream_t *s, pg_edit_group_t *g, u32 *packets, u32 n_packets, u32 flags)
uword unformat_pg_udp_header(unformat_input_t *input, va_list *args)
static tcp_udp_port_info_t * ip_get_tcp_udp_port_info(ip_main_t *im, u32 port)
unformat_function_t * unformat_pg_edit
static void pg_udp_header_init(pg_udp_header_t *p)
static void pg_free_edit_group(pg_stream_t *s)
uword edit_function_opaque
#define clib_mem_unaligned(pointer, type)
uword unformat_pg_number(unformat_input_t *input, va_list *args)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void udp_pg_edit_function(pg_main_t *pg, pg_stream_t *s, pg_edit_group_t *g, u32 *packets, u32 n_packets)
static u16 ip_csum_fold(ip_csum_t c)