|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
41 #define foreach_udp_ping_error \
42 _(BADHBH, "Malformed hop-by-hop header")
46 #define _(sym,str) UDP_PING_ERROR_##sym,
53 #define _(sym,string) string,
87 s =
format (s,
"udp-ping-local: src %U, dst %U, src_port %u, dst_port %u "
88 "handle %u, next_index %u, msg_type %u",
101 .name =
"udp-ping-process",
110 u16 min_interval = 0x1e9;
119 if (min_interval >
flow->udp_data.interval)
120 min_interval =
flow->udp_data.interval;
133 u16 start_src_port,
u16 end_src_port,
134 u16 start_dst_port,
u16 end_dst_port,
148 start_src_port, end_src_port,
149 start_dst_port, end_dst_port,
flow)))
161 cur_interval =
flow->udp_data.interval;
169 cur_interval =
flow->udp_data.interval;
191 start_src_port, end_src_port,
192 start_dst_port, end_dst_port,
211 u8 colon_present = 0;
247 *
end_port = ((*end_port) * 10) + (
c -
'0');
266 u16 start_src_port, end_src_port;
267 u16 start_dst_port, end_dst_port;
277 else if (
unformat (input,
"src-port-range %U",
284 else if (
unformat (input,
"dst-port-range %U",
289 else if (
unformat (input,
"fault-detect"))
291 else if (
unformat (input,
"disable"))
299 fault_det, is_disable);
307 .path =
"set udp-ping",
309 "set udp-ping src <local IPv6 address> src-port-range <local port range> \
310 dst <remote IPv6 address> dst-port-range <destination port range> \
311 interval <time interval in sec for which ping packet will be sent> \
328 s =
format (s,
"UDP-Ping data:\n");
336 s =
format (s,
"Src: %U, Dst: %U\n",
340 s =
format (s,
"Start src port: %u, End src port: %u\n",
343 s =
format (s,
"Start dst port: %u, End dst port: %u\n",
350 src_port <= ip46_flow->udp_data.end_src_port;
src_port++)
353 dst_port <= ip46_flow->udp_data.end_dst_port;
dst_port++)
357 format (s,
"\nSrc Port - %u, Dst Port - %u, Flow CTX - %u\n",
360 format (s,
"Path State - %s\n",
362 s =
format (s,
"Path Data:\n");
365 stats[j].analyse_data);
380 .path =
"show udp-ping summary",
381 .short_help =
"Summary of udp-ping",
403 uword *event_data = 0;
446 ioam_e2e_option_t *e2e;
447 ioam_trace_option_t *
trace;
455 if (
PREDICT_FALSE ((src_port < ip46_flow->udp_data.start_src_port) ||
457 (dst_port < ip46_flow->udp_data.start_dst_port) ||
473 while (opt0 < limit0)
481 trace = (ioam_trace_option_t *) opt0;
486 (
trace->hdr.length - 2));
493 (
trace->hdr.length - 2));
496 e2e = (ioam_e2e_option_t *) opt0;
538 b0->
error =
node->errors[UDP_PING_ERROR_BADHBH];
561 vnet_buffer (b0)->l2_classify.opaque_index = 0x7FFFFFFF;
569 ((
u8 *) hbh0 + ((hbh0->
length + 1) << 3));
572 clib_net_to_host_u16 (udp0->
573 ping_data.sender_handle),
576 opt0, limit0, p_len0);
591 u64 *copy_dst0, *copy_src0;
597 ((hbh0->
length + 1) << 3);
603 copy_src0 = (
u64 *) ip0;
604 copy_dst0 = copy_src0 + (hbh0->
length + 1);
605 copy_dst0[4] = copy_src0[4];
606 copy_dst0[3] = copy_src0[3];
607 copy_dst0[2] = copy_src0[2];
608 copy_dst0[1] = copy_src0[1];
609 copy_dst0[0] = copy_src0[0];
675 pi0 = to_next[0] =
from[0];
676 pi1 = to_next[1] =
from[1];
696 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
714 if (p1->
flags & VLIB_BUFFER_IS_TRACED)
735 to_next, n_left_to_next,
736 pi0, pi1, next0, next1);
762 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
783 to_next, n_left_to_next,
790 return frame->n_vectors;
800 .name =
"udp-ping-local",
801 .vector_size =
sizeof (
u32),
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
@ UDP_PING_NEXT_IP6_LOOKUP
void ip6_local_hop_by_hop_register_protocol(u32 protocol, u32 node_index)
ip46_address_t dst
Remote destination IPv4/6 address to be used.
#define foreach_udp_ping_error
vnet_interface_main_t * im
uword unformat_port_range(unformat_input_t *input, va_list *args)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static u8 * format_udp_ping_trace(u8 *s, va_list *args)
static clib_error_t * set_udp_ping_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vl_api_ip_port_and_mask_t dst_port
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
vlib_main_t * vlib_main
Pointer to VLib main for the node - ipfix-collector.
int udp_ping_compare_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, ip46_udp_ping_flow *flow)
static clib_error_t * udp_ping_init(vlib_main_t *vm)
nat44_ei_hairpin_src_next_t next_index
#define UDP_PING_PROBE_MARKER1
ip46_udp_ping_flow * ip46_flow
Vector od udp-ping data.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u8 * print_analyse_flow(u8 *s, ioam_analyser_data_t *record)
static vlib_node_registration_t udp_ping_node
(constructor) VLIB_REGISTER_NODE (udp_ping_node)
static int ip6_ioam_analyse_hbh_e2e(ioam_analyser_data_t *data, ioam_e2e_packet_t *e2e, u16 len)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void udp_ping_create_reply_from_probe_ip6(ip6_header_t *ip, ip6_hop_by_hop_header_t *hbh, udp_ping_t *udp)
Create and send ipv6 udp-ping response packet.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
@ VLIB_NODE_TYPE_INTERNAL
udp_ping_flow_data * stats
Ping statistics.
vlib_main_t vlib_node_runtime_t * node
void udp_ping_analyse_hbh(vlib_buffer_t *b0, u32 flow_id, u16 src_port, u16 dst_port, ip6_hop_by_hop_option_t *opt0, ip6_hop_by_hop_option_t *limit0, u16 len)
HopByHop analyse function for udp-ping response.
#define IPPROTO_IPV6_ROUTE
#define UDP_PING_PROBE_MARKER2
u32 flow_ctx
This is used by ioam e2e for identifying flow and add seq number.
int ip6_hbh_ioam_trace_data_list_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
static vlib_cli_command_t show_udp_ping_cmd
(constructor) VLIB_CLI_COMMAND (show_udp_ping_cmd)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vnet_main_t * vnet_main
Pointer to vnet main for convenience.
vl_api_ikev2_sa_stats_t stats
ip46_address_t src
Local source IPv4/6 address to be used.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
#define pool_put_index(p, i)
Free pool element with given index.
u16 start_src_port
Defines start port of the src port range.
void udp_ping_create_rewrite(ip46_udp_ping_flow *flow, u16 ctx)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void udp_ping_local_analyse(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_hop_by_hop_header_t *hbh0, u16 *next0)
UDP-Ping request/response handler function.
u16 retry
Number of times ping response was dropped.
#define CLIB_PREFETCH(addr, size, type)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void ip46_udp_ping_set_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, u16 interval, u8 fault_det, u8 is_disable)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
void udp_ping_calculate_timer_interval(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
f64 end
end of the time range
vl_api_ip_port_and_mask_t src_port
static vlib_cli_command_t set_udp_ping_command
(constructor) VLIB_CLI_COMMAND (set_udp_ping_command)
udp-ping main data-structure.
uword udp_ping_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
UDP-Ping Process node.
#define VLIB_CLI_COMMAND(x,...)
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u16 current_length
Nbytes between current data and the end of this buffer.
ioam_analyser_data_t analyse_data
Analysed data.
u64 timer_interval
Stores the time interval at which process node has to wake up.
static uword udp_ping_local_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
udp ping request/response packet receive node.
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE
#define vec_free(V)
Free vector's memory (no header).
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define BIT_LOOPBACK_REPLY
static vlib_node_registration_t udp_ping_local
(constructor) VLIB_REGISTER_NODE (udp_ping_local)
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
u16 interval
Interval for which ping packet to be sent.
vlib_put_next_frame(vm, node, next_index, 0)
udp_ping_flow udp_data
Per flow data.
format_function_t format_ip46_address
#define VLIB_INIT_FUNCTION(x)
udp_ping_main_t udp_ping_main
#define EVENT_SIG_RECHECK
@ UDP_PING_NEXT_UDP_LOOKUP
static void ip6_ioam_analyse_hbh_trace_loopback(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 trace_len)
static char * udp_ping_error_strings[]
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u16 end_dst_port
Defines end port of the dest port range.
u16 end_src_port
Defines end port of the src port range.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
void udp_ping_populate_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, u16 interval, u8 fault_det, ip46_udp_ping_flow *flow)
static clib_error_t * show_udp_ping_summary_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
static f64 vlib_time_now(vlib_main_t *vm)
void udp_ping_send_ip6_pak(vlib_main_t *vm, ip46_udp_ping_flow *flow)
Create and send ipv6 udp-ping probe packet.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
f64 next_send_time
Time at which next udp-ping probe has to be sent out.
u16 start_dst_port
Defines start port of the dest port range.
vl_api_fib_path_type_t type
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
void udp_ping_free_flow_data(ip46_udp_ping_flow *flow)
static int ip6_ioam_analyse_hbh_trace(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 pak_len, u16 trace_len)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)