aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ioam
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src/plugins/ioam
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c4
-rw-r--r--src/plugins/ioam/encap/ip6_ioam_pot.c2
-rw-r--r--src/plugins/ioam/encap/ip6_ioam_trace.c2
-rw-r--r--src/plugins/ioam/export-common/ioam_export.h6
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.c2
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.h12
-rw-r--r--src/plugins/ioam/lib-e2e/ioam_seqno_lib.h7
-rw-r--r--src/plugins/ioam/lib-pot/pot_util.c4
-rw-r--r--src/plugins/ioam/lib-trace/trace_util.c2
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c2
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c4
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c6
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c2
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c2
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_test.c2
15 files changed, 30 insertions, 29 deletions
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 440dcca8369..c16e8398bd3 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -288,7 +288,7 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
stream = &frm->streams[fr->stream_index];
- memset (&temp, 0, sizeof (ip6_address_t));
+ clib_memset (&temp, 0, sizeof (ip6_address_t));
aggregated_data = ioam_analyser_main.aggregated_data;
data_len = vec_len (aggregated_data);
@@ -402,7 +402,7 @@ ioam_flow_create (u8 del)
flow_report_main_t *frm = &flow_report_main;
u16 template_id;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
args.rewrite_callback = ioam_template_rewrite;
args.flow_data_callback = ioam_send_flows;
del ? (args.is_add = 0) : (args.is_add = 1);
diff --git a/src/plugins/ioam/encap/ip6_ioam_pot.c b/src/plugins/ioam/encap/ip6_ioam_pot.c
index 9a76123330d..8dd06c144e3 100644
--- a/src/plugins/ioam/encap/ip6_ioam_pot.c
+++ b/src/plugins/ioam/encap/ip6_ioam_pot.c
@@ -242,7 +242,7 @@ ip6_hop_by_hop_ioam_pot_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main();
- memset(hm->counters, 0, sizeof(hm->counters));
+ clib_memset(hm->counters, 0, sizeof(hm->counters));
if (ip6_hbh_register_option(HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT, ip6_hbh_ioam_proof_of_transit_handler,
ip6_hbh_ioam_proof_of_transit_trace_handler) < 0)
diff --git a/src/plugins/ioam/encap/ip6_ioam_trace.c b/src/plugins/ioam/encap/ip6_ioam_trace.c
index 3ec3ea82113..148d566e65e 100644
--- a/src/plugins/ioam/encap/ip6_ioam_trace.c
+++ b/src/plugins/ioam/encap/ip6_ioam_trace.c
@@ -430,7 +430,7 @@ ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main ();
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (ip6_hbh_register_option
diff --git a/src/plugins/ioam/export-common/ioam_export.h b/src/plugins/ioam/export-common/ioam_export.h
index 6e640951802..511cb88a73b 100644
--- a/src/plugins/ioam/export-common/ioam_export.h
+++ b/src/plugins/ioam/export-common/ioam_export.h
@@ -187,7 +187,7 @@ ioam_export_thread_buffer_init (ioam_export_main_t * em, vlib_main_t * vm)
{
eb = 0;
pool_get_aligned (em->buffer_pool, eb, CLIB_CACHE_LINE_BYTES);
- memset (eb, 0, sizeof (*eb));
+ clib_memset (eb, 0, sizeof (*eb));
em->buffer_per_thread[i] = eb - em->buffer_pool;
if (ioam_export_init_buffer (em, vm, eb) != 1)
{
@@ -196,7 +196,7 @@ ioam_export_thread_buffer_init (ioam_export_main_t * em, vlib_main_t * vm)
}
em->lockp[i] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) em->lockp[i], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) em->lockp[i], 0, CLIB_CACHE_LINE_BYTES);
}
return (1);
}
@@ -412,7 +412,7 @@ ioam_export_process_common (ioam_export_main_t * em, vlib_main_t * vm,
{
pool_get_aligned (em->buffer_pool, new_eb,
CLIB_CACHE_LINE_BYTES);
- memset (new_eb, 0, sizeof (*new_eb));
+ clib_memset (new_eb, 0, sizeof (*new_eb));
if (ioam_export_init_buffer (em, vm, new_eb) == 1)
{
new_pool_index = new_eb - em->buffer_pool;
diff --git a/src/plugins/ioam/ip6/ioam_cache.c b/src/plugins/ioam/ip6/ioam_cache.c
index e2f878a5f77..fcacae0cf2c 100644
--- a/src/plugins/ioam/ip6/ioam_cache.c
+++ b/src/plugins/ioam/ip6/ioam_cache.c
@@ -381,7 +381,7 @@ ioam_cache_init (vlib_main_t * vm)
name = format (0, "ioam_cache_%08x%c", api_version, 0);
- memset (&ioam_cache_main, 0, sizeof (ioam_cache_main));
+ clib_memset (&ioam_cache_main, 0, sizeof (ioam_cache_main));
/* Ask for a correctly-sized block of API message decode slots */
em->msg_id_base = vl_msg_api_get_msg_ids
((char *) name, VL_MSG_FIRST_AVAILABLE);
diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h
index 3a3cf6a620e..717aaf11b8f 100644
--- a/src/plugins/ioam/ip6/ioam_cache.h
+++ b/src/plugins/ioam/ip6/ioam_cache.h
@@ -299,7 +299,7 @@ ioam_cache_entry_free (ioam_cache_entry_t * entry)
if (entry)
{
vec_free (entry->ioam_rewrite_string);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
pool_put (cm->ioam_rewrite_pool, entry);
}
}
@@ -371,7 +371,7 @@ ioam_cache_add (vlib_buffer_t * b0,
ioam_e2e_id_option_t *e2e = 0;
pool_get_aligned (cm->ioam_rewrite_pool, entry, CLIB_CACHE_LINE_BYTES);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
pool_index = entry - cm->ioam_rewrite_pool;
clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64,
@@ -437,7 +437,7 @@ ioam_cache_sr_rewrite_template_create (void)
/* This nodes address and the original dest will be
* filled when the packet is processed */
vec_add2 (segments, this_seg, 1);
- memset (this_seg, 0xfe, sizeof (ip6_address_t));
+ clib_memset (this_seg, 0xfe, sizeof (ip6_address_t));
cm->sr_rewrite_template = ip6_sr_compute_rewrite_string_insert (segments);
vec_free (segments);
}
@@ -540,7 +540,7 @@ ioam_cache_ts_table_init (vlib_main_t * vm)
{
pool_alloc_aligned (cm->ioam_ts_pool[i],
MAX_CACHE_TS_ENTRIES, CLIB_CACHE_LINE_BYTES);
- memset (&cm->ts_stats[i], 0, sizeof (ioam_cache_ts_pool_stats_t));
+ clib_memset (&cm->ts_stats[i], 0, sizeof (ioam_cache_ts_pool_stats_t));
tw_timer_wheel_init_16t_2w_512sl (&cm->timer_wheels[i],
expired_cache_ts_timer_callback,
IOAM_CACHE_TS_TICK
@@ -592,7 +592,7 @@ ioam_cache_ts_entry_free (u32 thread_id,
}
pool_put (cm->ioam_ts_pool[thread_id], entry);
cm->ts_stats[thread_id].inuse--;
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
}
}
@@ -654,7 +654,7 @@ ioam_cache_ts_add (ip6_header_t * ip0,
pool_get_aligned (cm->ioam_ts_pool[thread_id], entry,
CLIB_CACHE_LINE_BYTES);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
*pool_index = entry - cm->ioam_ts_pool[thread_id];
clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64,
diff --git a/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h b/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
index 6bd38ff2968..31a7431c401 100644
--- a/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
+++ b/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
@@ -138,7 +138,7 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
else
{
seqno_rx->lost_packets += diff - 1;
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
}
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
@@ -151,7 +151,7 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
{
if (seqno_check_wraparound (bitmap->highest, seqno))
{
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
return;
@@ -162,7 +162,8 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
if (peer_dead_count > 25)
{
peer_dead_count = 0;
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0,
+ bitmap->array_size * sizeof (u64));
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
}
diff --git a/src/plugins/ioam/lib-pot/pot_util.c b/src/plugins/ioam/lib-pot/pot_util.c
index a253ad4130f..2fe9ce97f4e 100644
--- a/src/plugins/ioam/lib-pot/pot_util.c
+++ b/src/plugins/ioam/lib-pot/pot_util.c
@@ -50,7 +50,7 @@ static void pot_profile_init(pot_profile * new, u8 id)
{
if (new)
{
- memset(new, 0, sizeof(pot_profile));
+ clib_memset(new, 0, sizeof(pot_profile));
new->id = id;
}
}
@@ -110,7 +110,7 @@ static void pot_profile_cleanup(pot_profile * profile)
{
u16 id = profile->id;
- memset(profile, 0, sizeof(pot_profile));
+ clib_memset(profile, 0, sizeof(pot_profile));
profile->id = id; /* Restore id alone */
}
diff --git a/src/plugins/ioam/lib-trace/trace_util.c b/src/plugins/ioam/lib-trace/trace_util.c
index b316a236286..af92513685f 100644
--- a/src/plugins/ioam/lib-trace/trace_util.c
+++ b/src/plugins/ioam/lib-trace/trace_util.c
@@ -26,7 +26,7 @@ static int
trace_profile_cleanup (trace_profile * profile)
{
- memset (profile, 0, sizeof (trace_profile));
+ clib_memset (profile, 0, sizeof (trace_profile));
profile->trace_tsp = TSP_MICROSECONDS; /* Micro seconds */
ip6_trace_profile_cleanup (); /* lib-trace_TODO: Remove this once IOAM-IPv6 transport is a plugin */
return 0;
diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
index 60eabc22019..7567f31caf2 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
@@ -120,7 +120,7 @@ vxlan_gpe_transit_ioam (vlib_main_t * vm,
uword *t = NULL;
vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main;
fib_prefix_t key4;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = ip0->dst_address.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
index 870764eb971..2d9c6bfab3d 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
@@ -249,7 +249,7 @@ static void vl_api_vxlan_gpe_ioam_transit_enable_t_handler
vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
ip46_address_t dst_addr;
- memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
+ clib_memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
if (!mp->is_ipv6)
{
clib_memcpy (&dst_addr.ip4, &mp->dst_addr, sizeof (dst_addr.ip4));
@@ -271,7 +271,7 @@ static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler
vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
ip46_address_t dst_addr;
- memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
+ clib_memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
if (!mp->is_ipv6)
{
clib_memcpy (&dst_addr.ip4, &mp->dst_addr, sizeof (dst_addr.ip4));
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
index 8558c505a43..5a59e75bf01 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
@@ -222,7 +222,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
if (is_ipv4)
{
- memset (&fib_prefix, 0, sizeof (fib_prefix_t));
+ clib_memset (&fib_prefix, 0, sizeof (fib_prefix_t));
fib_prefix.fp_len = 32;
fib_prefix.fp_proto = FIB_PROTOCOL_IP4;
fib_prefix.fp_addr = dst_addr;
@@ -303,7 +303,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
vxlan_gpe_ioam_dest_tunnels_t *t1;
fib_prefix_t key4, *key4_copy;
hash_pair_t *hp;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
@@ -314,7 +314,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
return 0;
}
pool_get_aligned (hm->dst_tunnels, t1, CLIB_CACHE_LINE_BYTES);
- memset (t1, 0, sizeof (*t1));
+ clib_memset (t1, 0, sizeof (*t1));
t1->fp_proto = FIB_PROTOCOL_IP4;
t1->dst_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
key4_copy = clib_mem_alloc (sizeof (*key4_copy));
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
index e758b522ba0..e2c130c00df 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
@@ -449,7 +449,7 @@ vxlan_gpe_ioam_trace_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main ();
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (vxlan_gpe_ioam_register_option
(VXLAN_GPE_OPTION_TYPE_IOAM_TRACE,
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 73835919dd9..7a7cad4934a 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -231,7 +231,7 @@ udp_ping_flow_create (u8 del)
flow_report_main_t *frm = &flow_report_main;
u16 template_id;
- memset (&args, 0, sizeof (args));
+ clib_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);
diff --git a/src/plugins/ioam/udp-ping/udp_ping_test.c b/src/plugins/ioam/udp-ping/udp_ping_test.c
index 9a5375cda0d..9c795969d51 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_test.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_test.c
@@ -95,7 +95,7 @@ _(UDP_PING_EXPORT_REPLY, udp_ping_export_reply) \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);