aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/udp-ping
diff options
context:
space:
mode:
authorAkshayaNadahalli <anadahal@cisco.com>2017-03-10 18:38:13 +0000
committerDave Barach <openvpp@barachs.net>2017-03-14 12:01:05 +0000
commitb20dd1ba714c0b6de78abfe05dbee5b076cdac72 (patch)
treedbc1f4ec8d7626070764c3315e66945f54ffc470 /src/plugins/ioam/udp-ping
parenta38e0f0d14cfe633318c23d8940f2140cb2b2320 (diff)
IOAM Coverity fix
Coverity IDs - 163911, 163910, 163909, 163908, 163905, 163904, 163896, 161957, 161955 Change-Id: Ida822fa45c6936240f61282e2280541d7e6427b3 Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
Diffstat (limited to 'src/plugins/ioam/udp-ping')
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c3
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_node.c11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index ce62d98f861..ce64b606f1f 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 4de8fe2f894..84759b0fab8 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);