44 #define UDP_PG_EDIT_LENGTH (1 << 0) 45 #define UDP_PG_EDIT_CHECKSUM (1 << 1) 54 u32 ip_offset, udp_offset;
57 ip_offset = (g - 1)->start_byte_offset;
59 while (n_packets >= 1)
70 ip0 = (
void *) (p0->
data + ip_offset);
71 udp0 = (
void *) (p0->
data + udp_offset);
75 udp0->
length = clib_host_to_net_u16 (udp_len0);
77 udp_len0 = clib_host_to_net_u16 (udp0->
length);
87 (sum0, clib_host_to_net_u32 (udp_len0 + (ip0->
protocol << 16)));
99 sum0 = sum0 != 0 ? sum0 : 0xffff;
145 #define _(f) pg_edit_init (&p->f, udp_header_t, f); 168 if (!
unformat (input,
"UDP: %U -> %U",
181 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)
vl_api_wireguard_peer_flags_t flags
vl_api_ip_port_and_mask_t dst_port
unformat_function_t * unformat_pg_edit
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 udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
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)
vl_api_ip_port_and_mask_t src_port
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)
#define clib_mem_unaligned(pointer, type)
uword edit_function_opaque
static vlib_main_t * vlib_get_main(void)
VLIB buffer representation.
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)