summaryrefslogtreecommitdiffstats
path: root/src/plugins
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
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/abf/abf_api.c4
-rw-r--r--src/plugins/acl/acl.c90
-rw-r--r--src/plugins/acl/acl_test.c12
-rw-r--r--src/plugins/acl/hash_lookup.c18
-rw-r--r--src/plugins/acl/public_inlines.h2
-rw-r--r--src/plugins/avf/avf_api.c2
-rw-r--r--src/plugins/avf/avf_test.c2
-rw-r--r--src/plugins/avf/cli.c2
-rw-r--r--src/plugins/avf/device.c20
-rw-r--r--src/plugins/cdp/cdp_input.c2
-rw-r--r--src/plugins/cdp/cdp_periodic.c16
-rw-r--r--src/plugins/dpdk/api/dpdk_test.c4
-rw-r--r--src/plugins/dpdk/buffer.c6
-rw-r--r--src/plugins/dpdk/device/common.c2
-rw-r--r--src/plugins/dpdk/device/flow.c12
-rw-r--r--src/plugins/dpdk/device/init.c4
-rw-r--r--src/plugins/dpdk/hqos/hqos.c4
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c6
-rw-r--r--src/plugins/flowprobe/flowprobe.c6
-rw-r--r--src/plugins/gbp/gbp_api.c10
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.c2
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.c2
-rw-r--r--src/plugins/gbp/gbp_recirc.c2
-rw-r--r--src/plugins/gtpu/gtpu.c8
-rw-r--r--src/plugins/gtpu/gtpu_api.c2
-rw-r--r--src/plugins/gtpu/gtpu_decap.c2
-rw-r--r--src/plugins/gtpu/gtpu_test.c4
-rw-r--r--src/plugins/igmp/igmp.c2
-rw-r--r--src/plugins/igmp/igmp_api.c10
-rw-r--r--src/plugins/igmp/igmp_group.c2
-rw-r--r--src/plugins/igmp/igmp_pkt.c6
-rw-r--r--src/plugins/igmp/igmp_proxy.c2
-rw-r--r--src/plugins/igmp/igmp_src.c2
-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
-rw-r--r--src/plugins/ixge/ixge.c14
-rw-r--r--src/plugins/l2e/l2e.c2
-rw-r--r--src/plugins/lacp/cli.c2
-rw-r--r--src/plugins/lacp/lacp.c4
-rw-r--r--src/plugins/lacp/lacp_api.c2
-rw-r--r--src/plugins/lb/lb.c2
-rw-r--r--src/plugins/mactime/mactime.c6
-rw-r--r--src/plugins/map/examples/health_check.c2
-rw-r--r--src/plugins/map/map.c16
-rw-r--r--src/plugins/map/map_api.c8
-rw-r--r--src/plugins/marvell/pp2/pp2.c2
-rw-r--r--src/plugins/memif/memif.c14
-rw-r--r--src/plugins/memif/memif_api.c4
-rw-r--r--src/plugins/memif/node.c2
-rw-r--r--src/plugins/memif/socket.c4
-rw-r--r--src/plugins/nat/dslite_in2out.c4
-rwxr-xr-xsrc/plugins/nat/nat.c10
-rw-r--r--src/plugins/nat/nat44_cli.c4
-rw-r--r--src/plugins/nat/nat64.c4
-rw-r--r--src/plugins/nat/nat64_db.c18
-rw-r--r--src/plugins/nat/nat64_in2out.c18
-rw-r--r--src/plugins/nat/nat64_out2in.c20
-rw-r--r--src/plugins/nat/nat66.c2
-rw-r--r--src/plugins/nat/nat_api.c56
-rw-r--r--src/plugins/nat/nat_det.c2
-rw-r--r--src/plugins/nat/nat_ipfix_logging.c2
-rw-r--r--src/plugins/nat/nat_test.c2
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c2
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c10
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c2
-rw-r--r--src/plugins/nsh/nsh.c26
-rw-r--r--src/plugins/nsh/nsh_test.c4
-rw-r--r--src/plugins/pppoe/pppoe.c8
-rw-r--r--src/plugins/pppoe/pppoe_api.c2
-rw-r--r--src/plugins/pppoe/pppoe_test.c2
-rw-r--r--src/plugins/srv6-ad/ad.c2
-rw-r--r--src/plugins/srv6-am/am.c2
-rw-r--r--src/plugins/srv6-as/as.c2
-rw-r--r--src/plugins/stn/stn_api.c2
-rw-r--r--src/plugins/svs/svs_api.c2
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c4
-rw-r--r--src/plugins/tlsopenssl/tls_async.c2
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c4
-rw-r--r--src/plugins/unittest/CMakeLists.txt1
-rw-r--r--src/plugins/unittest/string_test.c145
-rw-r--r--src/plugins/unittest/tcp_test.c16
-rw-r--r--src/plugins/vmxnet3/cli.c2
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c16
-rw-r--r--src/plugins/vmxnet3/vmxnet3_api.c4
-rw-r--r--src/plugins/vmxnet3/vmxnet3_test.c2
98 files changed, 482 insertions, 335 deletions
diff --git a/src/plugins/abf/abf_api.c b/src/plugins/abf/abf_api.c
index 958d129f8a4..0bf714bff89 100644
--- a/src/plugins/abf/abf_api.c
+++ b/src/plugins/abf/abf_api.c
@@ -82,7 +82,7 @@ vl_api_abf_plugin_get_version_t_handler (vl_api_abf_plugin_get_version_t * mp)
}
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_ABF_PLUGIN_GET_VERSION_REPLY + abf_base_msg_id);
rmp->context = mp->context;
@@ -176,7 +176,7 @@ abf_policy_send_details (u32 api, void *args)
msg_size = sizeof (*mp) + sizeof (mp->policy.paths[0]) * n_paths;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ABF_POLICY_DETAILS + abf_base_msg_id);
/* fill in the message */
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index 2af2d7a8b70..dbc658b3640 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -212,7 +212,7 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp)
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_ACL_PLUGIN_GET_VERSION_REPLY + am->msg_id_base);
rmp->context = mp->context;
@@ -390,7 +390,7 @@ acl_add_list (u32 count, vl_api_acl_rule_t rules[],
for (i = 0; i < count; i++)
{
r = vec_elt_at_index (acl_new_rules, i);
- memset (r, 0, sizeof (*r));
+ clib_memset (r, 0, sizeof (*r));
r->is_permit = rules[i].is_permit;
r->is_ipv6 = rules[i].is_ipv6;
if (r->is_ipv6)
@@ -418,7 +418,7 @@ acl_add_list (u32 count, vl_api_acl_rule_t rules[],
{
/* Get ACL index */
pool_get_aligned (am->acls, a, CLIB_CACHE_LINE_BYTES);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* Will return the newly allocated ACL index */
*acl_list_index = a - am->acls;
}
@@ -1105,7 +1105,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
*/
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
/* source MAC address */
memcpy (&mask[6], mt->mac_mask, 6);
@@ -1113,20 +1113,20 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
l3_offset = 14;
last_tag_table = &mt->arp_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
l3_offset = 18;
last_tag_table = &mt->arp_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
l3_offset = 22;
last_tag_table = &mt->arp_dot1ad_table_index;
break;
@@ -1151,26 +1151,26 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
if (mt->has_egress)
{
/* egress ARP table */
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
switch (tags)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
l3_offset = 14;
out_last_tag_table = &mt->out_arp_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
l3_offset = 18;
out_last_tag_table = &mt->out_arp_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
l3_offset = 22;
out_last_tag_table = &mt->out_arp_dot1ad_table_index;
break;
@@ -1207,25 +1207,25 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
*/
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
memcpy (&mask[6], mt->mac_mask, 6);
l3_src_offs = tags * 4 + get_l3_src_offset (is6);
switch (tags)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->dot1ad_table_index;
break;
}
@@ -1253,7 +1253,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
/* MAC destination */
memcpy (&mask[0], mt->mac_mask, 6);
l3_dst_offs = tags * 4 + get_l3_dst_offset (is6);
@@ -1261,18 +1261,18 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_dot1ad_table_index;
break;
}
@@ -1327,7 +1327,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
l3_src_offs = tags * 4 + get_l3_src_offset (is6);
memcpy (&mask[6], a->rules[i].src_mac, 6);
switch (tags)
@@ -1369,13 +1369,13 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
vnet_classify_add_del_session (cm, tag_table,
mask, a->rules[i].is_permit ? ~0 : 0,
i, 0, action, metadata, 1);
- memset (&mask[12], 0, sizeof (mask) - 12);
+ clib_memset (&mask[12], 0, sizeof (mask) - 12);
}
/* add ARP table entry too */
if (!is6 && (mvec[match_type_index].arp_table_index != ~0))
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
memcpy (&mask[6], a->rules[i].src_mac, 6);
for (tags = 2; tags >= 0; tags--)
@@ -1422,7 +1422,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
/* Add the egress entry with destination set */
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
l3_dst_offs = tags * 4 + get_l3_dst_offset (is6);
/* src mac in the other direction becomes dst */
memcpy (&mask[0], a->rules[i].src_mac, 6);
@@ -1468,7 +1468,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
mask,
a->rules[i].is_permit ? ~0 : 0,
i, 0, action, metadata, 1);
- // memset (&mask[12], 0, sizeof (mask) - 12);
+ // clib_memset (&mask[12], 0, sizeof (mask) - 12);
}
/* add ARP table entry too */
@@ -1476,7 +1476,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
switch (tags)
{
case 0:
@@ -1644,7 +1644,7 @@ macip_acl_add_list (u32 count, vl_api_macip_acl_rule_t rules[],
{
/* Get ACL index */
pool_get_aligned (am->macip_acls, a, CLIB_CACHE_LINE_BYTES);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* Will return the newly allocated ACL index */
*acl_list_index = a - am->macip_acls;
}
@@ -1980,7 +1980,7 @@ send_acl_details (acl_main_t * am, vl_api_registration_t * reg,
void *oldheap = acl_set_heap (am);
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_DETAILS + am->msg_id_base);
/* fill in the message */
@@ -2066,7 +2066,7 @@ send_acl_interface_list_details (acl_main_t * am,
msg_size += sizeof (mp->acls[0]) * count;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id =
ntohs (VL_API_ACL_INTERFACE_LIST_DETAILS + am->msg_id_base);
@@ -2218,7 +2218,7 @@ send_macip_acl_details (acl_main_t * am, vl_api_registration_t * reg,
int msg_size = sizeof (*mp) + (acl ? sizeof (mp->r[0]) * acl->count : 0);
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_DETAILS + am->msg_id_base);
/* fill in the message */
@@ -2308,7 +2308,7 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_MACIP_ACL_INTERFACE_GET_REPLY + am->msg_id_base);
rmp->context = mp->context;
@@ -2332,7 +2332,7 @@ send_macip_acl_interface_list_details (acl_main_t * am,
int msg_size = sizeof (*rmp) + sizeof (rmp->acls[0]);
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_MACIP_ACL_INTERFACE_LIST_DETAILS + am->msg_id_base);
@@ -2448,7 +2448,7 @@ send_acl_interface_etype_whitelist_details (acl_main_t * am,
msg_size += sizeof (mp->whitelist[0]) * count;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id =
ntohs (VL_API_ACL_INTERFACE_ETYPE_WHITELIST_DETAILS + am->msg_id_base);
@@ -3533,7 +3533,7 @@ acl_init (vlib_main_t * vm)
{
acl_main_t *am = &acl_main;
clib_error_t *error = 0;
- memset (am, 0, sizeof (*am));
+ clib_memset (am, 0, sizeof (*am));
am->vlib_main = vm;
am->vnet_main = vnet_get_main ();
am->log_default = vlib_log_register_class ("acl_plugin", 0);
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 991d877f7af..dcb0888076d 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -313,7 +313,7 @@ static int api_acl_plugin_get_version (vat_main_t * vam)
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_PLUGIN_GET_VERSION + sm->msg_id_base);
mp->client_index = vam->my_client_index;
@@ -334,7 +334,7 @@ static int api_macip_acl_interface_get (vat_main_t * vam)
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_INTERFACE_GET + sm->msg_id_base);
mp->client_index = vam->my_client_index;
@@ -519,7 +519,7 @@ static int api_acl_add_replace (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
@@ -693,7 +693,7 @@ api_acl_add_replace_from_file (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if (n_rules > 0)
@@ -1257,7 +1257,7 @@ static int api_macip_acl_add (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_ADD + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
@@ -1409,7 +1409,7 @@ static int api_macip_acl_add_replace (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c
index 0087a5e2ab7..8c1004e9212 100644
--- a/src/plugins/acl/hash_lookup.c
+++ b/src/plugins/acl/hash_lookup.c
@@ -315,7 +315,7 @@ release_mask_type_index(acl_main_t *am, u32 mask_type_index)
DBG0("RELEAS MTE index %d new refcount %d", mask_type_index, mte->refcount);
if (mte->refcount == 0) {
/* we are not using this entry anymore */
- memset(mte, 0xae, sizeof(*mte));
+ clib_memset(mte, 0xae, sizeof(*mte));
pool_put(am->ace_mask_type_pool, mte);
}
}
@@ -1057,7 +1057,7 @@ ip4_address_mask_from_width (ip4_address_t * a, u32 width)
{
int i, byte, bit, bitnum;
ASSERT (width <= 32);
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
for (i = 0; i < width; i++)
{
bitnum = (7 - (i & 7));
@@ -1090,8 +1090,8 @@ make_port_mask(u16 *portmask, u16 port_first, u16 port_last)
static void
make_mask_and_match_from_rule(fa_5tuple_t *mask, acl_rule_t *r, hash_ace_info_t *hi)
{
- memset(mask, 0, sizeof(*mask));
- memset(&hi->match, 0, sizeof(hi->match));
+ clib_memset(mask, 0, sizeof(*mask));
+ clib_memset(&hi->match, 0, sizeof(hi->match));
hi->action = r->is_permit;
/* we will need to be matching based on lc_index and mask_type_index when applied */
@@ -1107,7 +1107,7 @@ make_mask_and_match_from_rule(fa_5tuple_t *mask, acl_rule_t *r, hash_ace_info_t
make_ip6_address_mask(&mask->ip6_addr[1], r->dst_prefixlen);
hi->match.ip6_addr[1] = r->dst.ip6;
} else {
- memset(hi->match.l3_zero_pad, 0, sizeof(hi->match.l3_zero_pad));
+ clib_memset(hi->match.l3_zero_pad, 0, sizeof(hi->match.l3_zero_pad));
make_ip4_address_mask(&mask->ip4_addr[0], r->src_prefixlen);
hi->match.ip4_addr[0] = r->src.ip4;
make_ip4_address_mask(&mask->ip4_addr[1], r->dst_prefixlen);
@@ -1166,7 +1166,7 @@ void hash_acl_add(acl_main_t *am, int acl_index)
acl_list_t *a = &am->acls[acl_index];
vec_validate(am->hash_acl_infos, acl_index);
hash_acl_info_t *ha = vec_elt_at_index(am->hash_acl_infos, acl_index);
- memset(ha, 0, sizeof(*ha));
+ clib_memset(ha, 0, sizeof(*ha));
ha->hash_acl_exists = 1;
/* walk the newly added ACL entries and ensure that for each of them there
@@ -1174,7 +1174,7 @@ void hash_acl_add(acl_main_t *am, int acl_index)
for(i=0; i < a->count; i++) {
hash_ace_info_t ace_info;
fa_5tuple_t mask;
- memset(&ace_info, 0, sizeof(ace_info));
+ clib_memset(&ace_info, 0, sizeof(ace_info));
ace_info.acl_index = acl_index;
ace_info.ace_index = i;
@@ -1481,8 +1481,8 @@ split_partition(acl_main_t *am, u32 first_index,
hash_acl_info_t *ha = vec_elt_at_index(am->hash_acl_infos, pae->acl_index);
hash_ace_info_t *ace_info;
u32 coll_mask_type_index = pae->mask_type_index;
- memset(&the_min_tuple, 0, sizeof(the_min_tuple));
- memset(&the_max_tuple, 0, sizeof(the_max_tuple));
+ clib_memset(&the_min_tuple, 0, sizeof(the_min_tuple));
+ clib_memset(&the_max_tuple, 0, sizeof(the_max_tuple));
int i=0;
u64 collisions = vec_len(pae->colliding_rules);
diff --git a/src/plugins/acl/public_inlines.h b/src/plugins/acl/public_inlines.h
index 576d081784c..850babfa872 100644
--- a/src/plugins/acl/public_inlines.h
+++ b/src/plugins/acl/public_inlines.h
@@ -73,7 +73,7 @@ acl_fill_5tuple_l3_data (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
}
else
{
- memset(p5tuple_pkt->l3_zero_pad, 0, sizeof(p5tuple_pkt->l3_zero_pad));
+ clib_memset(p5tuple_pkt->l3_zero_pad, 0, sizeof(p5tuple_pkt->l3_zero_pad));
clib_memcpy (&p5tuple_pkt->ip4_addr,
get_ptr_to_offset (b0,
offsetof (ip4_header_t,
diff --git a/src/plugins/avf/avf_api.c b/src/plugins/avf/avf_api.c
index 8cb585ded2c..3503177837f 100644
--- a/src/plugins/avf/avf_api.c
+++ b/src/plugins/avf/avf_api.c
@@ -64,7 +64,7 @@ vl_api_avf_create_t_handler (vl_api_avf_create_t * mp)
avf_create_if_args_t args;
int rv;
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
args.enable_elog = ntohl (mp->enable_elog);
args.addr.as_u32 = ntohl (mp->pci_addr);
diff --git a/src/plugins/avf/avf_test.c b/src/plugins/avf/avf_test.c
index fbb125cee9d..368d5035bb9 100644
--- a/src/plugins/avf/avf_test.c
+++ b/src/plugins/avf/avf_test.c
@@ -97,7 +97,7 @@ api_avf_create (vat_main_t * vam)
int ret;
u32 x[4];
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c
index cd5f02dea3e..492494dcc79 100644
--- a/src/plugins/avf/cli.c
+++ b/src/plugins/avf/cli.c
@@ -34,7 +34,7 @@ avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
avf_create_if_args_t args;
u32 tmp;
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index e71b74ec8fc..914c32cab4b 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -227,7 +227,7 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
rxq->descs = vlib_physmem_alloc_aligned (vm, am->physmem_region, &error,
rxq->size * sizeof (avf_rx_desc_t),
2 * CLIB_CACHE_LINE_BYTES);
- memset ((void *) rxq->descs, 0, rxq->size * sizeof (avf_rx_desc_t));
+ clib_memset ((void *) rxq->descs, 0, rxq->size * sizeof (avf_rx_desc_t));
vec_validate_aligned (rxq->bufs, rxq->size, CLIB_CACHE_LINE_BYTES);
rxq->qrx_tail = ad->bar0 + AVF_QRX_TAIL (qid);
@@ -295,7 +295,7 @@ avf_arq_slot_init (avf_device_t * ad, u16 slot)
avf_aq_desc_t *d;
u64 pa = ad->arq_bufs_pa + slot * AVF_MBOX_BUF_SZ;
d = &ad->arq[slot];
- memset (d, 0, sizeof (avf_aq_desc_t));
+ clib_memset (d, 0, sizeof (avf_aq_desc_t));
d->flags = AVF_AQ_F_BUF;
d->datalen = AVF_MBOX_BUF_SZ;
d->addr_hi = (u32) (pa >> 32);
@@ -318,7 +318,7 @@ avf_adminq_init (vlib_main_t * vm, avf_device_t * ad)
int i;
/* VF MailBox Transmit */
- memset (ad->atq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
+ clib_memset (ad->atq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
ad->atq_bufs_pa = avf_dma_addr (vm, ad, ad->atq_bufs);
pa = avf_dma_addr (vm, ad, ad->atq);
@@ -329,7 +329,7 @@ avf_adminq_init (vlib_main_t * vm, avf_device_t * ad)
avf_reg_write (ad, AVF_ATQBAH, (u32) (pa >> 32)); /* Base Address High */
/* VF MailBox Receive */
- memset (ad->arq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
+ clib_memset (ad->arq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
ad->arq_bufs_pa = avf_dma_addr (vm, ad, ad->arq_bufs);
for (i = 0; i < AVF_MBOX_LEN; i++)
@@ -498,7 +498,7 @@ avf_op_config_rss_lut (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_rss_lut_t *rl;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
rl = (virtchnl_rss_lut_t *) msg;
rl->vsi_id = ad->vsi_id;
rl->lut_entries = ad->rss_lut_size;
@@ -517,7 +517,7 @@ avf_op_config_rss_key (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_rss_key_t *rk;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
rk = (virtchnl_rss_key_t *) msg;
rk->vsi_id = ad->vsi_id;
rk->key_len = ad->rss_key_size;
@@ -558,7 +558,7 @@ avf_op_config_vsi_queues (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_vsi_queue_config_info_t *ci;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
ci = (virtchnl_vsi_queue_config_info_t *) msg;
ci->vsi_id = ad->vsi_id;
ci->num_queue_pairs = n_qp;
@@ -603,7 +603,7 @@ avf_op_config_irq_map (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_irq_map_info_t *imi;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
imi = (virtchnl_irq_map_info_t *) msg;
imi->num_vectors = count;
@@ -624,7 +624,7 @@ avf_op_add_eth_addr (vlib_main_t * vm, avf_device_t * ad, u8 count, u8 * macs)
virtchnl_ether_addr_list_t *al;
int i;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
al = (virtchnl_ether_addr_list_t *) msg;
al->vsi_id = ad->vsi_id;
al->num_elements = count;
@@ -1161,7 +1161,7 @@ avf_delete_if (vlib_main_t * vm, avf_device_t * ad)
vec_free (ad->txqs);
clib_error_free (ad->error);
- memset (ad, 0, sizeof (*ad));
+ clib_memset (ad, 0, sizeof (*ad));
pool_put (am->devices, ad);
}
diff --git a/src/plugins/cdp/cdp_input.c b/src/plugins/cdp/cdp_input.c
index 66ae97142c5..dd3619cb8ac 100644
--- a/src/plugins/cdp/cdp_input.c
+++ b/src/plugins/cdp/cdp_input.c
@@ -328,7 +328,7 @@ cdp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
if (p == 0)
{
pool_get (cm->neighbors, n);
- memset (n, 0, sizeof (*n));
+ clib_memset (n, 0, sizeof (*n));
n->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
n->packet_template_index = (u8) ~ 0;
hash_set (cm->neighbor_by_sw_if_index, n->sw_if_index,
diff --git a/src/plugins/cdp/cdp_periodic.c b/src/plugins/cdp/cdp_periodic.c
index a4c4bb91765..da08523176f 100644
--- a/src/plugins/cdp/cdp_periodic.c
+++ b/src/plugins/cdp/cdp_periodic.c
@@ -408,11 +408,11 @@ cdp_periodic_init (vlib_main_t * vm)
{
ethernet_llc_snap_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/* Send to 01:00:0c:cc:cc */
h.ethernet.dst_address[0] = 0x01;
- /* h.ethernet.dst_address[1] = 0x00; (memset) */
+ /* h.ethernet.dst_address[1] = 0x00; (clib_memset) */
h.ethernet.dst_address[2] = 0x0C;
h.ethernet.dst_address[3] = 0xCC;
h.ethernet.dst_address[4] = 0xCC;
@@ -427,8 +427,8 @@ cdp_periodic_init (vlib_main_t * vm)
h.llc.control = 0x03; /* UI (no extended control bytes) */
/* SNAP */
- /* h.snap.oui[0] = 0x00; (memset) */
- /* h.snap.oui[1] = 0x00; (memset) */
+ /* h.snap.oui[0] = 0x00; (clib_memset) */
+ /* h.snap.oui[1] = 0x00; (clib_memset) */
h.snap.oui[2] = 0x0C; /* Cisco = 0x00000C */
h.snap.protocol = htons (0x2000); /* CDP = 0x2000 */
@@ -450,10 +450,10 @@ cdp_periodic_init (vlib_main_t * vm)
{
hdlc_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
h.hdlc.address = 0x0f;
- /* h.hdlc.control = 0; (memset) */
+ /* h.hdlc.control = 0; (clib_memset) */
h.hdlc.protocol = htons (0x2000); /* CDP = 0x2000 */
/* CDP */
@@ -472,11 +472,11 @@ cdp_periodic_init (vlib_main_t * vm)
{
srp_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/* Send to 01:00:0c:cc:cc */
h.ethernet.dst_address[0] = 0x01;
- /* h.ethernet.dst_address[1] = 0x00; (memset) */
+ /* h.ethernet.dst_address[1] = 0x00; (clib_memset) */
h.ethernet.dst_address[2] = 0x0C;
h.ethernet.dst_address[3] = 0xCC;
h.ethernet.dst_address[4] = 0xCC;
diff --git a/src/plugins/dpdk/api/dpdk_test.c b/src/plugins/dpdk/api/dpdk_test.c
index 8204edfe66a..637b4016111 100644
--- a/src/plugins/dpdk/api/dpdk_test.c
+++ b/src/plugins/dpdk/api/dpdk_test.c
@@ -94,7 +94,7 @@ _(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_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 + dm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
@@ -103,7 +103,7 @@ do { \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + dm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index cc7eed059f0..f7ed932e35f 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -140,7 +140,7 @@ del_free_list (vlib_main_t * vm, vlib_buffer_free_list_t * f)
vec_free (f->name);
vec_free (f->buffers);
/* Poison it. */
- memset (f, 0xab, sizeof (f[0]));
+ clib_memset (f, 0xab, sizeof (f[0]));
}
/* Add buffer free list. */
@@ -209,7 +209,7 @@ CLIB_MULTIARCH_FN (dpdk_buffer_fill_free_list) (vlib_main_t * vm,
if (rte_mempool_get_bulk (rmp, (void *) d->mbuf_alloc_list, n_alloc) < 0)
return 0;
- memset (&bt, 0, sizeof (vlib_buffer_t));
+ clib_memset (&bt, 0, sizeof (vlib_buffer_t));
vlib_buffer_init_for_free_list (&bt, fl);
bt.buffer_pool_index = privp->buffer_pool_index;
@@ -383,7 +383,7 @@ dpdk_packet_template_init (vlib_main_t * vm,
vlib_packet_template_t *t = (vlib_packet_template_t *) vt;
vlib_worker_thread_barrier_sync (vm);
- memset (t, 0, sizeof (t[0]));
+ clib_memset (t, 0, sizeof (t[0]));
vec_add (t->packet_data, packet_data, n_packet_data_bytes);
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index b9ba161423b..57430eff977 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -214,7 +214,7 @@ dpdk_device_stop (dpdk_device_t * xd)
rte_eth_allmulticast_disable (xd->port_id);
rte_eth_dev_stop (xd->port_id);
- memset (&xd->link, 0, sizeof (struct rte_eth_link));
+ clib_memset (&xd->link, 0, sizeof (struct rte_eth_link));
/* For bonded interface, stop slave links */
if (xd->pmd == VNET_DPDK_PMD_BOND)
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 6ed11e2f304..6612ce4e1ad 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -179,7 +179,7 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
.vni_reserved = clib_host_to_net_u32 (((u32) - 1) << 8)
};
- memset (raw, 0, sizeof raw);
+ clib_memset (raw, 0, sizeof raw);
raw[0].item.relative = 1;
raw[0].item.length = vxlan_hdr_sz;
@@ -258,12 +258,12 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
{
/* make sure no action is taken for in-flight (marked) packets */
fle = pool_elt_at_index (xd->flow_lookup_entries, fe->mark);
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
vec_add1 (xd->parked_lookup_indexes, fe->mark);
xd->parked_loop_count = dm->vlib_main->main_loop_count;
}
- memset (fe, 0, sizeof (*fe));
+ clib_memset (fe, 0, sizeof (*fe));
pool_put (xd->flow_entries, fe);
goto disable_rx_offload;
@@ -294,7 +294,7 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
fe->mark = fle - xd->flow_lookup_entries;
/* install entry in the lookup table */
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
if (flow->actions & VNET_FLOW_ACTION_MARK)
fle->flow_id = flow->mark_flow_id;
if (flow->actions & VNET_FLOW_ACTION_REDIRECT_TO_NODE)
@@ -329,11 +329,11 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
done:
if (rv)
{
- memset (fe, 0, sizeof (*fe));
+ clib_memset (fe, 0, sizeof (*fe));
pool_put (xd->flow_entries, fe);
if (fle)
{
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
pool_put (xd->flow_lookup_entries, fle);
}
}
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 7d9ec7e5c80..697458c04b6 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -145,7 +145,7 @@ dpdk_device_lock_init (dpdk_device_t * xd)
{
xd->lockp[q] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) xd->lockp[q], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) xd->lockp[q], 0, CLIB_CACHE_LINE_BYTES);
}
}
@@ -1518,7 +1518,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
return;
xd->time_last_link_update = now ? now : xd->time_last_link_update;
- memset (&xd->link, 0, sizeof (xd->link));
+ clib_memset (&xd->link, 0, sizeof (xd->link));
rte_eth_link_get_nowait (xd->port_id, &xd->link);
if (LINK_STATE_ELOGS)
diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c
index 04455c5d534..1a8dd6d98fe 100644
--- a/src/plugins/dpdk/hqos/hqos.c
+++ b/src/plugins/dpdk/hqos/hqos.c
@@ -268,10 +268,10 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
/* Allocate the per-thread device data array */
vec_validate_aligned (xd->hqos_wt, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0]));
+ clib_memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0]));
vec_validate_aligned (xd->hqos_ht, 0, CLIB_CACHE_LINE_BYTES);
- memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0]));
+ clib_memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0]));
/* Allocate space for one SWQ per worker thread in the I/O TX thread data structure */
vec_validate (xd->hqos_ht->swq, worker_thread_count);
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index 1bd46d55b8e..ded8912e943 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -407,7 +407,7 @@ static void __attribute__ ((unused)) clear_and_free_obj (void *obj)
{
struct rte_mempool *mp = rte_mempool_from_obj (obj);
- memset (obj, 0, mp->elt_size);
+ clib_memset (obj, 0, mp->elt_size);
rte_mempool_put (mp, obj);
}
@@ -1031,9 +1031,9 @@ dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
vec_validate_init_empty_aligned (cwm->ops, VLIB_FRAME_SIZE - 1, 0,
CLIB_CACHE_LINE_BYTES);
- memset (cwm->cipher_resource_idx, ~0,
+ clib_memset (cwm->cipher_resource_idx, ~0,
IPSEC_CRYPTO_N_ALG * sizeof(*cwm->cipher_resource_idx));
- memset (cwm->auth_resource_idx, ~0,
+ clib_memset (cwm->auth_resource_idx, ~0,
IPSEC_INTEG_N_ALG * sizeof(*cwm->auth_resource_idx));
}
/* *INDENT-ON* */
diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c
index ee951965e96..c130b908934 100644
--- a/src/plugins/flowprobe/flowprobe.c
+++ b/src/plugins/flowprobe/flowprobe.c
@@ -1113,9 +1113,9 @@ flowprobe_init (vlib_main_t * vm)
fm->vlib_time_0 = vlib_time_now (vm);
fm->nanosecond_time_0 = unix_time_now_nsec ();
- memset (fm->template_reports, 0, sizeof (fm->template_reports));
- memset (fm->template_size, 0, sizeof (fm->template_size));
- memset (fm->template_per_flow, 0, sizeof (fm->template_per_flow));
+ clib_memset (fm->template_reports, 0, sizeof (fm->template_reports));
+ clib_memset (fm->template_size, 0, sizeof (fm->template_size));
+ clib_memset (fm->template_per_flow, 0, sizeof (fm->template_per_flow));
/* Decide how many worker threads we have */
num_threads = 1 /* main thread */ + tm->n_threads;
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 0cbe9910101..6bd1abc727e 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -143,7 +143,7 @@ gbp_endpoint_send_details (gbp_endpoint_t * gbpe, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_ENDPOINT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -242,7 +242,7 @@ gbp_subnet_send_details (u32 table_id,
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_SUBNET_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -285,7 +285,7 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gepg, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_ENDPOINT_GROUP_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -351,7 +351,7 @@ gbp_recirc_send_details (gbp_recirc_t * gr, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_RECIRC_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -409,7 +409,7 @@ gbp_contract_send_details (gbp_contract_t * gbpc, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_CONTRACT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
diff --git a/src/plugins/gbp/gbp_endpoint_group.c b/src/plugins/gbp/gbp_endpoint_group.c
index 27d404e09dd..095c8fe607b 100644
--- a/src/plugins/gbp/gbp_endpoint_group.c
+++ b/src/plugins/gbp/gbp_endpoint_group.c
@@ -61,7 +61,7 @@ gbp_endpoint_group_add (epg_id_t epg_id,
fib_protocol_t fproto;
pool_get (gbp_endpoint_group_pool, gepg);
- memset (gepg, 0, sizeof (*gepg));
+ clib_memset (gepg, 0, sizeof (*gepg));
gepg->gepg_id = epg_id;
gepg->gepg_bd = bd_id;
diff --git a/src/plugins/gbp/gbp_policy_dpo.c b/src/plugins/gbp/gbp_policy_dpo.c
index 3a06604121b..a2d9510b838 100644
--- a/src/plugins/gbp/gbp_policy_dpo.c
+++ b/src/plugins/gbp/gbp_policy_dpo.c
@@ -110,7 +110,7 @@ gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
dpo_id_t parent = DPO_INVALID;
gpd = gbp_policy_dpo_alloc ();
- memset (gpd, 0, sizeof (*gpd));
+ clib_memset (gpd, 0, sizeof (*gpd));
gpd->gpd_proto = dproto;
gpd->gpd_sw_if_index = sw_if_index;
diff --git a/src/plugins/gbp/gbp_recirc.c b/src/plugins/gbp/gbp_recirc.c
index 576ec8512bc..95e8066d443 100644
--- a/src/plugins/gbp/gbp_recirc.c
+++ b/src/plugins/gbp/gbp_recirc.c
@@ -46,7 +46,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
fib_protocol_t fproto;
pool_get (gbp_recirc_pool, gr);
- memset (gr, 0, sizeof (*gr));
+ clib_memset (gr, 0, sizeof (*gr));
gri = gr - gbp_recirc_pool;
gr->gr_epg = epg_id;
diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c
index 027af9b4aec..dcdbc518b30 100644
--- a/src/plugins/gtpu/gtpu.c
+++ b/src/plugins/gtpu/gtpu.c
@@ -397,7 +397,7 @@ int vnet_gtpu_add_del_tunnel
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (gtm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* copy from arg structure */
#define _(x) t->x = a->x;
@@ -672,8 +672,8 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -796,7 +796,7 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/plugins/gtpu/gtpu_api.c b/src/plugins/gtpu/gtpu_api.c
index 502720df179..f2f1c297850 100644
--- a/src/plugins/gtpu/gtpu_api.c
+++ b/src/plugins/gtpu/gtpu_api.c
@@ -156,7 +156,7 @@ static void send_gtpu_tunnel_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->dst);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_GTPU_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/plugins/gtpu/gtpu_decap.c b/src/plugins/gtpu/gtpu_decap.c
index d52ccc0219c..c4e6c85418e 100644
--- a/src/plugins/gtpu/gtpu_decap.c
+++ b/src/plugins/gtpu/gtpu_decap.c
@@ -87,7 +87,7 @@ gtpu_input (vlib_main_t * vm,
if (is_ip4)
last_key4.as_u64 = ~0;
else
- memset (&last_key6, 0xff, sizeof (last_key6));
+ clib_memset (&last_key6, 0xff, sizeof (last_key6));
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/plugins/gtpu/gtpu_test.c b/src/plugins/gtpu/gtpu_test.c
index 1eb54d6a6b8..f9812c65ccf 100644
--- a/src/plugins/gtpu/gtpu_test.c
+++ b/src/plugins/gtpu/gtpu_test.c
@@ -247,8 +247,8 @@ api_gtpu_add_del_tunnel (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/igmp/igmp.c b/src/plugins/igmp/igmp.c
index 61a9970af14..e12a6323b40 100644
--- a/src/plugins/igmp/igmp.c
+++ b/src/plugins/igmp/igmp.c
@@ -375,7 +375,7 @@ igmp_enable_disable (u32 sw_if_index, u8 enable, igmp_mode_t mode)
vec_validate_init_empty (im->igmp_config_by_sw_if_index,
sw_if_index, ~0);
pool_get (im->configs, config);
- memset (config, 0, sizeof (igmp_config_t));
+ clib_memset (config, 0, sizeof (igmp_config_t));
config->sw_if_index = sw_if_index;
config->igmp_group_by_key =
hash_create_mem (0, sizeof (igmp_key_t), sizeof (uword));
diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c
index 5d836967b4b..75a2daedd62 100644
--- a/src/plugins/igmp/igmp_api.c
+++ b/src/plugins/igmp/igmp_api.c
@@ -81,7 +81,7 @@ vl_api_igmp_listen_t_handler (vl_api_igmp_listen_t * mp)
goto done;
}
- memset (&gaddr, 0, sizeof (gaddr));
+ clib_memset (&gaddr, 0, sizeof (gaddr));
clib_memcpy (&gaddr.ip4, &mp->group.gaddr, sizeof (ip4_address_t));
vec_validate (saddrs, mp->group.n_srcs - 1);
@@ -167,7 +167,7 @@ send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im,
vl_api_igmp_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (IGMP_MSG_ID (VL_API_IGMP_DETAILS));
mp->context = context;
@@ -298,7 +298,7 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx,
vl_api_igmp_group_prefix_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (IGMP_MSG_ID (VL_API_IGMP_DETAILS));
mp->context = ctx->context;
@@ -364,7 +364,7 @@ vl_api_want_igmp_events_t_handler (vl_api_want_igmp_events_t * mp)
if (mp->enable)
{
pool_get (im->api_clients, api_client);
- memset (api_client, 0, sizeof (vpe_client_registration_t));
+ clib_memset (api_client, 0, sizeof (vpe_client_registration_t));
api_client->client_index = mp->client_index;
api_client->client_pid = mp->pid;
hash_set (im->igmp_api_client_by_client_index,
@@ -405,7 +405,7 @@ send_igmp_event (unix_shared_memory_queue_t * q,
const ip46_address_t * saddr, const ip46_address_t * gaddr)
{
vl_api_igmp_event_t *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_IGMP_EVENT) + igmp_main.msg_id_base);
mp->context = context;
diff --git a/src/plugins/igmp/igmp_group.c b/src/plugins/igmp/igmp_group.c
index 9f50ad9b05a..38499e4778f 100644
--- a/src/plugins/igmp/igmp_group.c
+++ b/src/plugins/igmp/igmp_group.c
@@ -109,7 +109,7 @@ igmp_group_alloc (igmp_config_t * config,
IGMP_DBG ("new-group: %U", format_igmp_key, gkey);
pool_get (im->groups, group);
- memset (group, 0, sizeof (igmp_group_t));
+ clib_memset (group, 0, sizeof (igmp_group_t));
group->key = clib_mem_alloc (sizeof (igmp_key_t));
clib_memcpy (group->key, gkey, sizeof (igmp_key_t));
group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE] =
diff --git a/src/plugins/igmp/igmp_pkt.c b/src/plugins/igmp/igmp_pkt.c
index a2034d4bec6..c2a5d0911c6 100644
--- a/src/plugins/igmp/igmp_pkt.c
+++ b/src/plugins/igmp/igmp_pkt.c
@@ -73,7 +73,7 @@ igmp_pkt_build_ip_header (igmp_pkt_build_t * bk,
return (NULL);
ip4 = vlib_buffer_get_current (b);
- memset (ip4, 0, sizeof (ip4_header_t));
+ clib_memset (ip4, 0, sizeof (ip4_header_t));
ip4->ip_version_and_header_length = 0x46;
ip4->ttl = 1;
ip4->protocol = IP_PROTOCOL_IGMP;
@@ -402,7 +402,7 @@ igmp_pkt_report_v3_add_group (igmp_pkt_build_report_t * br,
void
igmp_pkt_build_report_init (igmp_pkt_build_report_t * br, u32 sw_if_index)
{
- memset (br, 0, sizeof (*br));
+ clib_memset (br, 0, sizeof (*br));
br->base.sw_if_index = sw_if_index;
}
@@ -525,7 +525,7 @@ igmp_pkt_query_v3_send (igmp_pkt_build_query_t * bq)
void
igmp_pkt_build_query_init (igmp_pkt_build_query_t * bq, u32 sw_if_index)
{
- memset (bq, 0, sizeof (*bq));
+ clib_memset (bq, 0, sizeof (*bq));
bq->base.sw_if_index = sw_if_index;
}
diff --git a/src/plugins/igmp/igmp_proxy.c b/src/plugins/igmp/igmp_proxy.c
index 4a439d650c9..690b38a8001 100644
--- a/src/plugins/igmp/igmp_proxy.c
+++ b/src/plugins/igmp/igmp_proxy.c
@@ -106,7 +106,7 @@ igmp_proxy_device_add_del (u32 vrf_id, u32 sw_if_index, u8 add)
pool_get (im->proxy_devices, proxy_device);
im->igmp_proxy_device_by_vrf_id[vrf_id] =
proxy_device - im->proxy_devices;
- memset (proxy_device, 0, sizeof (igmp_proxy_device_t));
+ clib_memset (proxy_device, 0, sizeof (igmp_proxy_device_t));
proxy_device->vrf_id = vrf_id;
proxy_device->upstream_if = sw_if_index;
config->proxy_device_id = vrf_id;
diff --git a/src/plugins/igmp/igmp_src.c b/src/plugins/igmp/igmp_src.c
index 0bdde83214c..cc7de6c1921 100644
--- a/src/plugins/igmp/igmp_src.c
+++ b/src/plugins/igmp/igmp_src.c
@@ -78,7 +78,7 @@ igmp_src_alloc (u32 group_index, const igmp_key_t * skey, igmp_mode_t mode)
IGMP_DBG ("new-src: (%U)", format_igmp_key, skey);
pool_get (im->srcs, src);
- memset (src, 0, sizeof (igmp_src_t));
+ clib_memset (src, 0, sizeof (igmp_src_t));
src->mode = mode;
src->key = clib_mem_alloc (sizeof (*skey));
src->group = group_index;
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);
diff --git a/src/plugins/ixge/ixge.c b/src/plugins/ixge/ixge.c
index 09394ca4fc0..3c4a5b4bbfc 100644
--- a/src/plugins/ixge/ixge.c
+++ b/src/plugins/ixge/ixge.c
@@ -2496,8 +2496,8 @@ ixge_dma_init (ixge_device_t * xd, vlib_rx_or_tx_t rt, u32 queue_index)
if (error)
return error;
- memset (dq->descriptors, 0,
- dq->n_descriptors * sizeof (dq->descriptors[0]));
+ clib_memset (dq->descriptors, 0,
+ dq->n_descriptors * sizeof (dq->descriptors[0]));
vec_resize (dq->descriptor_buffer_indices, dq->n_descriptors);
if (rt == VLIB_RX)
@@ -2723,7 +2723,7 @@ ixge_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
vec_foreach (xd, xm->devices)
{
ixge_update_counters (xd);
- memset (xd->counters, 0, sizeof (xd->counters));
+ clib_memset (xd->counters, 0, sizeof (xd->counters));
}
timeout = 30.0;
@@ -2798,10 +2798,10 @@ ixge_init (vlib_main_t * vm)
clib_error_t *error;
xm->vlib_main = vm;
- memset (&xm->tx_descriptor_template, 0,
- sizeof (xm->tx_descriptor_template));
- memset (&xm->tx_descriptor_template_mask, 0,
- sizeof (xm->tx_descriptor_template_mask));
+ clib_memset (&xm->tx_descriptor_template, 0,
+ sizeof (xm->tx_descriptor_template));
+ clib_memset (&xm->tx_descriptor_template_mask, 0,
+ sizeof (xm->tx_descriptor_template_mask));
xm->tx_descriptor_template.status0 =
(IXGE_TX_DESCRIPTOR_STATUS0_ADVANCED |
IXGE_TX_DESCRIPTOR_STATUS0_IS_ADVANCED |
diff --git a/src/plugins/l2e/l2e.c b/src/plugins/l2e/l2e.c
index a56c25c54f8..77abbecaa95 100644
--- a/src/plugins/l2e/l2e.c
+++ b/src/plugins/l2e/l2e.c
@@ -82,7 +82,7 @@ l2_emulation_disable (u32 sw_if_index)
if (vec_len (l2_emulations) >= sw_if_index)
{
l2_emulation_t *l23e = &l2_emulations[sw_if_index];
- memset (l23e, 0, sizeof (*l23e));
+ clib_memset (l23e, 0, sizeof (*l23e));
l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_L2_EMULATION, 0);
ip4_sw_interface_enable_disable (sw_if_index, 0);
diff --git a/src/plugins/lacp/cli.c b/src/plugins/lacp/cli.c
index c6184b6937e..d210139c4b4 100644
--- a/src/plugins/lacp/cli.c
+++ b/src/plugins/lacp/cli.c
@@ -33,7 +33,7 @@ lacp_dump_ifs (lacp_interface_details_t ** out_lacpifs)
if ((sif->port_enabled == 0) || (sif->lacp_enabled == 0))
continue;
vec_add2(r_lacpifs, lacpif, 1);
- memset (lacpif, 0, sizeof (*lacpif));
+ clib_memset (lacpif, 0, sizeof (*lacpif));
lacpif->sw_if_index = sif->sw_if_index;
hi = vnet_get_hw_interface (vnm, sif->hw_if_index);
clib_memcpy(lacpif->interface_name, hi->name,
diff --git a/src/plugins/lacp/lacp.c b/src/plugins/lacp/lacp.c
index 7bd6e374dab..473458af4e4 100644
--- a/src/plugins/lacp/lacp.c
+++ b/src/plugins/lacp/lacp.c
@@ -216,7 +216,7 @@ lacp_periodic_init (vlib_main_t * vm)
/* Create the ethernet lacp packet template */
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
@@ -253,7 +253,7 @@ lacp_periodic_init (vlib_main_t * vm)
/* Create the ethernet marker protocol packet template */
- memset (&m, 0, sizeof (m));
+ clib_memset (&m, 0, sizeof (m));
memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
diff --git a/src/plugins/lacp/lacp_api.c b/src/plugins/lacp/lacp_api.c
index 129c3605527..8bb6fa90eb0 100644
--- a/src/plugins/lacp/lacp_api.c
+++ b/src/plugins/lacp/lacp_api.c
@@ -99,7 +99,7 @@ lacp_send_sw_interface_details (vl_api_registration_t * reg,
vl_api_sw_interface_lacp_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_LACP_DETAILS + lm->msg_id_base);
mp->sw_if_index = htonl (lacp_if->sw_if_index);
diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c
index 76bbfa0ac81..53264339811 100644
--- a/src/plugins/lb/lb.c
+++ b/src/plugins/lb/lb.c
@@ -676,7 +676,7 @@ next:
{
/* Add SNAT static mapping */
pool_get (lbm->snat_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
if (lb_vip_is_nat4_port(vip)) {
lb_snat4_key_t m_key4;
clib_bihash_kv_8_8_t kv4;
diff --git a/src/plugins/mactime/mactime.c b/src/plugins/mactime/mactime.c
index c5c6b8b9f2c..21857d430c0 100644
--- a/src/plugins/mactime/mactime.c
+++ b/src/plugins/mactime/mactime.c
@@ -199,7 +199,7 @@ mactime_send_create_entry_message (u8 * mac_address)
am = &api_main;
shmem_hdr = am->shmem_hdr;
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MACTIME_ADD_DEL_RANGE + mm->msg_id_base);
name = format (0, "mac-%U", format_mac_address, mac_address);
@@ -227,7 +227,7 @@ static void vl_api_mactime_add_del_range_t_handler
feature_init (mm);
- memset (&kv, 0, sizeof (kv));
+ clib_memset (&kv, 0, sizeof (kv));
memcpy (&kv.key, mp->mac_address, sizeof (mp->mac_address));
/* See if we have a lookup table entry for this src mac address */
@@ -241,7 +241,7 @@ static void vl_api_mactime_add_del_range_t_handler
if (found == 0)
{
pool_get (mm->devices, dp);
- memset (dp, 0, sizeof (*dp));
+ clib_memset (dp, 0, sizeof (*dp));
vlib_validate_combined_counter (&mm->allow_counters,
dp - mm->devices);
vlib_zero_combined_counter (&mm->allow_counters, dp - mm->devices);
diff --git a/src/plugins/map/examples/health_check.c b/src/plugins/map/examples/health_check.c
index 5f0d85fec08..f4e9a689b5b 100644
--- a/src/plugins/map/examples/health_check.c
+++ b/src/plugins/map/examples/health_check.c
@@ -55,7 +55,7 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
- memset(&ifr, 0, sizeof(ifr));
+ clib_memset(&ifr, 0, sizeof(ifr));
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", interface);
/* Bind socket to interface of this node. */
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c
index f2da818dd7b..13caa368322 100644
--- a/src/plugins/map/map.c
+++ b/src/plugins/map/map.c
@@ -130,7 +130,7 @@ map_create_domain (ip4_address_t * ip4_prefix,
/* Get domain index */
pool_get_aligned (mm->domains, d, CLIB_CACHE_LINE_BYTES);
- memset (d, 0, sizeof (*d));
+ clib_memset (d, 0, sizeof (*d));
*map_domain_index = d - mm->domains;
/* Init domain struct */
@@ -316,7 +316,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep,
d->rules = clib_mem_alloc_aligned (l, CLIB_CACHE_LINE_BYTES);
if (!d->rules)
return -1;
- memset (d->rules, 0, l);
+ clib_memset (d->rules, 0, l);
}
if (psid >= (0x1 << d->psid_length))
@@ -332,7 +332,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep,
}
else
{
- memset (&d->rules[psid], 0, sizeof (ip6_address_t));
+ clib_memset (&d->rules[psid], 0, sizeof (ip6_address_t));
}
return 0;
}
@@ -745,8 +745,8 @@ map_pre_resolve_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
int is_del = 0;
- memset (&ip4nh, 0, sizeof (ip4nh));
- memset (&ip6nh, 0, sizeof (ip6nh));
+ clib_memset (&ip4nh, 0, sizeof (ip4nh));
+ clib_memset (&ip6nh, 0, sizeof (ip6nh));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -974,7 +974,7 @@ format_map_domain (u8 * s, va_list * args)
ip6_address_t ip6_prefix;
if (d->rules)
- memset (&ip6_prefix, 0, sizeof (ip6_prefix));
+ clib_memset (&ip6_prefix, 0, sizeof (ip6_prefix));
else
ip6_prefix = d->ip6_prefix;
@@ -1210,8 +1210,8 @@ show_map_stats_command_fn (vlib_main_t * vm, unformat_input_t * input,
int which, i;
vlib_counter_t v;
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
map_domain_counter_lock (mm);
vec_foreach (cm, mm->domain_counters)
diff --git a/src/plugins/map/map_api.c b/src/plugins/map/map_api.c
index 90dbd1bcfd6..4b21c378379 100644
--- a/src/plugins/map/map_api.c
+++ b/src/plugins/map/map_api.c
@@ -120,7 +120,7 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach(d, mm->domains,
({
- /* Make sure every field is initiated (or don't skip the memset()) */
+ /* Make sure every field is initiated (or don't skip the clib_memset()) */
rmp = vl_msg_api_alloc (sizeof (*rmp));
rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base);
rmp->context = mp->context;
@@ -175,7 +175,7 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp)
continue;
}
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->msg_id_base);
rmp->psid = htons (i);
clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst));
@@ -211,8 +211,8 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp)
goto out;
}
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
map_domain_counter_lock (mm);
vec_foreach (cm, mm->domain_counters)
diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c
index ded2b49a3b9..b808f3c7bfb 100644
--- a/src/plugins/marvell/pp2/pp2.c
+++ b/src/plugins/marvell/pp2/pp2.c
@@ -213,7 +213,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
}
pool_get (ppm->interfaces, ppif);
- memset (ppif, 0, sizeof (*ppif));
+ clib_memset (ppif, 0, sizeof (*ppif));
ppif->dev_instance = ppif - ppm->interfaces;
ppif->hw_if_index = ~0;
vec_validate_aligned (ppif->inqs, n_inqs - 1, CLIB_CACHE_LINE_BYTES);
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index e8fb0e94a69..763572c2f0e 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -460,7 +460,7 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
clib_error_t *err;
sock = clib_mem_alloc (sizeof (clib_socket_t));
- memset (sock, 0, sizeof (clib_socket_t));
+ clib_memset (sock, 0, sizeof (clib_socket_t));
while (1)
{
@@ -511,7 +511,7 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
{
- memset (sock, 0, sizeof(clib_socket_t));
+ clib_memset (sock, 0, sizeof(clib_socket_t));
sock->config = (char *) msf->filename;
sock->flags = CLIB_SOCKET_F_IS_CLIENT| CLIB_SOCKET_F_SEQPACKET;
@@ -576,7 +576,7 @@ memif_add_socket_file (u32 sock_id, u8 * socket_filename)
}
pool_get (mm->socket_files, msf);
- memset (msf, 0, sizeof (memif_socket_file_t));
+ clib_memset (msf, 0, sizeof (memif_socket_file_t));
msf->filename = socket_filename;
msf->socket_id = sock_id;
@@ -756,7 +756,7 @@ memif_delete_if (vlib_main_t * vm, memif_if_t * mif)
}
}
- memset (mif, 0, sizeof (*mif));
+ clib_memset (mif, 0, sizeof (*mif));
pool_put (mm->interfaces, mif);
if (pool_elts (mm->interfaces) == 0)
@@ -875,7 +875,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
}
pool_get (mm->interfaces, mif);
- memset (mif, 0, sizeof (*mif));
+ clib_memset (mif, 0, sizeof (*mif));
mif->dev_instance = mif - mm->interfaces;
mif->socket_file_index = msf - mm->socket_files;
mif->id = args->id;
@@ -944,7 +944,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
ASSERT (msf->sock == 0);
msf->sock = s;
- memset (s, 0, sizeof (clib_socket_t));
+ clib_memset (s, 0, sizeof (clib_socket_t));
s->config = (char *) msf->filename;
s->flags = CLIB_SOCKET_F_IS_SERVER |
CLIB_SOCKET_F_ALLOW_GROUP_WRITE |
@@ -1019,7 +1019,7 @@ memif_init (vlib_main_t * vm)
{
memif_main_t *mm = &memif_main;
- memset (mm, 0, sizeof (memif_main_t));
+ clib_memset (mm, 0, sizeof (memif_main_t));
mm->log_class = vlib_log_register_class ("memif_plugin", 0);
memif_log_debug (0, "initialized");
diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c
index a4137e48006..77a87cc709d 100644
--- a/src/plugins/memif/memif_api.c
+++ b/src/plugins/memif/memif_api.c
@@ -274,7 +274,7 @@ send_memif_details (vl_api_registration_t * reg,
hwif = vnet_get_sup_hw_interface (vnm, swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_MEMIF_DETAILS + mm->msg_id_base);
mp->context = context;
@@ -347,7 +347,7 @@ send_memif_socket_filename_details (vl_api_registration_t * reg,
memif_main_t *mm = &memif_main;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_MEMIF_SOCKET_FILENAME_DETAILS
+ mm->msg_id_base);
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 53a355361a6..997ac8fcbad 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -750,7 +750,7 @@ refill:
goto done;
memif_desc_t *dt = &ptd->desc_template;
- memset (dt, 0, sizeof (memif_desc_t));
+ clib_memset (dt, 0, sizeof (memif_desc_t));
dt->length = buffer_length;
n_alloc = vlib_buffer_alloc_to_ring (vm, mq->buffers, head & mask,
diff --git a/src/plugins/memif/socket.c b/src/plugins/memif/socket.c
index ac48ba88da5..fac8cd4838e 100644
--- a/src/plugins/memif/socket.c
+++ b/src/plugins/memif/socket.c
@@ -356,7 +356,7 @@ memif_msg_receive_add_ring (memif_if_t * mif, memif_msg_t * msg, int fd)
}
// clear previous cache data if interface reconncected
- memset (mq, 0, sizeof (memif_queue_t));
+ clib_memset (mq, 0, sizeof (memif_queue_t));
mq->int_fd = fd;
mq->int_clib_file_index = ~0;
mq->log2_ring_size = ar->log2_ring_size;
@@ -656,7 +656,7 @@ memif_conn_fd_accept_ready (clib_file_t * uf)
clib_socket_t *client;
client = clib_mem_alloc (sizeof (clib_socket_t));
- memset (client, 0, sizeof (clib_socket_t));
+ clib_memset (client, 0, sizeof (clib_socket_t));
err = clib_socket_accept (msf->sock, client);
if (err)
goto error;
diff --git a/src/plugins/nat/dslite_in2out.c b/src/plugins/nat/dslite_in2out.c
index 4eec5958da9..e7a3028f28a 100644
--- a/src/plugins/nat/dslite_in2out.c
+++ b/src/plugins/nat/dslite_in2out.c
@@ -56,7 +56,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
(&dm->per_thread_data[thread_index].b4_hash, &b4_kv, &b4_value))
{
pool_get (dm->per_thread_data[thread_index].b4s, b4);
- memset (b4, 0, sizeof (*b4));
+ clib_memset (b4, 0, sizeof (*b4));
b4->addr.as_u64[0] = in2out_key->softwire_id.as_u64[0];
b4->addr.as_u64[1] = in2out_key->softwire_id.as_u64[1];
@@ -119,7 +119,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
return DSLITE_IN2OUT_NEXT_DROP;
}
pool_get (dm->per_thread_data[thread_index].sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
b4->nsessions++;
pool_get (dm->per_thread_data[thread_index].list_pool, elt);
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 2ebd6834d92..8115a578e52 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -293,7 +293,7 @@ nat_user_get_or_create (snat_main_t * sm, ip4_address_t * addr, u32 fib_index,
{
/* no, make a new one */
pool_get (tsm->users, u);
- memset (u, 0, sizeof (*u));
+ clib_memset (u, 0, sizeof (*u));
u->addr.as_u32 = addr->as_u32;
u->fib_index = fib_index;
@@ -368,7 +368,7 @@ nat_session_alloc_or_recycle (snat_main_t * sm, snat_user_t * u,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -440,7 +440,7 @@ nat_ed_session_alloc (snat_main_t * sm, snat_user_t * u, u32 thread_index,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -845,7 +845,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->local_addr = l_addr;
m->external_addr = e_addr;
@@ -1186,7 +1186,7 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->external_addr = e_addr;
m->external_port = e_port;
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c
index 0a3379acb32..0c5b80c394e 100644
--- a/src/plugins/nat/nat44_cli.c
+++ b/src/plugins/nat/nat44_cli.c
@@ -861,7 +861,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
if (unformat (line_input, "local %U:%u probability %u",
unformat_ip4_address, &l_addr, &l_port, &probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
@@ -871,7 +871,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
unformat_ip4_address, &l_addr, &l_port, &vrf_id,
&probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 8396bd1b76b..86c65edfbee 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -157,7 +157,7 @@ nat64_get_worker_out2in (ip4_header_t * ip)
ip46_address_t daddr;
nat64_db_bib_entry_t *bibe;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip->dst_address.as_u32;
/* *INDENT-OFF* */
@@ -687,7 +687,7 @@ nat64_add_del_static_bib_entry (ip6_address_t * in_addr,
foreach_snat_protocol
#undef _
default:
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = out_addr->as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, fib_index, 0))
return VNET_API_ERROR_INVALID_VALUE;
diff --git a/src/plugins/nat/nat64_db.c b/src/plugins/nat/nat64_db.c
index 9ff68c80282..bb327a57152 100644
--- a/src/plugins/nat/nat64_db.c
+++ b/src/plugins/nat/nat64_db.c
@@ -86,7 +86,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
db->bib.bib_entries_num++;
- memset (bibe, 0, sizeof (*bibe));
+ clib_memset (bibe, 0, sizeof (*bibe));
bibe->in_addr.as_u64[0] = in_addr->as_u64[0];
bibe->in_addr.as_u64[1] = in_addr->as_u64[1];
bibe->in_port = in_port;
@@ -108,7 +108,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 1);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -179,7 +179,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 0);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -407,7 +407,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
db->st.st_entries_num++;
- memset (ste, 0, sizeof (*ste));
+ clib_memset (ste, 0, sizeof (*ste));
ste->in_r_addr.as_u64[0] = in_r_addr->as_u64[0];
ste->in_r_addr.as_u64[1] = in_r_addr->as_u64[1];
ste->out_r_addr.as_u32 = out_r_addr->as_u32;
@@ -419,7 +419,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
bibe->ses_num++;
/* create hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -436,7 +436,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 1);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -491,7 +491,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
db->st.st_entries_num--;
/* delete hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -508,7 +508,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 0);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -565,7 +565,7 @@ nat64_db_st_entry_find (nat64_db_t * db, ip46_address_t * l_addr,
break;
}
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = l_addr->as_u64[0];
ste_key.l_addr.as_u64[1] = l_addr->as_u64[1];
ste_key.r_addr.as_u64[0] = r_addr->as_u64[0];
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index dc5cc005fd7..d19aab87983 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -445,9 +445,9 @@ unk_proto_st_walk (nat64_db_st_entry_t * ste, void *arg)
if (ip46_address_is_equal (&bibe->in_addr, &ctx->src_addr)
&& bibe->fib_index == ctx->fib_index)
{
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = bibe->out_addr.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
nat64_extract_ip4 (&ctx->dst_addr, &daddr.ip4, ctx->fib_index);
if (nat64_db_st_entry_find
@@ -518,7 +518,7 @@ nat64_in2out_unk_proto_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -646,7 +646,7 @@ nat64_in2out_tcp_udp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
sport = udp->src_port = bibe->out_port;
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -746,8 +746,8 @@ nat64_in2out_icmp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
dport = udp->dst_port = bibe->out_port;
nat64_compose_ip6 (&inner_ip6->dst_address, &bibe->out_addr, fib_index);
- memset (&saddr, 0, sizeof (saddr));
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
saddr.ip4.as_u32 = ste->out_r_addr.as_u32;
daddr.ip4.as_u32 = bibe->out_addr.as_u32;
@@ -859,7 +859,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -896,7 +896,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -1279,7 +1279,7 @@ nat64_in2out_frag_hairpinning (vlib_buffer_t * b, ip6_header_t * ip6,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, bibe->fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index 89bb71c8960..79ff161b326 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -134,9 +134,9 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -202,9 +202,9 @@ nat64_out2in_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (icmp->type == ICMP6_echo_request || icmp->type == ICMP6_echo_reply)
@@ -276,9 +276,9 @@ nat64_out2in_inner_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
fib_index =
fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP6, sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (proto == IP_PROTOCOL_ICMP6)
@@ -368,9 +368,9 @@ nat64_out2in_unk_proto_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -738,9 +738,9 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
ctx0.first_frag = 1;
- memset (&saddr0, 0, sizeof (saddr0));
+ clib_memset (&saddr0, 0, sizeof (saddr0));
saddr0.ip4.as_u32 = ip40->src_address.as_u32;
- memset (&daddr0, 0, sizeof (daddr0));
+ clib_memset (&daddr0, 0, sizeof (daddr0));
daddr0.ip4.as_u32 = ip40->dst_address.as_u32;
ste0 =
diff --git a/src/plugins/nat/nat66.c b/src/plugins/nat/nat66.c
index 729674171d7..a0f6ec7929a 100644
--- a/src/plugins/nat/nat66.c
+++ b/src/plugins/nat/nat66.c
@@ -165,7 +165,7 @@ nat66_static_mapping_add_del (ip6_address_t * l_addr, ip6_address_t * e_addr,
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
FIB_SOURCE_PLUGIN_HI);
pool_get (nm->sm, sm);
- memset (sm, 0, sizeof (*sm));
+ clib_memset (sm, 0, sizeof (*sm));
sm->l_addr.as_u64[0] = l_addr->as_u64[0];
sm->l_addr.as_u64[1] = l_addr->as_u64[1];
sm->e_addr.as_u64[0] = e_addr->as_u64[0];
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index 4727826049b..378e7abe871 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -202,7 +202,7 @@ send_nat_worker_details (u32 worker_index, vl_api_registration_t * reg,
vlib_worker_threads + worker_index + sm->first_worker_index;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_WORKER_DETAILS + sm->msg_id_base);
rmp->context = context;
rmp->worker_index = htonl (worker_index);
@@ -350,7 +350,7 @@ nat_ip4_reass_walk_api (nat_reass_ip4_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 4);
@@ -373,7 +373,7 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 16);
@@ -718,7 +718,7 @@ send_nat44_address_details (snat_address_t * a,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -807,7 +807,7 @@ send_nat44_interface_details (snat_interface_t * i,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -896,7 +896,7 @@ send_nat44_interface_output_feature_details (snat_interface_t * i,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
@@ -1024,7 +1024,7 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1059,7 +1059,7 @@ send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1198,7 +1198,7 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m, int index,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1223,7 +1223,7 @@ send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1331,7 +1331,7 @@ send_nat44_interface_addr_details (u32 sw_if_index,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_INTERFACE_ADDR_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (sw_if_index);
@@ -1384,7 +1384,7 @@ send_nat44_user_details (snat_user_t * u, vl_api_registration_t * reg,
ip4_main_t *im = &ip4_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_USER_DETAILS + sm->msg_id_base);
if (!pool_is_free_index (im->fibs, u->fib_index))
@@ -1445,7 +1445,7 @@ send_nat44_user_session_details (snat_session_t * s,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_USER_SESSION_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->outside_ip_address, (&s->out2in.addr), 4);
@@ -1564,7 +1564,7 @@ unformat_nat44_lb_addr_port (vl_api_nat44_lb_addr_port_t * addr_port_pairs,
for (i = 0; i < addr_port_pair_num; i++)
{
ap = &addr_port_pairs[i];
- memset (&lb_addr_port, 0, sizeof (lb_addr_port));
+ clib_memset (&lb_addr_port, 0, sizeof (lb_addr_port));
clib_memcpy (&lb_addr_port.addr, ap->addr, 4);
lb_addr_port.port = clib_net_to_host_u16 (ap->port);
lb_addr_port.probability = ap->probability;
@@ -1644,7 +1644,7 @@ send_nat44_lb_static_mapping_details (snat_static_mapping_t * m,
rmp =
vl_msg_api_alloc (sizeof (*rmp) +
(vec_len (m->locals) * sizeof (nat44_lb_addr_port_t)));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_LB_STATIC_MAPPING_DETAILS + sm->msg_id_base);
@@ -1825,7 +1825,7 @@ static void
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_FORWARDING_IS_ENABLED_REPLY + sm->msg_id_base);
rmp->context = mp->context;
@@ -1982,7 +1982,7 @@ send_reply:
REPLY_MACRO2 (VL_API_NAT_DET_REVERSE_REPLY,
({
rmp->is_nat44 = 1;
- memset (rmp->in_addr, 0, 16);
+ clib_memset (rmp->in_addr, 0, 16);
clib_memcpy (rmp->in_addr, &in_addr, 4);
}))
/* *INDENT-ON* */
@@ -2008,7 +2008,7 @@ sent_nat_det_map_details (snat_det_map_t * m, vl_api_registration_t * reg,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_MAP_DETAILS + sm->msg_id_base);
rmp->is_nat44 = 1;
clib_memcpy (rmp->in_addr, &m->in_addr, 4);
@@ -2179,7 +2179,7 @@ send_nat_det_session_details (snat_det_session_t * s,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_SESSION_DETAILS + sm->msg_id_base);
rmp->in_port = s->in_port;
clib_memcpy (rmp->ext_addr, &s->out.ext_host_addr, 4);
@@ -2211,7 +2211,7 @@ vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
if (!mp->is_nat44)
return;
- memset (&empty_ses, 0, sizeof (empty_ses));
+ clib_memset (&empty_ses, 0, sizeof (empty_ses));
clib_memcpy (&user_addr, mp->user_addr, 4);
dm = snat_det_map_by_user (sm, &user_addr);
if (!dm)
@@ -2307,7 +2307,7 @@ nat64_api_pool_walk (snat_address_t * a, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_POOL_ADDR_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -2395,7 +2395,7 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -2489,7 +2489,7 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
return -1;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_BIB_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->i_addr, &(bibe->in_addr), 16);
@@ -2556,7 +2556,7 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
return -1;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_ST_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->il_addr, &(bibe->in_addr), 16);
@@ -2646,7 +2646,7 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_PREFIX_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->prefix, &(p->prefix), 16);
rmp->prefix_len = p->plen;
@@ -2887,7 +2887,7 @@ send_dslite_address_details (snat_address_t * ap,
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_DSLITE_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(ap->addr), 4);
@@ -3025,7 +3025,7 @@ nat66_api_interface_walk (snat_interface_t * i, void *arg)
nat66_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT66_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = nat_interface_is_inside (i);
@@ -3081,7 +3081,7 @@ nat66_api_static_mapping_walk (nat66_static_mapping_t * m, void *arg)
vlib_get_combined_counter (&nm->session_counters, m - nm->sm, &vc);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT66_STATIC_MAPPING_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->local_ip_address, &m->l_addr, 16);
diff --git a/src/plugins/nat/nat_det.c b/src/plugins/nat/nat_det.c
index 1b00d40b4ae..0ab96dc1026 100644
--- a/src/plugins/nat/nat_det.c
+++ b/src/plugins/nat/nat_det.c
@@ -72,7 +72,7 @@ snat_det_add_map (snat_main_t * sm, ip4_address_t * in_addr, u8 in_plen,
if (is_add)
{
pool_get (sm->det_maps, det_map);
- memset (det_map, 0, sizeof (*det_map));
+ clib_memset (det_map, 0, sizeof (*det_map));
det_map->in_addr.as_u32 = in_cmp.as_u32;
det_map->in_plen = in_plen;
det_map->out_addr.as_u32 = out_cmp.as_u32;
diff --git a/src/plugins/nat/nat_ipfix_logging.c b/src/plugins/nat/nat_ipfix_logging.c
index b2c167096aa..8a3668e2759 100644
--- a/src/plugins/nat/nat_ipfix_logging.c
+++ b/src/plugins/nat/nat_ipfix_logging.c
@@ -1929,7 +1929,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
silm->enabled = e;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = enable;
a.domain_id = domain_id ? domain_id : 1;
a.src_port = src_port ? src_port : UDP_DST_PORT_ipfix;
diff --git a/src/plugins/nat/nat_test.c b/src/plugins/nat/nat_test.c
index 0a2896b9848..b1de5340b9d 100644
--- a/src/plugins/nat/nat_test.c
+++ b/src/plugins/nat/nat_test.c
@@ -707,7 +707,7 @@ static int api_nat44_user_session_dump(vat_main_t * vam)
/* Use a control ping for synchronization */
M(NAT_CONTROL_PING, mp_ping);
- memset(mp->ip_address, 0, 16);
+ clib_memset(mp->ip_address, 0, 16);
clib_memcpy(mp->ip_address, &addr, 4);
mp->vrf_id = htonl(vrf_id);
S(mp_ping);
diff --git a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
index 9ea5447eba8..f409aa6f2d0 100644
--- a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
+++ b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
@@ -128,7 +128,7 @@ nsh_md2_ioam_encap_transit (vlib_main_t * vm,
uword *t = NULL;
nsh_md2_ioam_main_t *hm = &nsh_md2_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/nsh/nsh-md2-ioam/nsh_md2_ioam.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
index 1fa1c55b00f..73b57f64e90 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
@@ -100,12 +100,12 @@ nsh_md2_ioam_enable_disable_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;
#define TRANSIT_UNIT_TEST_HACK 1
#ifdef TRANSIT_UNIT_TEST_HACK
- memset(&dst_addr, 0, sizeof(dst_addr));
+ clib_memset(&dst_addr, 0, sizeof(dst_addr));
dst_addr.ip4.as_u32 = clib_net_to_host_u32(0x14020102);
#endif
fib_prefix.fp_addr = dst_addr;
@@ -226,7 +226,7 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
nsh_md2_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);
@@ -237,11 +237,11 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
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));
- memset(key4_copy, 0, sizeof(*key4_copy));
+ clib_memset(key4_copy, 0, sizeof(*key4_copy));
clib_memcpy (key4_copy, &key4, sizeof (*key4_copy));
hash_set_mem (hm->dst_by_ip4, key4_copy, t1 - hm->dst_tunnels);
/*
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
index 1baa2365b15..495bb16aab2 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
@@ -366,7 +366,7 @@ nsh_md2_ioam_trace_init (vlib_main_t * vm)
gm->unix_time_0 = (u32) time (0); /* Store starting time */
gm->vlib_time_0 = vlib_time_now (vm);
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (nsh_md2_register_option
(clib_host_to_net_u16 (0x9),
diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c
index ced898c04df..d9b625cda04 100644
--- a/src/plugins/nsh/nsh.c
+++ b/src/plugins/nsh/nsh.c
@@ -154,7 +154,7 @@ nsh_md2_register_option (u16 class,
pool_get_aligned (nm->nsh_option_mappings, nsh_option,
CLIB_CACHE_LINE_BYTES);
- memset (nsh_option, 0, sizeof (*nsh_option));
+ clib_memset (nsh_option, 0, sizeof (*nsh_option));
nsh_option->option_id = nsh_option - nm->nsh_option_mappings;
key_copy = clib_mem_alloc (sizeof (*key_copy));
@@ -527,7 +527,7 @@ nsh_add_del_map (nsh_add_del_map_args_t * a, u32 * map_indexp)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_mappings, map, CLIB_CACHE_LINE_BYTES);
- memset (map, 0, sizeof (*map));
+ clib_memset (map, 0, sizeof (*map));
/* copy from arg structure */
map->nsp_nsi = a->map.nsp_nsi;
@@ -614,7 +614,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
hash_pair_t *hp;
u32 nsp = 0, nsi = 0;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.transport_type = a->map.next_node;
key.transport_index = a->map.sw_if_index;
@@ -627,7 +627,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_proxy_sessions, proxy, CLIB_CACHE_LINE_BYTES);
- memset (proxy, 0, sizeof (*proxy));
+ clib_memset (proxy, 0, sizeof (*proxy));
/* Nsi needs to minus 1 within NSH-Proxy */
nsp = (a->map.nsp_nsi >> NSH_NSP_SHIFT) & NSH_NSP_MASK;
@@ -783,7 +783,7 @@ nsh_add_del_map_command_fn (vlib_main_t * vm,
return clib_error_return (0,
"must specific action: [encap-gre-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-lisp-gpe-intf <nn> | encap-none <tx_sw_if_index> <rx_sw_if_index>]");
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* set args structure */
a->is_add = is_add;
@@ -933,7 +933,7 @@ nsh_header_rewrite (nsh_entry_t * nsh_entry)
len = MAX_NSH_HEADER_LEN;
}
vec_validate_aligned (rw, len - 1, CLIB_CACHE_LINE_BYTES);
- memset (rw, 0, len);
+ clib_memset (rw, 0, len);
nsh_base = (nsh_base_header_t *) rw;
nsh_base->ver_o_c = nsh_entry->nsh_base.ver_o_c;
@@ -1033,7 +1033,7 @@ nsh_add_del_entry (nsh_add_del_entry_args_t * a, u32 * entry_indexp)
return -1; // TODO VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_entries, nsh_entry, CLIB_CACHE_LINE_BYTES);
- memset (nsh_entry, 0, sizeof (*nsh_entry));
+ clib_memset (nsh_entry, 0, sizeof (*nsh_entry));
/* copy from arg structure */
#define _(x) nsh_entry->nsh_base.x = a->nsh_entry.nsh_base.x;
@@ -1185,7 +1185,7 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm,
nsp_nsi = (nsp << 8) | nsi;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
if (md_type == 1)
@@ -1318,7 +1318,7 @@ static void send_nsh_entry_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_ENTRY_DETAILS) + nm->msg_id_base);
rmp->ver_o_c = t->nsh_base.ver_o_c;
@@ -1391,7 +1391,7 @@ static void send_nsh_map_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_MAP_DETAILS) + nm->msg_id_base);
rmp->nsp_nsi = htonl (t->nsp_nsi);
@@ -1784,7 +1784,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
@@ -1949,7 +1949,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key1, 0, sizeof (key1));
+ clib_memset (&key1, 0, sizeof (key1));
key1.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key1.transport_index = vnet_buffer (b1)->sw_if_index[VLIB_RX];
@@ -2151,7 +2151,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
diff --git a/src/plugins/nsh/nsh_test.c b/src/plugins/nsh/nsh_test.c
index 3867289f737..0852956dc3e 100644
--- a/src/plugins/nsh/nsh_test.c
+++ b/src/plugins/nsh/nsh_test.c
@@ -102,7 +102,7 @@ _(NSH_MAP_DETAILS, nsh_map_details)
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);
@@ -111,7 +111,7 @@ do { \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
- 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);
diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c
index d73a71857c6..0595767f62f 100644
--- a/src/plugins/pppoe/pppoe.c
+++ b/src/plugins/pppoe/pppoe.c
@@ -273,7 +273,7 @@ int vnet_pppoe_add_del_session
cached_key.raw = ~0;
cached_result.raw = ~0; /* warning be gone */
- memset (&pfx, 0, sizeof (pfx));
+ clib_memset (&pfx, 0, sizeof (pfx));
if (!is_ip6)
{
@@ -320,7 +320,7 @@ int vnet_pppoe_add_del_session
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (pem->sessions, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
clib_memcpy (t->local_mac, hi->hw_address, 6);
@@ -455,7 +455,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&client_ip, 0, sizeof client_ip);
+ clib_memset (&client_ip, 0, sizeof client_ip);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -527,7 +527,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c
index 4c65ec4ebd6..638505c40c0 100644
--- a/src/plugins/pppoe/pppoe_api.c
+++ b/src/plugins/pppoe/pppoe_api.c
@@ -126,7 +126,7 @@ static void send_pppoe_session_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->client_ip);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_PPPOE_SESSION_DETAILS);
if (is_ipv6)
{
diff --git a/src/plugins/pppoe/pppoe_test.c b/src/plugins/pppoe/pppoe_test.c
index a32f1b76fe0..0d085ed3d97 100644
--- a/src/plugins/pppoe/pppoe_test.c
+++ b/src/plugins/pppoe/pppoe_test.c
@@ -143,7 +143,7 @@ api_pppoe_add_del_session (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&client_ip, 0, sizeof client_ip);
+ clib_memset (&client_ip, 0, sizeof client_ip);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/srv6-ad/ad.c b/src/plugins/srv6-ad/ad.c
index 64bf66d8482..bc55bc1abe4 100644
--- a/src/plugins/srv6-ad/ad.c
+++ b/src/plugins/srv6-ad/ad.c
@@ -354,7 +354,7 @@ unformat_srv6_ad_localsid (unformat_input_t * input, va_list * args)
/* Allocate and initialize memory block for local SID parameters */
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
/* Set local SID parameters */
diff --git a/src/plugins/srv6-am/am.c b/src/plugins/srv6-am/am.c
index 877b1b3c116..ce8b4d9b2ce 100644
--- a/src/plugins/srv6-am/am.c
+++ b/src/plugins/srv6-am/am.c
@@ -141,7 +141,7 @@ unformat_srv6_am_localsid (unformat_input_t * input, va_list * args)
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
/* Set to zero the memory */
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
/* Our brand-new car is ready */
clib_memcpy (&ls_mem->nh_addr.ip6, &nh_addr.ip6,
diff --git a/src/plugins/srv6-as/as.c b/src/plugins/srv6-as/as.c
index e771cb485ef..ea13fc8834e 100644
--- a/src/plugins/srv6-as/as.c
+++ b/src/plugins/srv6-as/as.c
@@ -462,7 +462,7 @@ unformat_srv6_as_localsid (unformat_input_t * input, va_list * args)
/* Allocate and initialize memory block for local SID parameters */
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
/* Set local SID parameters */
diff --git a/src/plugins/stn/stn_api.c b/src/plugins/stn/stn_api.c
index 8f9e2ea41ee..40d4103b1ec 100644
--- a/src/plugins/stn/stn_api.c
+++ b/src/plugins/stn/stn_api.c
@@ -107,7 +107,7 @@ send_stn_rules_details (stn_rule_t * r, vl_api_registration_t * reg,
vl_api_stn_rules_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
clib_host_to_net_u16 (VL_API_STN_RULES_DETAILS + stn_main.msg_id_base);
diff --git a/src/plugins/svs/svs_api.c b/src/plugins/svs/svs_api.c
index b6c8117064d..03941fea08e 100644
--- a/src/plugins/svs/svs_api.c
+++ b/src/plugins/svs/svs_api.c
@@ -80,7 +80,7 @@ vl_api_svs_plugin_get_version_t_handler (vl_api_svs_plugin_get_version_t * mp)
}
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_SVS_PLUGIN_GET_VERSION_REPLY + svs_base_msg_id);
rmp->context = mp->context;
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index 1010e370880..52d124eb84e 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -55,7 +55,7 @@ mbedtls_calloc_fn (size_t n, size_t size)
{
void *ptr;
ptr = clib_mem_alloc (n * size);
- memset (ptr, 0, sizeof (*ptr));
+ clib_memset (ptr, 0, sizeof (*ptr));
return ptr;
}
@@ -78,7 +78,7 @@ mbedtls_ctx_alloc (void)
if (!(*ctx))
*ctx = clib_mem_alloc (sizeof (mbedtls_ctx_t));
- memset (*ctx, 0, sizeof (mbedtls_ctx_t));
+ clib_memset (*ctx, 0, sizeof (mbedtls_ctx_t));
(*ctx)->ctx.c_thread_index = thread_index;
(*ctx)->ctx.tls_ctx_engine = TLS_ENGINE_MBEDTLS;
(*ctx)->mbedtls_ctx_index = ctx - tm->ctx_pool[thread_index];
diff --git a/src/plugins/tlsopenssl/tls_async.c b/src/plugins/tlsopenssl/tls_async.c
index a05996b39b1..8931ef5374f 100644
--- a/src/plugins/tlsopenssl/tls_async.c
+++ b/src/plugins/tlsopenssl/tls_async.c
@@ -240,7 +240,7 @@ openssl_evt_alloc (void)
if (!(*evt))
*evt = clib_mem_alloc (sizeof (openssl_evt_t));
- memset (*evt, 0, sizeof (openssl_evt_t));
+ clib_memset (*evt, 0, sizeof (openssl_evt_t));
(*evt)->event_index = evt - tm->evt_pool[thread_index];
return ((*evt)->event_index);
}
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index b8757a9ffb7..7994cc5d981 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -40,7 +40,7 @@ openssl_ctx_alloc (void)
if (!(*ctx))
*ctx = clib_mem_alloc (sizeof (openssl_ctx_t));
- memset (*ctx, 0, sizeof (openssl_ctx_t));
+ clib_memset (*ctx, 0, sizeof (openssl_ctx_t));
(*ctx)->ctx.c_thread_index = thread_index;
(*ctx)->ctx.tls_ctx_engine = TLS_ENGINE_OPENSSL;
(*ctx)->ctx.app_session_handle = SESSION_INVALID_HANDLE;
@@ -87,7 +87,7 @@ openssl_listen_ctx_alloc (void)
pool_get (om->lctx_pool, lctx);
- memset (lctx, 0, sizeof (openssl_listen_ctx_t));
+ clib_memset (lctx, 0, sizeof (openssl_listen_ctx_t));
lctx->openssl_lctx_index = lctx - om->lctx_pool;
return lctx->openssl_lctx_index;
}
diff --git a/src/plugins/unittest/CMakeLists.txt b/src/plugins/unittest/CMakeLists.txt
index f790a23a60e..2dfa8379c52 100644
--- a/src/plugins/unittest/CMakeLists.txt
+++ b/src/plugins/unittest/CMakeLists.txt
@@ -16,4 +16,5 @@ add_vpp_plugin(unittest
unittest.c
tcp_test.c
bihash_test.c
+ string_test.c
)
diff --git a/src/plugins/unittest/string_test.c b/src/plugins/unittest/string_test.c
new file mode 100644
index 00000000000..a5caa9094f0
--- /dev/null
+++ b/src/plugins/unittest/string_test.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <vlib/vlib.h>
+#include <vppinfra/string.h>
+
+static int
+test_clib_memset (vlib_main_t * vm, unformat_input_t * input)
+{
+ u8 dst[64];
+ int i;
+ errno_t err;
+
+ vlib_cli_output (vm, "Test memset_s...");
+
+ err = memset_s (dst, ARRAY_LEN (dst), 0xfe, ARRAY_LEN (dst));
+
+ if (err != EOK)
+ return -1;
+
+ for (i = 0; i < ARRAY_LEN (dst); i++)
+ if (dst[i] != 0xFE)
+ return -1;
+
+ err = memset_s (dst, ARRAY_LEN (dst), 0xfa, ARRAY_LEN (dst) + 1);
+
+ if (err == EOK)
+ return -1;
+
+ return 0;
+}
+
+static int
+test_memcpy (vlib_main_t * vm, unformat_input_t * input)
+{
+ char src[64], dst[64];
+ int i;
+ errno_t err;
+
+ vlib_cli_output (vm, "Test memcpy_s...");
+
+ for (i = 0; i < ARRAY_LEN (src); i++)
+ src[i] = i + 1;
+
+ /* Typical case */
+ err = memcpy_s (dst, sizeof (dst), src, sizeof (src));
+
+ if (err != EOK)
+ return -1;
+
+ /* This better not fail but check anyhow */
+ for (i = 0; i < ARRAY_LEN (dst); i++)
+ if (src[i] != dst[i])
+ return -1;
+
+ /* Size fail */
+ err = memcpy_s (dst + 1, sizeof (dst) - 1, src, sizeof (src));
+
+ if (err == EOK)
+ return -1;
+
+ /* overlap fail */
+ err = memcpy_s (dst, sizeof (dst), dst + 1, sizeof (dst) - 1);
+
+ if (err == EOK)
+ return -1;
+
+ /* Zero length copy */
+ err = memcpy_s (0, sizeof (dst), src, 0);
+
+ if (err != EOK)
+ return -1;
+
+ /* OK, seems to work */
+ return 0;
+}
+
+static clib_error_t *
+string_test_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd_arg)
+{
+ int res = 0;
+ u8 t_memcpy = 0;
+ u8 t_clib_memset = 0;
+ u8 specific_test;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "memcpy_s"))
+ t_memcpy = 1;
+ else if (unformat (input, "memset_s"))
+ t_clib_memset = 1;
+ break;
+ }
+
+ specific_test = t_memcpy + t_clib_memset;
+
+ if (specific_test == 0)
+ {
+ res = test_memcpy (vm, input);
+ res += test_clib_memset (vm, input);
+ goto done;
+ }
+
+ if (t_memcpy)
+ res = test_memcpy (vm, input);
+ else if (t_clib_memset)
+ res = test_clib_memset (vm, input);
+
+done:
+ if (res)
+ vlib_cli_output (vm, "String unit test(s) failed...");
+ else
+ vlib_cli_output (vm, "String unit test(s) OK...");
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (string_test_command, static) =
+{
+ .path = "test string",
+ .short_help = "string library tests",
+ .function = string_test_command_fn,
+};
+/* *INDENT-ON* */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index d06578771c0..3bde8054901 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -83,7 +83,7 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input)
return tcp_test_scoreboard_replay (vm, input);
}
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->snd_una = 0;
tc->snd_una_max = 1000;
@@ -458,7 +458,7 @@ tcp_test_sack_tx (vlib_main_t * vm, unformat_input_t * input)
}
}
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
/*
* Add odd sack block pairs
@@ -740,7 +740,7 @@ fifo_prepare (u32 fifo_size)
f = svm_fifo_create (fifo_size);
/* Paint fifo data vector with -1's */
- memset (f->data, 0xFF, fifo_size);
+ clib_memset (f->data, 0xFF, fifo_size);
return f;
}
@@ -1647,11 +1647,11 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
* Allocate fake session and connection 1
*/
pool_get (smm->sessions[0], s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->session_index = sidx = s - smm->sessions[0];
pool_get (tm->connections[0], tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->connection.c_index = tc - tm->connections[0];
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
@@ -1668,11 +1668,11 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
* Allocate fake session and connection 2
*/
pool_get (session_manager_main.sessions[0], s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->session_index = s - smm->sessions[0];
pool_get (tm->connections[0], tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->connection.c_index = tc - tm->connections[0];
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
@@ -1769,7 +1769,7 @@ tcp_test_session (vlib_main_t * vm, unformat_input_t * input)
remote_port = clib_host_to_net_u16 (11234);
pool_get (tm->connections[0], tc0);
- memset (tc0, 0, sizeof (*tc0));
+ clib_memset (tc0, 0, sizeof (*tc0));
tc0->state = TCP_STATE_ESTABLISHED;
tc0->rcv_las = 1;
diff --git a/src/plugins/vmxnet3/cli.c b/src/plugins/vmxnet3/cli.c
index 170f9ad7f5b..1a97dc0d0fa 100644
--- a/src/plugins/vmxnet3/cli.c
+++ b/src/plugins/vmxnet3/cli.c
@@ -38,7 +38,7 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "%U", unformat_vlib_pci_addr, &args.addr))
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index 375224142f9..e34b3e69a27 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -153,7 +153,7 @@ vmxnet3_provision_driver_shared (vlib_main_t * vm, vmxnet3_device_t * vd)
if (error)
return error;
- memset (vd->dma, 0, sizeof (*vd->dma));
+ clib_memset (vd->dma, 0, sizeof (*vd->dma));
q = &vd->dma->queues;
q->tx.cfg.desc_address = vmxnet3_dma_addr (vm, vd, txq->tx_desc);
@@ -229,7 +229,7 @@ vmxnet3_rxq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
vec_validate_aligned (vd->rxqs, qid, CLIB_CACHE_LINE_BYTES);
rxq = vec_elt_at_index (vd->rxqs, qid);
- memset (rxq, 0, sizeof (*rxq));
+ clib_memset (rxq, 0, sizeof (*rxq));
rxq->size = qsz;
for (rid = 0; rid < VMXNET3_RX_RING_SIZE; rid++)
{
@@ -239,14 +239,14 @@ vmxnet3_rxq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
512);
if (error)
return error;
- memset (rxq->rx_desc[rid], 0, qsz * sizeof (*rxq->rx_desc[rid]));
+ clib_memset (rxq->rx_desc[rid], 0, qsz * sizeof (*rxq->rx_desc[rid]));
}
rxq->rx_comp = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*rxq->rx_comp),
512);
if (error)
return error;
- memset (rxq->rx_comp, 0, qsz * sizeof (*rxq->rx_comp));
+ clib_memset (rxq->rx_comp, 0, qsz * sizeof (*rxq->rx_comp));
for (rid = 0; rid < VMXNET3_RX_RING_SIZE; rid++)
{
vmxnet3_rx_ring *ring;
@@ -280,20 +280,20 @@ vmxnet3_txq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
vec_validate_aligned (vd->txqs, qid, CLIB_CACHE_LINE_BYTES);
txq = vec_elt_at_index (vd->txqs, qid);
- memset (txq, 0, sizeof (*txq));
+ clib_memset (txq, 0, sizeof (*txq));
txq->size = qsz;
txq->tx_desc = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*txq->tx_desc),
512);
if (error)
return error;
- memset (txq->tx_desc, 0, qsz * sizeof (*txq->tx_desc));
+ clib_memset (txq->tx_desc, 0, qsz * sizeof (*txq->tx_desc));
txq->tx_comp = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*txq->tx_comp),
512);
if (error)
return error;
- memset (txq->tx_comp, 0, qsz * sizeof (*txq->tx_comp));
+ clib_memset (txq->tx_comp, 0, qsz * sizeof (*txq->tx_comp));
vec_validate_aligned (txq->tx_ring.bufs, txq->size, CLIB_CACHE_LINE_BYTES);
txq->tx_ring.gen = VMXNET3_TXF_GEN;
txq->tx_comp_ring.gen = VMXNET3_TXCF_GEN;
@@ -663,7 +663,7 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd)
vlib_physmem_free (vm, vmxm->physmem_region, vd->dma);
clib_error_free (vd->error);
- memset (vd, 0, sizeof (*vd));
+ clib_memset (vd, 0, sizeof (*vd));
pool_put (vmxm->devices, vd);
}
diff --git a/src/plugins/vmxnet3/vmxnet3_api.c b/src/plugins/vmxnet3/vmxnet3_api.c
index e0c2cfa6cf0..b41866be117 100644
--- a/src/plugins/vmxnet3/vmxnet3_api.c
+++ b/src/plugins/vmxnet3/vmxnet3_api.c
@@ -65,7 +65,7 @@ vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp)
vmxnet3_create_if_args_t args;
int rv;
- memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
+ clib_memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
args.enable_elog = ntohl (mp->enable_elog);
args.addr.as_u32 = ntohl (mp->pci_addr);
@@ -125,7 +125,7 @@ send_vmxnet3_details (vl_api_registration_t * reg, vmxnet3_device_t * vd,
hwif = vnet_get_sup_hw_interface (vnm, swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_VMXNET3_DETAILS + vmxm->msg_id_base);
mp->context = context;
diff --git a/src/plugins/vmxnet3/vmxnet3_test.c b/src/plugins/vmxnet3/vmxnet3_test.c
index 1b5fd5b7c9a..53097f02d63 100644
--- a/src/plugins/vmxnet3/vmxnet3_test.c
+++ b/src/plugins/vmxnet3/vmxnet3_test.c
@@ -104,7 +104,7 @@ api_vmxnet3_create (vat_main_t * vam)
int ret;
u32 x[4];
- memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
+ clib_memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{