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;
133 u16 start_src_port,
u16 end_src_port,
134 u16 start_dst_port,
u16 end_dst_port,
135 u16 interval,
u8 fault_det,
u8 is_disable)
148 start_src_port, end_src_port,
149 start_dst_port, end_dst_port, flow)))
191 start_src_port, end_src_port,
192 start_dst_port, end_dst_port,
193 interval, fault_det, flow);
209 u16 *start_port, *end_port;
211 u8 colon_present = 0;
213 start_port = va_arg (*args,
u16 *);
214 end_port = va_arg (*args,
u16 *);
216 *start_port = *end_port = 0;
223 *start_port = ((*start_port) * 10) + (c -
'0');
247 *end_port = ((*end_port) * 10) + (c -
'0');
255 if (end_port < start_port)
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",
287 else if (
unformat (input,
"interval %d", &interval))
289 else if (
unformat (input,
"fault-detect"))
291 else if (
unformat (input,
"disable"))
298 start_dst_port, end_dst_port, (
u16) interval,
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",
358 src_port, dst_port, stats->
flow_ctx);
360 format (s,
"Path State - %s\n",
362 s =
format (s,
"Path Data:\n");
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;
453 ip46_flow = udp_ping_main.
ip46_flow + flow_id;
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;
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];
642 u32 *from, *to_next, n_left_from, n_left_to_next;
648 while (n_left_from > 0)
652 while (n_left_from >= 4 && n_left_to_next >= 2)
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);
739 while (n_left_from > 0 && n_left_to_next > 0)
762 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
783 to_next, n_left_to_next,
800 .name =
"udp-ping-local",
801 .vector_size =
sizeof (
u32),
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
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)
static char * udp_ping_error_strings[]
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)
u16 current_length
Nbytes between current data and the end of this buffer.
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.
vlib_error_t * errors
Vector of errors for this node.
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.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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.
#define foreach_udp_ping_error
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 with alignment A.
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
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
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.
#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)
VLIB buffer representation.
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
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)