aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam/ip6
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/ip6
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/ip6')
-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
3 files changed, 17 insertions, 11 deletions
diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h
index aa88d58d8a8..75ec784bf52 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 6c8a038a4c1..d930f3395dc 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 3df9871e5f6..a56dc040e82 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")