aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/classify/vnet_classify.c14
-rw-r--r--vnet/vnet/lisp-gpe/ip_forward.c1
-rw-r--r--vnet/vnet/map/map.c6
-rw-r--r--vnet/vnet/policer/xlate.c4
-rw-r--r--vpp-api-test/vat/api_format.c2
-rw-r--r--vpp/vpp-api/api.c182
-rw-r--r--vppinfra/vppinfra/elf.c2
7 files changed, 96 insertions, 115 deletions
diff --git a/vnet/vnet/classify/vnet_classify.c b/vnet/vnet/classify/vnet_classify.c
index 23aa51592c2..3b75ab5dc67 100644
--- a/vnet/vnet/classify/vnet_classify.c
+++ b/vnet/vnet/classify/vnet_classify.c
@@ -980,8 +980,11 @@ uword unformat_classify_mask (unformat_input_t * input, va_list * args)
if (l2 == 0)
vec_validate (l2, 13);
mask = l2;
- vec_append (mask, l3);
- vec_free (l3);
+ if (l3)
+ {
+ vec_append (mask, l3);
+ vec_free (l3);
+ }
}
/* Scan forward looking for the first significant mask octet */
@@ -1715,8 +1718,11 @@ uword unformat_classify_match (unformat_input_t * input, va_list * args)
if (l2 == 0)
vec_validate_aligned (l2, 13, sizeof(u32x4));
match = l2;
- vec_append_aligned (match, l3, sizeof(u32x4));
- vec_free (l3);
+ if (l3)
+ {
+ vec_append_aligned (match, l3, sizeof(u32x4));
+ vec_free (l3);
+ }
}
/* Make sure the vector is big enough even if key is all 0's */
diff --git a/vnet/vnet/lisp-gpe/ip_forward.c b/vnet/vnet/lisp-gpe/ip_forward.c
index 47f3f7b3755..98c52226280 100644
--- a/vnet/vnet/lisp-gpe/ip_forward.c
+++ b/vnet/vnet/lisp-gpe/ip_forward.c
@@ -162,6 +162,7 @@ ip4_sd_fib_clear_src_fib (lisp_gpe_main_t * lgm, ip4_fib_t * fib)
ip4_route_t x;
x.address_length = i;
+ x.index = 0; /* shut up coverity */
hash_foreach_pair (p, hash,
({
diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c
index 8236811f8b1..93a10c679f0 100644
--- a/vnet/vnet/map/map.c
+++ b/vnet/vnet/map/map.c
@@ -511,10 +511,10 @@ map_add_domain_command_fn (vlib_main_t * vm,
ip4_address_t ip4_prefix;
ip6_address_t ip6_prefix;
ip6_address_t ip6_src;
- u32 ip6_prefix_len, ip4_prefix_len, map_domain_index, ip6_src_len;
+ u32 ip6_prefix_len = 0, ip4_prefix_len = 0, map_domain_index, ip6_src_len;
u32 num_m_args = 0;
/* Optional arguments */
- u32 ea_bits_len, psid_offset = 0, psid_length = 0;
+ u32 ea_bits_len = 0, psid_offset = 0, psid_length = 0;
u32 mtu = 0;
u8 flags = 0;
ip6_src_len = 128;
@@ -607,7 +607,7 @@ map_add_rule_command_fn (vlib_main_t * vm,
unformat_input_t _line_input, *line_input = &_line_input;
ip6_address_t tep;
u32 num_m_args = 0;
- u32 psid, map_domain_index;
+ u32 psid = 0, map_domain_index;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/vnet/vnet/policer/xlate.c b/vnet/vnet/policer/xlate.c
index 61976b1cbde..c9250eb8d87 100644
--- a/vnet/vnet/policer/xlate.c
+++ b/vnet/vnet/policer/xlate.c
@@ -1238,11 +1238,11 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st *hw,
return EINVAL;
}
- temp_rate = ((hw->avg_rate_man << hw->rate_exp) * 8LL *
+ temp_rate = (((uint64_t) hw->avg_rate_man << hw->rate_exp) * 8LL *
SSE2_QOS_POL_TICKS_PER_SEC)/1000;
cfg->rb.kbps.cir_kbps = (uint32_t)temp_rate;
- temp_rate = ((hw->peak_rate_man << hw->rate_exp) * 8LL *
+ temp_rate = (((uint64_t) hw->peak_rate_man << hw->rate_exp) * 8LL *
SSE2_QOS_POL_TICKS_PER_SEC)/1000;
cfg->rb.kbps.eir_kbps = (uint32_t)temp_rate;
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index cd65aaa8437..4ad447c1a61 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -10397,7 +10397,7 @@ api_ipsec_spd_add_del_entry (vat_main_t * vam)
f64 timeout;
u8 is_add = 1, is_outbound = 0, is_ipv6 = 0, is_ip_any = 1;
u32 spd_id = 0, sa_id = 0, protocol = 0, policy = 0;
- i32 priority;
+ i32 priority = 0;
u32 rport_start = 0, rport_stop = (u32) ~ 0;
u32 lport_start = 0, lport_stop = (u32) ~ 0;
ip4_address_t laddr4_start, laddr4_stop, raddr4_start, raddr4_stop;
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 4c87476ed51..3e3548d1460 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -7092,36 +7092,32 @@ send_mpls_gre_tunnel_entry (vpe_api_main_t * am,
mpls_gre_tunnel_t * gt, u32 index, u32 context)
{
vl_api_mpls_gre_tunnel_details_t *mp;
-
- mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_TUNNEL_DETAILS);
- mp->context = context;
-
- if (gt != NULL)
- {
- mp->tunnel_index = htonl (index);
- mp->tunnel_src = gt->tunnel_src.as_u32;
- mp->tunnel_dst = gt->tunnel_dst.as_u32;
- mp->intfc_address = gt->intfc_address.as_u32;
- mp->mask_width = htonl (gt->mask_width);
- mp->inner_fib_index = htonl (gt->inner_fib_index);
- mp->outer_fib_index = htonl (gt->outer_fib_index);
- mp->encap_index = htonl (gt->encap_index);
- mp->hw_if_index = htonl (gt->hw_if_index);
- mp->l2_only = htonl (gt->l2_only);
- }
-
mpls_main_t *mm = &mpls_main;
mpls_encap_t *e;
int i;
- u32 len = 0;
+ u32 nlabels;
e = pool_elt_at_index (mm->encaps, gt->encap_index);
- len = vec_len (e->labels);
- mp->nlabels = htonl (len);
+ nlabels = vec_len (e->labels);
- for (i = 0; i < len; i++)
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_TUNNEL_DETAILS);
+ mp->context = context;
+
+ mp->tunnel_index = htonl (index);
+ mp->tunnel_src = gt->tunnel_src.as_u32;
+ mp->tunnel_dst = gt->tunnel_dst.as_u32;
+ mp->intfc_address = gt->intfc_address.as_u32;
+ mp->mask_width = htonl (gt->mask_width);
+ mp->inner_fib_index = htonl (gt->inner_fib_index);
+ mp->outer_fib_index = htonl (gt->outer_fib_index);
+ mp->encap_index = htonl (gt->encap_index);
+ mp->hw_if_index = htonl (gt->hw_if_index);
+ mp->l2_only = htonl (gt->l2_only);
+ mp->nlabels = htonl (nlabels);
+
+ for (i = 0; i < nlabels; i++)
{
mp->labels[i] =
htonl (vnet_mpls_uc_get_label
@@ -7136,7 +7132,6 @@ vl_api_mpls_gre_tunnel_dump_t_handler (vl_api_mpls_gre_tunnel_dump_t * mp)
{
vpe_api_main_t *am = &vpe_api_main;
unix_shared_memory_queue_t *q;
- vlib_main_t *vm = &vlib_global_main;
mpls_main_t *mm = &mpls_main;
mpls_gre_tunnel_t *gt;
u32 index = ntohl (mp->tunnel_index);
@@ -7145,30 +7140,24 @@ vl_api_mpls_gre_tunnel_dump_t_handler (vl_api_mpls_gre_tunnel_dump_t * mp)
if (q == 0)
return;
- if (pool_elts (mm->gre_tunnels))
+ if (index != ~0)
{
- if (mp->tunnel_index >= 0)
- {
- vlib_cli_output (vm, "MPLS-GRE tunnel %u", index);
- gt = pool_elt_at_index (mm->gre_tunnels, index);
- send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
- mp->context);
- }
- else
- {
- vlib_cli_output (vm, "MPLS-GRE tunnels");
- /* *INDENT-OFF* */
- pool_foreach (gt, mm->gre_tunnels,
- ({
- send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
- mp->context);
- }));
- /* *INDENT-ON* */
- }
+ if (!pool_is_free_index (mm->gre_tunnels, index))
+ {
+ gt = pool_elt_at_index (mm->gre_tunnels, index);
+ send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
+ mp->context);
+ }
}
else
{
- vlib_cli_output (vm, "No MPLS-GRE tunnels");
+ /* *INDENT-OFF* */
+ pool_foreach (gt, mm->gre_tunnels,
+ ({
+ send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
+ mp->context);
+ }));
+ /* *INDENT-ON* */
}
}
@@ -7184,36 +7173,32 @@ send_mpls_eth_tunnel_entry (vpe_api_main_t * am,
unix_shared_memory_queue_t * q,
mpls_eth_tunnel_t * et, u32 index, u32 context)
{
+ mpls_main_t *mm = &mpls_main;
+ mpls_encap_t *e;
+ int i;
+ u32 nlabels;
vl_api_mpls_eth_tunnel_details_t *mp;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ e = pool_elt_at_index (mm->encaps, et->encap_index);
+ nlabels = vec_len (e->labels);
+
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels*sizeof(u32));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_ETH_TUNNEL_DETAILS);
mp->context = context;
- if (et != NULL)
- {
- mp->tunnel_index = htonl (index);
- memcpy (mp->tunnel_dst_mac, et->tunnel_dst, 6);
- mp->intfc_address = et->intfc_address.as_u32;
- mp->tx_sw_if_index = htonl (et->tx_sw_if_index);
- mp->inner_fib_index = htonl (et->inner_fib_index);
- mp->mask_width = htonl (et->mask_width);
- mp->encap_index = htonl (et->encap_index);
- mp->hw_if_index = htonl (et->hw_if_index);
- mp->l2_only = htonl (et->l2_only);
- }
+ mp->tunnel_index = htonl (index);
+ memcpy (mp->tunnel_dst_mac, et->tunnel_dst, 6);
+ mp->intfc_address = et->intfc_address.as_u32;
+ mp->tx_sw_if_index = htonl (et->tx_sw_if_index);
+ mp->inner_fib_index = htonl (et->inner_fib_index);
+ mp->mask_width = htonl (et->mask_width);
+ mp->encap_index = htonl (et->encap_index);
+ mp->hw_if_index = htonl (et->hw_if_index);
+ mp->l2_only = htonl (et->l2_only);
+ mp->nlabels = htonl (nlabels);
- mpls_main_t *mm = &mpls_main;
- mpls_encap_t *e;
- int i;
- u32 len = 0;
-
- e = pool_elt_at_index (mm->encaps, et->encap_index);
- len = vec_len (e->labels);
- mp->nlabels = htonl (len);
-
- for (i = 0; i < len; i++)
+ for (i = 0; i < nlabels; i++)
{
mp->labels[i] =
htonl (vnet_mpls_uc_get_label
@@ -7228,7 +7213,6 @@ vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp)
{
vpe_api_main_t *am = &vpe_api_main;
unix_shared_memory_queue_t *q;
- vlib_main_t *vm = &vlib_global_main;
mpls_main_t *mm = &mpls_main;
mpls_eth_tunnel_t *et;
u32 index = ntohl (mp->tunnel_index);
@@ -7237,34 +7221,24 @@ vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp)
if (q == 0)
return;
- clib_warning ("Received mpls_eth_tunnel_dump");
- clib_warning ("Received tunnel index: %u from client %u", index,
- mp->client_index);
-
- if (pool_elts (mm->eth_tunnels))
+ if (index != ~0)
{
- if (mp->tunnel_index >= 0)
- {
- vlib_cli_output (vm, "MPLS-Ethernet tunnel %u", index);
- et = pool_elt_at_index (mm->eth_tunnels, index);
- send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
- mp->context);
- }
- else
- {
- clib_warning ("MPLS-Ethernet tunnels");
- /* *INDENT-OFF* */
- pool_foreach (et, mm->eth_tunnels,
- ({
- send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
- mp->context);
- }));
- /* *INDENT-ON* */
- }
+ if (!pool_is_free_index(mm->eth_tunnels, index))
+ {
+ et = pool_elt_at_index (mm->eth_tunnels, index);
+ send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
+ mp->context);
+ }
}
else
{
- clib_warning ("No MPLS-Ethernet tunnels");
+ /* *INDENT-OFF* */
+ pool_foreach (et, mm->eth_tunnels,
+ ({
+ send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
+ mp->context);
+ }));
+ /* *INDENT-ON* */
}
}
@@ -7280,8 +7254,15 @@ send_mpls_fib_encap_details (vpe_api_main_t * am,
show_mpls_fib_t * s, u32 context)
{
vl_api_mpls_fib_encap_details_t *mp;
+ mpls_main_t *mm = &mpls_main;
+ mpls_encap_t *e;
+ int i;
+ u32 nlabels;
- mp = vl_msg_api_alloc (sizeof (*mp));
+ e = pool_elt_at_index (mm->encaps, s->entry_index);
+ nlabels = vec_len (e->labels);
+
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_ENCAP_DETAILS);
mp->context = context;
@@ -7291,16 +7272,9 @@ send_mpls_fib_encap_details (vpe_api_main_t * am,
mp->dest = s->dest;
mp->s_bit = htonl (s->s_bit);
- mpls_main_t *mm = &mpls_main;
- mpls_encap_t *e;
- int i;
- u32 len = 0;
-
- e = pool_elt_at_index (mm->encaps, s->entry_index);
- len = vec_len (e->labels);
- mp->nlabels = htonl (len);
+ mp->nlabels = htonl (nlabels);
- for (i = 0; i < len; i++)
+ for (i = 0; i < nlabels; i++)
{
mp->labels[i] =
htonl (vnet_mpls_uc_get_label
@@ -8160,7 +8134,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
{
/* lookup the username */
pw = NULL;
- while (((rv = getpwnam_r (s, &_pw, buf, sizeof (buf), &pw)) == ERANGE) && ( vec_len(buf) <= max_buf_size ))
+ while (((rv = getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE) && ( vec_len(buf) <= max_buf_size ))
{
vec_resize(buf,vec_len(buf)*2);
}
diff --git a/vppinfra/vppinfra/elf.c b/vppinfra/vppinfra/elf.c
index 8c5dc6c33e0..63c17ec382e 100644
--- a/vppinfra/vppinfra/elf.c
+++ b/vppinfra/vppinfra/elf.c
@@ -582,7 +582,7 @@ format_elf_main (u8 * s, va_list * args)
s = format (s, "\nSegments: %d at file offset 0x%Lx-0x%Lx:\n",
fh->segment_header_count,
fh->segment_header_file_offset,
- (u64) fh->segment_header_file_offset + fh->segment_header_count * fh->segment_header_size);
+ (u64) fh->segment_header_file_offset + (u64) fh->segment_header_count * (u64) fh->segment_header_size);
s = format (s, "%U\n", format_elf_segment, 0);
vec_foreach (h, copy)