aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/ioam/analyse/ioam_analyse.h10
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c1
-rw-r--r--src/plugins/ioam/encap/ip6_ioam_trace.c23
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.h24
-rw-r--r--src/plugins/ioam/ip6/ioam_cache_node.c2
-rw-r--r--src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c2
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c3
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_node.c11
8 files changed, 42 insertions, 34 deletions
diff --git a/src/plugins/ioam/analyse/ioam_analyse.h b/src/plugins/ioam/analyse/ioam_analyse.h
index b7576012..3e04c1ca 100644
--- a/src/plugins/ioam/analyse/ioam_analyse.h
+++ b/src/plugins/ioam/analyse/ioam_analyse.h
@@ -127,7 +127,8 @@ always_inline f64
ip6_ioam_analyse_calc_delay (ioam_trace_hdr_t * trace, u16 trace_len,
u8 oneway)
{
- u16 size_of_traceopt_per_node, size_of_all_traceopts;
+ u16 size_of_all_traceopts;
+ u8 size_of_traceopt_per_node;
u8 num_nodes;
u32 *start_elt, *end_elt, *uturn_elt;;
u32 start_time, end_time;
@@ -140,13 +141,15 @@ ip6_ioam_analyse_calc_delay (ioam_trace_hdr_t * trace, u16 trace_len,
size_of_all_traceopts = trace_len; /*ioam_trace_type,data_list_elts_left */
num_nodes = (u8) (size_of_all_traceopts / size_of_traceopt_per_node);
+ if ((num_nodes == 0) || (num_nodes <= trace->data_list_elts_left))
+ return 0;
num_nodes -= trace->data_list_elts_left;
start_elt = trace->elts;
end_elt =
trace->elts +
- (u32) (size_of_traceopt_per_node * (num_nodes - 1) / sizeof (u32));
+ (u32) ((size_of_traceopt_per_node / sizeof (u32)) * (num_nodes - 1));
if (oneway && (trace->ioam_trace_type & BIT_TTL_NODEID))
{
@@ -225,6 +228,9 @@ ip6_ioam_analyse_hbh_trace_loopback (ioam_analyser_data_t * data,
trace_data = &data->trace_data;
size_of_traceopt_per_node = fetch_trace_data_size (trace->ioam_trace_type);
+ if (0 == size_of_traceopt_per_node)
+ goto end;
+
size_of_all_traceopts = trace_len;
ptr = (u8 *) trace->elts;
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 17fcf7a5..9a2667f6 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -318,7 +318,6 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
tp = vlib_buffer_get_current (b0);
ip = &tp->ip4;
- udp = &tp->udp;
h = &tp->ipfix.h;
s = &tp->ipfix.s;
diff --git a/src/plugins/ioam/encap/ip6_ioam_trace.c b/src/plugins/ioam/encap/ip6_ioam_trace.c
index e3182561..2cd1044f 100644
--- a/src/plugins/ioam/encap/ip6_ioam_trace.c
+++ b/src/plugins/ioam/encap/ip6_ioam_trace.c
@@ -209,7 +209,7 @@ always_inline void
ip6_hbh_ioam_loopback_handler (vlib_buffer_t * b, ip6_header_t * ip,
ioam_trace_option_t * trace)
{
- u32 buffers;
+ u32 buf_index;
ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
vlib_buffer_t *b0;
vlib_frame_t *nf = 0;
@@ -218,7 +218,6 @@ ip6_hbh_ioam_loopback_handler (vlib_buffer_t * b, ip6_header_t * ip,
ip6_header_t *ip6;
ip6_hop_by_hop_header_t *hbh;
ioam_trace_option_t *opt;
- u16 ip6_len;
udp_ping_t *udp;
next_node = vlib_get_node_by_name (hm->vlib_main, (u8 *) "ip6-lookup");
@@ -226,36 +225,22 @@ ip6_hbh_ioam_loopback_handler (vlib_buffer_t * b, ip6_header_t * ip,
nf->n_vectors = 0;
to_next = vlib_frame_vector_args (nf);
- if (vlib_buffer_alloc (hm->vlib_main, &buffers, 1) != 1)
- return;
-
- b0 = vlib_get_buffer (hm->vlib_main, buffers);
- ip6_len = clib_net_to_host_u16 (ip->payload_length);
- clib_memcpy (b0->data, ip, (ip6_len + sizeof (ip6_header_t)));
- b0->current_data = 0;
- b0->current_length = ip6_len + sizeof (ip6_header_t);
- b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
+ b0 = vlib_buffer_copy (hm->vlib_main, b);
+ buf_index = vlib_get_buffer_index (hm->vlib_main, b0);
vnet_buffer (b0)->sw_if_index[VLIB_RX] = 0;
vnet_buffer (b0)->sw_if_index[VLIB_TX] = ~0;
- /* Change destination address */
ip6 = vlib_buffer_get_current (b0);
- //ip6->src_address = ip->dst_address;
- //ip6->dst_address = ip->src_address;
-
hbh = (ip6_hop_by_hop_header_t *) (ip6 + 1);
opt = (ioam_trace_option_t *)
ip6_hbh_get_option (hbh, HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST);
udp = (udp_ping_t *) ((u8 *) hbh + ((hbh->length + 1) << 3));
udp_ping_create_reply_from_probe_ip6 (ip6, hbh, udp);
- //ip6_hbh_ioam_trace_reset_bit (opt, BIT_LOOPBACK);
ip6_hbh_ioam_trace_set_bit (opt, BIT_LOOPBACK_REPLY);
- /* No need to trace loopback packet */
- //opt->trace_hdr.data_list_elts_left = 0;
- *to_next = buffers;
+ *to_next = buf_index;
nf->n_vectors++;
to_next++;
diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h
index aa88d58d..75ec784b 100644
--- a/src/plugins/ioam/ip6/ioam_cache.h
+++ b/src/plugins/ioam/ip6/ioam_cache.h
@@ -203,8 +203,8 @@ typedef struct
ioam_cache_main_t ioam_cache_main;
-vlib_node_registration_t ioam_cache_node;
-vlib_node_registration_t ioam_cache_ts_node;
+extern vlib_node_registration_t ioam_cache_node;
+extern vlib_node_registration_t ioam_cache_ts_node;
/* Compute flow hash. We'll use it to select which Sponge to use for this
* flow. And other things.
@@ -484,16 +484,21 @@ format_ioam_cache_entry (u8 * s, va_list * args)
{
ioam_cache_entry_t *e = va_arg (*args, ioam_cache_entry_t *);
ioam_cache_main_t *cm = &ioam_cache_main;
+ int rewrite_len = vec_len (e->ioam_rewrite_string);
s = format (s, "%d: %U:%d to %U:%d seq_no %lu\n",
(e - cm->ioam_rewrite_pool),
format_ip6_address, &e->src_address,
e->src_port,
format_ip6_address, &e->dst_address, e->dst_port, e->seq_no);
- s = format (s, " %U",
- format_ip6_hop_by_hop_ext_hdr,
- (ip6_hop_by_hop_header_t *) e->ioam_rewrite_string,
- vec_len (e->ioam_rewrite_string) - 1);
+
+ if (rewrite_len)
+ {
+ s = format (s, " %U",
+ format_ip6_hop_by_hop_ext_hdr,
+ (ip6_hop_by_hop_header_t *) e->ioam_rewrite_string,
+ rewrite_len - 1);
+ }
return s;
}
@@ -795,7 +800,10 @@ format_ioam_cache_ts_entry (u8 * s, va_list * args)
vlib_main_t *vm = cm->vlib_main;
clib_time_t *ct = &vm->clib_time;
- if (e && e->hbh)
+ if (!e)
+ goto end;
+
+ if (e->hbh)
{
e2e =
ip6_ioam_find_hbh_option (e->hbh,
@@ -826,6 +834,8 @@ format_ioam_cache_ts_entry (u8 * s, va_list * args)
vm->cpu_time_main_loop_start) * ct->seconds_per_clock,
e->response_received);
}
+
+end:
return s;
}
diff --git a/src/plugins/ioam/ip6/ioam_cache_node.c b/src/plugins/ioam/ip6/ioam_cache_node.c
index 6c8a038a..d930f339 100644
--- a/src/plugins/ioam/ip6/ioam_cache_node.c
+++ b/src/plugins/ioam/ip6/ioam_cache_node.c
@@ -67,8 +67,6 @@ format_cache_trace (u8 * s, va_list * args)
return s;
}
-vlib_node_registration_t ioam_cache_node;
-
#define foreach_cache_error \
_(RECORDED, "ip6 iOAM headers cached")
diff --git a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c
index 3df9871e..a56dc040 100644
--- a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c
+++ b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c
@@ -67,8 +67,6 @@ format_cache_ts_trace (u8 * s, va_list * args)
return s;
}
-vlib_node_registration_t ioam_cache_ts_node;
-
#define foreach_cache_ts_error \
_(RECORDED, "ip6 iOAM headers cached")
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index ce62d98f..ce64b606 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -85,7 +85,6 @@ udp_ping_send_flows (flow_report_main_t * frm, flow_report_t * fr,
tp = vlib_buffer_get_current (b0);
ip = &tp->ip4;
- udp = &tp->udp;
h = &tp->ipfix.h;
s = &tp->ipfix.s;
@@ -228,10 +227,12 @@ udp_ping_flow_create (u8 del)
u32 domain_id = 0;
flow_report_main_t *frm = &flow_report_main;
+ memset (&args, 0, sizeof (args));
args.rewrite_callback = udp_ping_template_rewrite;
args.flow_data_callback = udp_ping_send_flows;
del ? (args.is_add = 0) : (args.is_add = 1);
args.domain_id = domain_id;
+ args.src_port = UDP_DST_PORT_ipfix;
rv = vnet_flow_report_add_del (frm, &args);
diff --git a/src/plugins/ioam/udp-ping/udp_ping_node.c b/src/plugins/ioam/udp-ping/udp_ping_node.c
index 4de8fe2f..84759b0f 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_node.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_node.c
@@ -429,7 +429,18 @@ udp_ping_analyse_hbh (vlib_buffer_t * b0,
ioam_e2e_option_t *e2e;
ioam_trace_option_t *trace;
+ /* If the packet doesnt match UDP session then return */
+ if (PREDICT_FALSE (pool_is_free_index (udp_ping_main.ip46_flow, flow_id)))
+ return;
+
ip46_flow = udp_ping_main.ip46_flow + flow_id;
+ /* Check port is within range */
+ if (PREDICT_FALSE ((src_port < ip46_flow->udp_data.start_src_port) ||
+ (src_port > ip46_flow->udp_data.end_src_port) ||
+ (dst_port < ip46_flow->udp_data.start_dst_port) ||
+ (dst_port > ip46_flow->udp_data.end_dst_port)))
+ return;
+
flow_index = (src_port - ip46_flow->udp_data.start_src_port) *
(ip46_flow->udp_data.end_dst_port - ip46_flow->udp_data.start_dst_port +
1);