|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
16 #ifndef included_pnat_test_stubs_h
17 #define included_pnat_test_stubs_h
34 u8 *
a = va_arg(*args,
u8 *);
35 return format(s,
"%d.%d.%d.%d",
a[0],
a[1],
a[2],
a[3]);
53 u32 n_feature_config_bytes) {
62 u32 ip_header_length, payload_length_host_byte_order;
66 payload_length_host_byte_order =
67 clib_net_to_host_u16(ip0->
length) - ip_header_length;
68 sum0 = clib_host_to_net_u32(payload_length_host_byte_order +
80 payload_length_host_byte_order, (
u8 *)ip0,
81 ip_header_length, NULL);
92 udp0 = (
void *)(ip0 + 1);
94 p0->
flags |= (VNET_BUFFER_F_L4_CHECKSUM_COMPUTED |
95 VNET_BUFFER_F_L4_CHECKSUM_CORRECT);
101 p0->
flags |= (VNET_BUFFER_F_L4_CHECKSUM_COMPUTED |
102 ((sum16 == 0) << VNET_BUFFER_F_LOG2_L4_CHECKSUM_CORRECT));
108 u32 max_header_bytes = va_arg(*args,
u32);
113 if (max_header_bytes <
sizeof(tcp[0]))
114 return format(s,
"TCP header truncated");
120 s =
format(s,
"TCP: %d -> %d", clib_net_to_host_u16(tcp->src),
121 clib_net_to_host_u16(tcp->dst));
124 clib_net_to_host_u32(tcp->seq_number),
125 clib_net_to_host_u32(tcp->ack_number));
128 tcp->flags, header_bytes);
131 clib_net_to_host_u16(tcp->window),
132 clib_net_to_host_u16(tcp->checksum));
138 u32 max_header_bytes = va_arg(*args,
u32);
142 if (max_header_bytes <
sizeof(udp[0]))
143 return format(s,
"UDP header truncated");
148 s =
format(s,
"UDP: %d -> %d", clib_net_to_host_u16(udp->
src_port),
149 clib_net_to_host_u16(udp->
dst_port));
152 clib_net_to_host_u16(udp->
length),
153 clib_net_to_host_u16(udp->
checksum));
161 u32 max_header_bytes = va_arg(*args,
u32);
162 u32 ip_version, header_bytes;
166 if (max_header_bytes <
sizeof(
ip[0]))
167 return format(s,
"IP header truncated");
172 ip_version = (
ip->ip_version_and_header_length >> 4);
173 header_bytes = (
ip->ip_version_and_header_length & 0xf) *
sizeof(
u32);
179 if (ip_version != 4 || header_bytes !=
sizeof(
ip4_header_t))
181 indent, ip_version, header_bytes);
183 s =
format(s,
"\n%Utos 0x%02x, ttl %d, length %d, checksum 0x%04x",
185 clib_net_to_host_u16(
ip->length),
186 clib_net_to_host_u16(
ip->checksum));
191 s =
format(s,
" (should be 0x%04x)",
196 u32 f = clib_net_to_host_u16(
ip->flags_and_fragment_offset);
200 clib_net_to_host_u16(
ip->fragment_id));
203 o = 8 * (
f & 0x1fff);
206 s =
format(s,
" offset %d", o);
209 s =
format(s,
", flags ");
211 if (f & IP4_HEADER_FLAG_##l) \
u8 * format_udp_header(u8 *s, va_list *args)
u8 * format_ip4_header(u8 *s, va_list *args)
static int tcp_header_bytes(tcp_header_t *t)
void(* stat_segment_update_fn)(stat_segment_directory_entry_t *e, u32 i)
struct _tcp_header tcp_header_t
static uword ip4_header_checksum_is_valid(ip4_header_t *i)
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
u8 * format_ip4_address(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u8 * format_tcp_header(u8 *s, va_list *args)
static u16 ip_calculate_l4_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip_csum_t sum0, u32 payload_length, u8 *iph, u32 ip_header_size, u8 *l4h)
int ip4_sv_reass_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
vnet_main_t * vnet_get_main(void)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define clib_mem_unaligned(pointer, type)
clib_error_t * stat_segment_register_gauge(u8 *names, stat_segment_update_fn update_fn, u32 index)
int ip4_sv_reass_output_enable_disable_with_refcnt(u32 sw_if_index, int is_enable)
vnet_feature_main_t feature_main
u32 ip4_tcp_udp_validate_checksum(vlib_main_t *vm, vlib_buffer_t *p0)
description fragment has unexpected format
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
void classify_get_trace_chain(void)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
vlib_error_desc_t pnat_error_counters[10]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u16 ip4_header_checksum(ip4_header_t *i)
static int ip4_header_bytes(const ip4_header_t *i)
u8 * format_pnat_match_tuple(u8 *s, va_list *args)
vl_api_interface_index_t sw_if_index
u8 * format_pnat_rewrite_tuple(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.