70 s =
format (s,
"udp-ping-local: src %U, dst %U, src_port %u, dst_port %u " 71 "handle %u, next_index %u, msg_type %u",
84 .name =
"udp-ping-process",
93 u16 min_interval = 0x1e9;
116 u16 start_src_port,
u16 end_src_port,
117 u16 start_dst_port,
u16 end_dst_port,
118 u16 interval,
u8 fault_det,
u8 is_disable)
131 start_src_port, end_src_port,
132 start_dst_port, end_dst_port, flow)))
174 start_src_port, end_src_port,
175 start_dst_port, end_dst_port,
176 interval, fault_det, flow);
192 u16 *start_port, *end_port;
194 u8 colon_present = 0;
196 start_port = va_arg (*args,
u16 *);
197 end_port = va_arg (*args,
u16 *);
199 *start_port = *end_port = 0;
206 *start_port = ((*start_port) * 10) + (c -
'0');
230 *end_port = ((*end_port) * 10) + (c -
'0');
238 if (end_port < start_port)
248 ip46_address_t dst, src;
249 u16 start_src_port, end_src_port;
250 u16 start_dst_port, end_dst_port;
260 else if (
unformat (input,
"src-port-range %U",
267 else if (
unformat (input,
"dst-port-range %U",
270 else if (
unformat (input,
"interval %d", &interval))
272 else if (
unformat (input,
"fault-detect"))
274 else if (
unformat (input,
"disable"))
281 start_dst_port, end_dst_port, (
u16) interval,
282 fault_det, is_disable);
290 .path =
"set udp-ping",
292 "set udp-ping src <local IPv6 address> src-port-range <local port range> \ 293 dst <remote IPv6 address> dst-port-range <destination port range> \ 294 interval <time interval in sec for which ping packet will be sent> \ 308 u16 src_port, dst_port;
311 s =
format (s,
"UDP-Ping data:\n");
319 s =
format (s,
"Src: %U, Dst: %U\n",
323 s =
format (s,
"Start src port: %u, End src port: %u\n",
326 s =
format (s,
"Start dst port: %u, End dst port: %u\n",
333 src_port <= ip46_flow->udp_data.end_src_port; src_port++)
336 dst_port <= ip46_flow->udp_data.end_dst_port; dst_port++)
340 format (s,
"\nSrc Port - %u, Dst Port - %u, Flow CTX - %u\n",
341 src_port, dst_port, stats->
flow_ctx);
343 format (s,
"Path State - %s\n",
345 s =
format (s,
"Path Data:\n");
363 .path =
"show udp-ping summary",
364 .short_help =
"Summary of udp-ping",
386 uword *event_data = 0;
429 ioam_e2e_option_t *e2e;
430 ioam_trace_option_t *
trace;
436 ip46_flow = udp_ping_main.
ip46_flow + flow_id;
438 if (
PREDICT_FALSE ((src_port < ip46_flow->udp_data.start_src_port) ||
440 (dst_port < ip46_flow->udp_data.start_dst_port) ||
456 while (opt0 < limit0)
464 trace = (ioam_trace_option_t *) opt0;
469 (trace->hdr.length - 2));
476 (trace->hdr.length - 2));
479 e2e = (ioam_e2e_option_t *) opt0;
533 vnet_buffer (b0)->l2_classify.opaque_index = 0x7FFFFFFF;
541 ((
u8 *) hbh0 + ((hbh0->
length + 1) << 3));
544 clib_net_to_host_u16 (udp0->
545 ping_data.sender_handle),
548 opt0, limit0, p_len0);
563 u64 *copy_dst0, *copy_src0;
569 ((hbh0->
length + 1) << 3);
575 copy_src0 = (
u64 *) ip0;
576 copy_dst0 = copy_src0 + (hbh0->
length + 1);
577 copy_dst0[4] = copy_src0[4];
578 copy_dst0[3] = copy_src0[3];
579 copy_dst0[2] = copy_src0[2];
580 copy_dst0[1] = copy_src0[1];
581 copy_dst0[0] = copy_src0[0];
614 u32 *from, *to_next, n_left_from, n_left_to_next;
620 while (n_left_from > 0)
624 while (n_left_from >= 4 && n_left_to_next >= 2)
647 pi0 = to_next[0] = from[0];
648 pi1 = to_next[1] = from[1];
668 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
686 if (p1->
flags & VLIB_BUFFER_IS_TRACED)
707 to_next, n_left_to_next,
708 pi0, pi1, next0, next1);
711 while (n_left_from > 0 && n_left_to_next > 0)
734 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
755 to_next, n_left_to_next,
772 .name =
"udp-ping-local",
773 .vector_size =
sizeof (
u32),
udp-ping main data-structure.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
ioam_analyser_data_t analyse_data
Analysed data.
static int ip6_ioam_analyse_hbh_e2e(ioam_analyser_data_t *data, ioam_e2e_packet_t *e2e, u16 len)
static u8 * print_analyse_flow(u8 *s, ioam_analyser_data_t *record)
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...
void ip6_register_protocol(u32 protocol, u32 node_index)
#define UDP_PING_PROBE_MARKER2
vnet_main_t * vnet_get_main(void)
static vlib_node_registration_t udp_ping_local
(constructor) VLIB_REGISTER_NODE (udp_ping_local)
ip46_udp_ping_flow * ip46_flow
Vector od udp-ping data.
u32 bytes_counter
Num of bytes matching this flow.
u16 start_dst_port
Defines start port of the dest port range.
static f64 vlib_time_now(vlib_main_t *vm)
void udp_ping_free_flow_data(ip46_udp_ping_flow *flow)
static u8 * format_udp_ping_trace(u8 *s, va_list *args)
static clib_error_t * show_udp_ping_summary_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u16 interval
Interval for which ping packet to be sent.
udp_ping_flow udp_data
Per flow data.
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)
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)
uword unformat_port_range(unformat_input_t *input, va_list *args)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
u16 end_src_port
Defines end port of the src port range.
f64 next_send_time
Time at which next udp-ping probe has to be sent out.
vnet_main_t * vnet_main
Pointer to vnet main for convenience.
#define VLIB_INIT_FUNCTION(x)
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE
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...
void udp_ping_send_ip6_pak(vlib_main_t *vm, ip46_udp_ping_flow *flow)
Create and send ipv6 udp-ping probe packet.
uword udp_ping_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
UDP-Ping Process node.
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
u32 pkt_counter
Num of pkts matching this flow.
u16 start_src_port
Defines start port of the src port range.
#define IPPROTO_IPV6_ROUTE
void udp_ping_create_rewrite(ip46_udp_ping_flow *flow, u16 ctx)
#define vlib_call_init_function(vm, x)
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.
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 pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
ip46_address_t dst
Remote destination IPv4/6 address to be used.
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
#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.
#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 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).
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
u32 flow_ctx
This is used by ioam e2e for identifying flow and add seq number.
#define VLIB_REGISTER_NODE(x,...)
clib_error_t * ip_main_init(vlib_main_t *vm)
#define CLIB_PREFETCH(addr, size, type)
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)
#define vec_free(V)
Free vector's memory (no header).
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_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define VLIB_CLI_COMMAND(x,...)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u16 end_dst_port
Defines end port of the dest port range.
static clib_error_t * set_udp_ping_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_put_index(p, i)
Free pool element with given index.
vlib_main_t * vlib_main
Pointer to VLib main for the node - ipfix-collector.
ip_lookup_main_t lookup_main
void udp_ping_local_analyse(vlib_buffer_t *b0, ip6_header_t *ip0, ip6_hop_by_hop_header_t *hbh0, u16 *next0)
UDP-Ping request/response handler function.
u64 timer_interval
Stores the time interval at which process node has to wake up.
ip46_address_t src
Local source IPv4/6 address to be used.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define BIT_LOOPBACK_REPLY
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static int ip6_ioam_analyse_hbh_trace(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 pak_len, u16 trace_len)
static clib_error_t * udp_ping_init(vlib_main_t *vm)
void udp_ping_calculate_timer_interval(void)
udp_ping_main_t udp_ping_main
u16 retry
Number of times ping response was dropped.
u16 flags
Copy of main node flags.
udp_ping_flow_data * stats
Ping statistics.
static void ip6_ioam_analyse_hbh_trace_loopback(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 trace_len)
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
#define EVENT_SIG_RECHECK
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define UDP_PING_PROBE_MARKER1
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static vlib_node_registration_t udp_ping_node
(constructor) VLIB_REGISTER_NODE (udp_ping_node)
int ip6_hbh_ioam_trace_data_list_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)