diff options
author | Dave Barach <dave@barachs.net> | 2018-10-17 10:38:51 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-23 13:06:46 +0000 |
commit | b7b929931a07fbb27b43d5cd105f366c3e29807e (patch) | |
tree | 438681c89738802dbb5d339715b96ea2c31bafb4 /src/vnet | |
parent | b9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff) |
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet')
219 files changed, 785 insertions, 781 deletions
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c index a06a12210bc..8740bb41465 100644 --- a/src/vnet/adj/adj.c +++ b/src/vnet/adj/adj.c @@ -50,7 +50,7 @@ adj_poison (ip_adjacency_t * adj) { if (CLIB_DEBUG > 0) { - memset (adj, 0xfe, sizeof (adj[0])); + clib_memset (adj, 0xfe, sizeof (adj[0])); } } @@ -80,7 +80,7 @@ adj_alloc (fib_protocol_t proto) adj->ia_delegates = NULL; /* lest it become a midchain in the future */ - memset(&adj->sub_type.midchain.next_dpo, 0, + clib_memset(&adj->sub_type.midchain.next_dpo, 0, sizeof(adj->sub_type.midchain.next_dpo)); return (adj); diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c index 3b1eb4962d0..ff535295b4b 100644 --- a/src/vnet/adj/adj_nbr.c +++ b/src/vnet/adj/adj_nbr.c @@ -59,7 +59,7 @@ adj_nbr_insert (fib_protocol_t nh_proto, adj_nbr_tables[nh_proto][sw_if_index] = clib_mem_alloc_aligned(sizeof(BVT(clib_bihash)), CLIB_CACHE_LINE_BYTES); - memset(adj_nbr_tables[nh_proto][sw_if_index], + clib_memset(adj_nbr_tables[nh_proto][sw_if_index], 0, sizeof(BVT(clib_bihash))); diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h index 0d4b0b9fd28..42b982e1bf4 100644 --- a/src/vnet/adj/rewrite.h +++ b/src/vnet/adj/rewrite.h @@ -115,24 +115,24 @@ struct { \ always_inline void vnet_rewrite_clear_data_internal (vnet_rewrite_header_t * rw, int max_size) { - /* Sanity check values carefully for this memset operation */ + /* Sanity check values carefully for this clib_memset operation */ ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE)); rw->data_bytes = 0; - memset (rw->data, 0xfe, max_size); + clib_memset (rw->data, 0xfe, max_size); } always_inline void vnet_rewrite_set_data_internal (vnet_rewrite_header_t * rw, int max_size, void *data, int data_bytes) { - /* Sanity check values carefully for this memset operation */ + /* Sanity check values carefully for this clib_memset operation */ ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE)); ASSERT ((data_bytes >= 0) && (data_bytes < max_size)); rw->data_bytes = data_bytes; clib_memcpy (rw->data + max_size - data_bytes, data, data_bytes); - memset (rw->data, 0xfe, max_size - data_bytes); + clib_memset (rw->data, 0xfe, max_size - data_bytes); } #define vnet_rewrite_set_data(rw,data,data_bytes) \ diff --git a/src/vnet/bfd/bfd_api.c b/src/vnet/bfd/bfd_api.c index fcd66950114..bb852256ad7 100644 --- a/src/vnet/bfd/bfd_api.c +++ b/src/vnet/bfd/bfd_api.c @@ -67,9 +67,9 @@ pub_sub_handler (bfd_events, BFD_EVENTS); #define BFD_UDP_API_PARAM_COMMON_CODE \ ip46_address_t local_addr; \ - memset (&local_addr, 0, sizeof (local_addr)); \ + clib_memset (&local_addr, 0, sizeof (local_addr)); \ ip46_address_t peer_addr; \ - memset (&peer_addr, 0, sizeof (peer_addr)); \ + clib_memset (&peer_addr, 0, sizeof (peer_addr)); \ if (mp->is_ipv6) \ { \ clib_memcpy (&local_addr.ip6, mp->local_addr, sizeof (local_addr.ip6)); \ @@ -151,7 +151,7 @@ send_bfd_udp_session_details (vl_api_registration_t * reg, u32 context, } vl_api_bfd_udp_session_details_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_BFD_UDP_SESSION_DETAILS); mp->context = context; mp->state = bs->local_state; @@ -286,7 +286,7 @@ vl_api_bfd_auth_keys_dump_t_handler (vl_api_bfd_auth_keys_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (key, bfd_main.auth_keys, ({ 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_BFD_AUTH_KEYS_DETAILS); rmp->context = mp->context; rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id); diff --git a/src/vnet/bfd/bfd_main.c b/src/vnet/bfd/bfd_main.c index bd2addf3b0f..ea584130d58 100644 --- a/src/vnet/bfd/bfd_main.c +++ b/src/vnet/bfd/bfd_main.c @@ -774,7 +774,7 @@ bfd_add_sha1_auth_section (vlib_buffer_t * b, bfd_session_t * bs) b->current_length += sizeof (*auth); pkt->pkt.head.length += sizeof (*auth); bfd_pkt_set_auth_present (&pkt->pkt); - memset (auth, 0, sizeof (*auth)); + clib_memset (auth, 0, sizeof (*auth)); auth->type_len.type = bs->auth.curr_key->auth_type; /* * only meticulous authentication types require incrementing seq number @@ -860,7 +860,7 @@ bfd_init_control_frame (bfd_main_t * bm, bfd_session_t * bs, bfd_pkt_t *pkt = vlib_buffer_get_current (b); u32 bfd_length = 0; bfd_length = sizeof (bfd_pkt_t); - memset (pkt, 0, sizeof (*pkt)); + clib_memset (pkt, 0, sizeof (*pkt)); bfd_pkt_set_version (pkt, 1); bfd_pkt_set_diag_code (pkt, bs->local_diag); bfd_pkt_set_state (pkt, bs->local_state); @@ -908,10 +908,10 @@ bfd_send_echo (vlib_main_t * vm, vlib_node_runtime_t * rt, } vlib_buffer_t *b = vlib_get_buffer (vm, bi); ASSERT (b->current_data == 0); - memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b))); + clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b))); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b); bfd_echo_pkt_t *pkt = vlib_buffer_get_current (b); - memset (pkt, 0, sizeof (*pkt)); + clib_memset (pkt, 0, sizeof (*pkt)); pkt->discriminator = bs->local_discr; pkt->expire_time_clocks = now + bs->echo_transmit_interval_clocks * bs->local_detect_mult; @@ -982,7 +982,7 @@ bfd_send_periodic (vlib_main_t * vm, vlib_node_runtime_t * rt, } vlib_buffer_t *b = vlib_get_buffer (vm, bi); ASSERT (b->current_data == 0); - memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b))); + clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b))); VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b); bfd_init_control_frame (bm, bs, b); switch (bs->poll_state) @@ -1315,7 +1315,7 @@ bfd_main_init (vlib_main_t * vm) bm->random_seed = random_default_seed (); bm->vlib_main = vm; bm->vnet_main = vnet_get_main (); - memset (&bm->wheel, 0, sizeof (bm->wheel)); + clib_memset (&bm->wheel, 0, sizeof (bm->wheel)); bm->cpu_cps = vm->clib_time.clocks_per_second; BFD_DBG ("cps is %.2f", bm->cpu_cps); bm->default_desired_min_tx_clocks = @@ -1343,7 +1343,7 @@ bfd_get_session (bfd_main_t * bm, bfd_transport_e t) bfd_lock (bm); pool_get (bm->sessions, result); - memset (result, 0, sizeof (*result)); + clib_memset (result, 0, sizeof (*result)); result->bs_idx = result - bm->sessions; result->transport = t; const unsigned limit = 1000; @@ -2207,7 +2207,7 @@ bfd_auth_set_key (u32 conf_key_id, u8 auth_type, u8 key_len, auth_key - bm->auth_keys); } auth_key->auth_type = auth_type; - memset (auth_key->key, 0, sizeof (auth_key->key)); + clib_memset (auth_key->key, 0, sizeof (auth_key->key)); clib_memcpy (auth_key->key, key_data, key_len); return 0; #else @@ -2238,7 +2238,7 @@ bfd_auth_del_key (u32 conf_key_id) return VNET_API_ERROR_BFD_EINUSE; } hash_unset (bm->auth_key_by_conf_key_id, conf_key_id); - memset (auth_key, 0, sizeof (*auth_key)); + clib_memset (auth_key, 0, sizeof (*auth_key)); pool_put (bm->auth_keys, auth_key); } else diff --git a/src/vnet/bfd/bfd_udp.c b/src/vnet/bfd/bfd_udp.c index ab530edcd7d..0da19bdb630 100644 --- a/src/vnet/bfd/bfd_udp.c +++ b/src/vnet/bfd/bfd_udp.c @@ -261,7 +261,7 @@ bfd_add_udp4_transport (vlib_main_t * vm, u32 bi, const bfd_session_t * bs, ip4_udp_headers *headers = NULL; vlib_buffer_advance (b, -sizeof (*headers)); headers = vlib_buffer_get_current (b); - memset (headers, 0, sizeof (*headers)); + clib_memset (headers, 0, sizeof (*headers)); headers->ip4.ip_version_and_header_length = 0x45; headers->ip4.ttl = 255; headers->ip4.protocol = IP_PROTOCOL_UDP; @@ -316,7 +316,7 @@ bfd_add_udp6_transport (vlib_main_t * vm, u32 bi, const bfd_session_t * bs, ip6_udp_headers *headers = NULL; vlib_buffer_advance (b, -sizeof (*headers)); headers = vlib_buffer_get_current (b); - memset (headers, 0, sizeof (*headers)); + clib_memset (headers, 0, sizeof (*headers)); headers->ip6.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); headers->ip6.hop_limit = 255; @@ -448,7 +448,7 @@ bfd_udp_key_init (bfd_udp_key_t * key, u32 sw_if_index, const ip46_address_t * local_addr, const ip46_address_t * peer_addr) { - memset (key, 0, sizeof (*key)); + clib_memset (key, 0, sizeof (*key)); key->sw_if_index = sw_if_index; key->local_addr.as_u64[0] = local_addr->as_u64[0]; key->local_addr.as_u64[1] = local_addr->as_u64[1]; @@ -476,7 +476,7 @@ bfd_udp_add_session_internal (bfd_udp_main_t * bum, u32 sw_if_index, return VNET_API_ERROR_BFD_EAGAIN; } bfd_udp_session_t *bus = &bs->udp; - memset (bus, 0, sizeof (*bus)); + clib_memset (bus, 0, sizeof (*bus)); bfd_udp_key_t *key = &bus->key; bfd_udp_key_init (key, sw_if_index, local_addr, peer_addr); const bfd_session_t *tmp = bfd_lookup_session (bum, key); @@ -1002,7 +1002,7 @@ bfd_udp4_scan (vlib_main_t * vm, vlib_node_runtime_t * rt, else { bfd_udp_key_t key; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; key.local_addr.ip4.as_u32 = ip4->dst_address.as_u32; key.peer_addr.ip4.as_u32 = ip4->src_address.as_u32; @@ -1144,7 +1144,7 @@ bfd_udp6_scan (vlib_main_t * vm, vlib_node_runtime_t * rt, else { bfd_udp_key_t key; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; key.local_addr.ip6.as_u64[0] = ip6->dst_address.as_u64[0]; key.local_addr.ip6.as_u64[1] = ip6->dst_address.as_u64[1]; @@ -1239,7 +1239,7 @@ bfd_udp_input (vlib_main_t * vm, vlib_node_runtime_t * rt, { b0->current_data = 0; b0->current_length = 0; - memset (vnet_buffer (b0), 0, sizeof (*vnet_buffer (b0))); + clib_memset (vnet_buffer (b0), 0, sizeof (*vnet_buffer (b0))); bfd_init_final_control_frame (vm, b0, bfd_udp_main.bfd_main, bs, 0); if (is_ipv6) diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c index 2e8fc626baa..b4bde3a97eb 100644 --- a/src/vnet/bier/bier_api.c +++ b/src/vnet/bier/bier_api.c @@ -123,7 +123,7 @@ send_bier_table_details (vl_api_registration_t * reg, mp = vl_msg_api_alloc(sizeof(*mp)); if (!mp) return; - memset(mp, 0, sizeof(*mp)); + clib_memset(mp, 0, sizeof(*mp)); mp->_vl_msg_id = ntohs(VL_API_BIER_TABLE_DETAILS); mp->context = context; @@ -254,7 +254,7 @@ send_bier_route_details (const bier_table_t *bt, if (!mp) return; - memset(mp, 0, m_size); + clib_memset(mp, 0, m_size); mp->_vl_msg_id = ntohs(VL_API_BIER_ROUTE_DETAILS); mp->context = ctx->context; @@ -373,7 +373,7 @@ send_bier_imp_details (vl_api_registration_t * reg, mp = vl_msg_api_alloc(sizeof(*mp) + n_bytes); if (!mp) return; - memset(mp, 0, sizeof(*mp)+n_bytes); + clib_memset(mp, 0, sizeof(*mp)+n_bytes); mp->_vl_msg_id = ntohs(VL_API_BIER_IMP_DETAILS); mp->context = context; @@ -440,7 +440,7 @@ send_bier_disp_table_details (vl_api_registration_t * reg, mp = vl_msg_api_alloc(sizeof(*mp)); if (!mp) return; - memset(mp, 0, sizeof(*mp)); + clib_memset(mp, 0, sizeof(*mp)); mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_TABLE_DETAILS); mp->context = context; @@ -616,7 +616,7 @@ send_bier_disp_entry_details (const bier_disp_table_t *bdt, if (!mp) return; - memset(mp, 0, m_size); + clib_memset(mp, 0, m_size); mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_ENTRY_DETAILS); mp->context = ctx->context; diff --git a/src/vnet/bier/bier_bift_table.c b/src/vnet/bier/bier_bift_table.c index cf0d552f192..76e29dc9e52 100644 --- a/src/vnet/bier/bier_bift_table.c +++ b/src/vnet/bier/bier_bift_table.c @@ -54,7 +54,7 @@ bier_bift_table_entry_add (bier_bift_id_t id, */ bier_bift_table = clib_mem_alloc_aligned(sizeof(*bier_bift_table), CLIB_CACHE_LINE_BYTES); - memset(bier_bift_table, 0, sizeof(*bier_bift_table)); + clib_memset(bier_bift_table, 0, sizeof(*bier_bift_table)); for (ii = 0; ii < BIER_BIFT_N_ENTRIES; ii++) { diff --git a/src/vnet/bier/bier_disp_table.c b/src/vnet/bier/bier_disp_table.c index 68edb088400..cf9f0538df7 100644 --- a/src/vnet/bier/bier_disp_table.c +++ b/src/vnet/bier/bier_disp_table.c @@ -75,7 +75,7 @@ bier_disp_table_add_or_lock (u32 table_id) /** * Set the result for each entry in the DB to be invalid */ - memset(bdt->bdt_db, 0xff, sizeof(bdt->bdt_db)); + clib_memset(bdt->bdt_db, 0xff, sizeof(bdt->bdt_db)); } else { diff --git a/src/vnet/bier/bier_fmask.c b/src/vnet/bier/bier_fmask.c index 3370d5a88e8..1ca8a2e1df9 100644 --- a/src/vnet/bier/bier_fmask.c +++ b/src/vnet/bier/bier_fmask.c @@ -54,7 +54,7 @@ bier_fmask_bits_init (bier_fmask_bits_t *bits, { bits->bfmb_refs = clib_mem_alloc(sizeof(bits->bfmb_refs[0]) * bier_hdr_len_id_to_num_bits(hlid)); - memset(bits->bfmb_refs, + clib_memset(bits->bfmb_refs, 0, (sizeof(bits->bfmb_refs[0]) * bier_hdr_len_id_to_num_bits(hlid))); @@ -70,7 +70,7 @@ bier_fmask_bits_init (bier_fmask_bits_t *bits, sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) * bier_hdr_len_id_to_num_buckets(hlid), CLIB_CACHE_LINE_BYTES); - memset(bits->bfmb_input_reset_string.bbs_buckets, + clib_memset(bits->bfmb_input_reset_string.bbs_buckets, 0, sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) * bier_hdr_len_id_to_num_buckets(hlid)); @@ -171,7 +171,7 @@ bier_fmask_init (bier_fmask_t *bfm, fib_route_path_t *rpaths; mpls_label_t olabel; - memset(bfm, 0, sizeof(*bfm)); + clib_memset(bfm, 0, sizeof(*bfm)); bfm->bfm_id = clib_mem_alloc(sizeof(*bfm->bfm_id)); @@ -411,7 +411,7 @@ bier_fmask_encode (index_t bfmi, bfm = bier_fmask_get(bfmi); *btid = *bier_table_get_id(bfm->bfm_id->bfmi_bti); - memset(rpath, 0, sizeof(*rpath)); + clib_memset(rpath, 0, sizeof(*rpath)); rpath->rpath.frp_sw_if_index = ~0; diff --git a/src/vnet/bier/bier_fmask_db.c b/src/vnet/bier/bier_fmask_db.c index 59e2973b589..0ee1e5d6bf8 100644 --- a/src/vnet/bier/bier_fmask_db.c +++ b/src/vnet/bier/bier_fmask_db.c @@ -60,7 +60,7 @@ bier_fmask_db_mk_key (index_t bti, * Depending on what the ID is there may be padding. * This key will be memcmp'd in the mhash, so make sure it's all 0 */ - memset(key, 0, sizeof(*key)); + clib_memset(key, 0, sizeof(*key)); /* * Pick the attributes from the path that make the FMask unique diff --git a/src/vnet/bier/bier_hdr_inlines.h b/src/vnet/bier/bier_hdr_inlines.h index d58926e97ef..81e196d4c0b 100644 --- a/src/vnet/bier/bier_hdr_inlines.h +++ b/src/vnet/bier/bier_hdr_inlines.h @@ -175,7 +175,7 @@ bier_hdr_get_proto_id (const bier_hdr_t *bier_hdr) static inline void bier_hdr_clear (bier_hdr_t *bier_hdr) { - memset(&bier_hdr->bh_bit_string, 0, + clib_memset(&bier_hdr->bh_bit_string, 0, bier_hdr_len_id_to_num_buckets( bier_hdr_get_len_id(bier_hdr))); } diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c index 06160f60aab..d15ee595b64 100644 --- a/src/vnet/bier/bier_test.c +++ b/src/vnet/bier/bier_test.c @@ -742,7 +742,7 @@ bier_test_mpls_imp (void) */ bier_bit_string_t bbs_256; u8 buckets[BIER_HDR_BUCKETS_256]; - memset(buckets, 0x5, BIER_HDR_BUCKETS_256); + clib_memset(buckets, 0x5, BIER_HDR_BUCKETS_256); res = 0; bier_bit_string_init(&bbs_256, BIER_HDR_LEN_256, buckets); diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c index 02536e966a1..691697cf4fe 100644 --- a/src/vnet/bonding/bond_api.c +++ b/src/vnet/bonding/bond_api.c @@ -59,7 +59,7 @@ bond_send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_sw_interface_event_t *mp; 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_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (sw_if_index); @@ -104,7 +104,7 @@ vl_api_bond_create_t_handler (vl_api_bond_create_t * mp) unix_shared_memory_queue_t *q; bond_create_if_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); if (mp->use_custom_mac) { @@ -139,7 +139,7 @@ vl_api_bond_enslave_t_handler (vl_api_bond_enslave_t * mp) unix_shared_memory_queue_t *q; bond_enslave_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->group = ntohl (mp->bond_sw_if_index); ap->slave = ntohl (mp->sw_if_index); @@ -168,7 +168,7 @@ vl_api_bond_detach_slave_t_handler (vl_api_bond_detach_slave_t * mp) unix_shared_memory_queue_t *q; bond_detach_slave_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->slave = ntohl (mp->sw_if_index); bond_detach_slave (vm, ap); @@ -194,7 +194,7 @@ bond_send_sw_interface_details (vpe_api_main_t * am, vl_api_sw_interface_bond_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_BOND_DETAILS); mp->sw_if_index = htonl (bond_if->sw_if_index); clib_memcpy (mp->interface_name, bond_if->interface_name, @@ -243,7 +243,7 @@ bond_send_sw_interface_slave_details (vpe_api_main_t * am, vl_api_sw_interface_slave_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_SLAVE_DETAILS); mp->sw_if_index = htonl (slave_if->sw_if_index); clib_memcpy (mp->interface_name, slave_if->interface_name, diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c index ae046e640db..14c52f70b0b 100644 --- a/src/vnet/bonding/cli.c +++ b/src/vnet/bonding/cli.c @@ -91,7 +91,7 @@ bond_dump_ifs (bond_interface_details_t ** out_bondifs) /* *INDENT-OFF* */ pool_foreach (bif, bm->interfaces, vec_add2(r_bondifs, bondif, 1); - memset (bondif, 0, sizeof (*bondif)); + clib_memset (bondif, 0, sizeof (*bondif)); bondif->sw_if_index = bif->sw_if_index; hi = vnet_get_hw_interface (vnm, bif->hw_if_index); clib_memcpy(bondif->interface_name, hi->name, @@ -129,7 +129,7 @@ bond_dump_slave_ifs (slave_interface_details_t ** out_slaveifs, vec_foreach (sw_if_index, bif->slaves) { vec_add2 (r_slaveifs, slaveif, 1); - memset (slaveif, 0, sizeof (*slaveif)); + clib_memset (slaveif, 0, sizeof (*slaveif)); sif = bond_get_slave_by_sw_if_index (*sw_if_index); if (sif) { @@ -231,7 +231,7 @@ bond_delete_if (vlib_main_t * vm, u32 sw_if_index) clib_bitmap_free (bif->port_number_bitmap); hash_unset (bm->bond_by_sw_if_index, bif->sw_if_index); - memset (bif, 0, sizeof (*bif)); + clib_memset (bif, 0, sizeof (*bif)); pool_put (bm->interfaces, bif); return 0; @@ -264,7 +264,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args) return; } pool_get (bm->interfaces, bif); - memset (bif, 0, sizeof (*bif)); + clib_memset (bif, 0, sizeof (*bif)); bif->dev_instance = bif - bm->interfaces; bif->lb = args->lb; bif->mode = args->mode; @@ -449,7 +449,7 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args) return; } pool_get (bm->neighbors, sif); - memset (sif, 0, sizeof (*sif)); + clib_memset (sif, 0, sizeof (*sif)); sw = pool_elt_at_index (im->sw_interfaces, args->slave); sif->port_enabled = sw->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP; sif->sw_if_index = sw->sw_if_index; diff --git a/src/vnet/classify/classify_api.c b/src/vnet/classify/classify_api.c index 6397b10fbd6..08defd4ecdd 100644 --- a/src/vnet/classify/classify_api.c +++ b/src/vnet/classify/classify_api.c @@ -213,7 +213,7 @@ send_policer_classify_details (u32 sw_if_index, vl_api_policer_classify_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 = ntohs (VL_API_POLICER_CLASSIFY_DETAILS); mp->context = context; mp->sw_if_index = htonl (sw_if_index); @@ -395,7 +395,7 @@ send_classify_session_details (vl_api_registration_t * reg, vl_api_classify_session_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 = ntohs (VL_API_CLASSIFY_SESSION_DETAILS); rmp->context = context; rmp->table_id = ntohl (table_id); @@ -489,7 +489,7 @@ send_flow_classify_details (u32 sw_if_index, vl_api_flow_classify_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 = ntohs (VL_API_FLOW_CLASSIFY_DETAILS); mp->context = context; mp->sw_if_index = htonl (sw_if_index); diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c index 52cabbc7f42..36f967a38ac 100644 --- a/src/vnet/classify/vnet_classify.c +++ b/src/vnet/classify/vnet_classify.c @@ -128,7 +128,7 @@ vnet_classify_new_table (vnet_classify_main_t * cm, nbuckets = 1 << (max_log2 (nbuckets)); pool_get_aligned (cm->tables, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); vec_validate_aligned (t->mask, match_n_vectors - 1, sizeof (u32x4)); clib_memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4)); @@ -211,7 +211,7 @@ vnet_classify_entry_alloc (vnet_classify_table_t * t, u32 log2_pages) initialize: ASSERT (rv); - memset (rv, 0xff, required_length); + clib_memset (rv, 0xff, required_length); return rv; } @@ -536,8 +536,8 @@ vnet_classify_add_del (vnet_classify_table_t * t, (v->key, add_v->key, t->match_n_vectors * sizeof (u32x4))) { vnet_classify_entry_release_resource (v); - memset (v, 0xff, sizeof (vnet_classify_entry_t) + - t->match_n_vectors * sizeof (u32x4)); + clib_memset (v, 0xff, sizeof (vnet_classify_entry_t) + + t->match_n_vectors * sizeof (u32x4)); v->flags |= VNET_CLASSIFY_ENTRY_FREE; CLIB_MEMORY_BARRIER (); @@ -845,7 +845,7 @@ unformat_tcp_mask (unformat_input_t * input, va_list * args) tcp = (tcp_header_t *) mask; -#define _(a) if (a) memset (&tcp->a, 0xff, sizeof (tcp->a)); +#define _(a) if (a) clib_memset (&tcp->a, 0xff, sizeof (tcp->a)); foreach_tcp_proto_field; #undef _ @@ -886,7 +886,7 @@ unformat_udp_mask (unformat_input_t * input, va_list * args) udp = (udp_header_t *) mask; -#define _(a) if (a) memset (&udp->a, 0xff, sizeof (udp->a)); +#define _(a) if (a) clib_memset (&udp->a, 0xff, sizeof (udp->a)); foreach_udp_proto_field; #undef _ @@ -981,7 +981,7 @@ unformat_ip4_mask (unformat_input_t * input, va_list * args) ip = (ip4_header_t *) mask; -#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a)); +#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a)); foreach_ip4_proto_field; #undef _ @@ -1053,7 +1053,7 @@ unformat_ip6_mask (unformat_input_t * input, va_list * args) ip = (ip6_header_t *) mask; -#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a)); +#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a)); foreach_ip6_proto_field; #undef _ @@ -1149,10 +1149,10 @@ unformat_l2_mask (unformat_input_t * input, va_list * args) vec_validate (mask, len - 1); if (dst) - memset (mask, 0xff, 6); + clib_memset (mask, 0xff, 6); if (src) - memset (mask + 6, 0xff, 6); + clib_memset (mask + 6, 0xff, 6); if (tag2 || dot1ad) { @@ -2501,7 +2501,7 @@ test_classify_churn (test_classify_main_t * tm) data = (classify_data_or_mask_t *) dp; /* Mask on src address */ - memset (&mask->ip.src_address, 0xff, 4); + clib_memset (&mask->ip.src_address, 0xff, 4); tmp = clib_host_to_net_u32 (tm->src.as_u32); diff --git a/src/vnet/config.c b/src/vnet/config.c index 26b0cad6055..9beda4a5706 100644 --- a/src/vnet/config.c +++ b/src/vnet/config.c @@ -167,7 +167,7 @@ vnet_config_init (vlib_main_t * vm, vlib_node_t *n; u32 i; - memset (cm, 0, sizeof (cm[0])); + clib_memset (cm, 0, sizeof (cm[0])); cm->config_string_hash = hash_create_vec (0, diff --git a/src/vnet/cop/cop.c b/src/vnet/cop/cop.c index 465d6c97a2a..700bd7348ed 100644 --- a/src/vnet/cop/cop.c +++ b/src/vnet/cop/cop.c @@ -27,7 +27,7 @@ cop_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) int address_family; u32 ci, default_next; - memset (data, 0, sizeof(*data)); + clib_memset (data, 0, sizeof(*data)); /* * Ignore local interface, pg interfaces. $$$ need a #define for the diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c index f1a7b6ad21c..e58f2782765 100644 --- a/src/vnet/devices/af_packet/af_packet.c +++ b/src/vnet/devices/af_packet/af_packet.c @@ -143,7 +143,7 @@ create_packet_v2_sock (int host_if_index, tpacket_req_t * rx_req, } /* bind before rx ring is cfged so we don't receive packets from other interfaces */ - memset (&sll, 0, sizeof (sll)); + clib_memset (&sll, 0, sizeof (sll)); sll.sll_family = PF_PACKET; sll.sll_protocol = htons (ETH_P_ALL); sll.sll_ifindex = host_if_index; @@ -350,7 +350,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set, if (error) { - memset (apif, 0, sizeof (*apif)); + clib_memset (apif, 0, sizeof (*apif)); pool_put (apm->interfaces, apif); vlib_log_err (apm->log_class, "Unable to register interface: %U", format_clib_error, error); @@ -502,7 +502,7 @@ af_packet_init (vlib_main_t * vm) af_packet_main_t *apm = &af_packet_main; vlib_thread_main_t *tm = vlib_get_thread_main (); - memset (apm, 0, sizeof (af_packet_main_t)); + clib_memset (apm, 0, sizeof (af_packet_main_t)); mhash_init_vec_string (&apm->if_index_by_host_if_name, sizeof (uword)); diff --git a/src/vnet/devices/af_packet/af_packet_api.c b/src/vnet/devices/af_packet/af_packet_api.c index 3e03b5917fe..3dc18b1e96a 100644 --- a/src/vnet/devices/af_packet/af_packet_api.c +++ b/src/vnet/devices/af_packet/af_packet_api.c @@ -111,7 +111,7 @@ af_packet_send_details (vpe_api_main_t * am, { vl_api_af_packet_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_AF_PACKET_DETAILS); mp->sw_if_index = htonl (af_packet_if->sw_if_index); clib_memcpy (mp->host_if_name, af_packet_if->host_if_name, diff --git a/src/vnet/devices/netlink.c b/src/vnet/devices/netlink.c index 1d44f287bdc..a954fef74fd 100644 --- a/src/vnet/devices/netlink.c +++ b/src/vnet/devices/netlink.c @@ -38,7 +38,7 @@ vnet_netlink_msg_init (vnet_netlink_msg_t * m, u16 type, u16 flags, { struct nlmsghdr *nh; u8 *p; - memset (m, 0, sizeof (vnet_netlink_msg_t)); + clib_memset (m, 0, sizeof (vnet_netlink_msg_t)); vec_add2 (m->data, p, NLMSG_SPACE (msg_len)); ASSERT (m->data == p); diff --git a/src/vnet/devices/netmap/netmap.c b/src/vnet/devices/netmap/netmap.c index 25a3af73451..03d96216bb0 100644 --- a/src/vnet/devices/netmap/netmap.c +++ b/src/vnet/devices/netmap/netmap.c @@ -80,7 +80,7 @@ close_netmap_if (netmap_main_t * nm, netmap_if_t * nif) vec_free (nif->host_if_name); vec_free (nif->req); - memset (nif, 0, sizeof (*nif)); + clib_memset (nif, 0, sizeof (*nif)); pool_put (nm->interfaces, nif); } @@ -280,7 +280,7 @@ netmap_init (vlib_main_t * vm) vlib_thread_registration_t *tr; uword *p; - memset (nm, 0, sizeof (netmap_main_t)); + clib_memset (nm, 0, sizeof (netmap_main_t)); nm->input_cpu_first_index = 0; nm->input_cpu_count = 1; diff --git a/src/vnet/devices/pipe/pipe.c b/src/vnet/devices/pipe/pipe.c index 6154a66f5c4..8b30f4705d6 100644 --- a/src/vnet/devices/pipe/pipe.c +++ b/src/vnet/devices/pipe/pipe.c @@ -527,7 +527,7 @@ pipe_create_sub_interface (vnet_hw_interface_t * hi, { vnet_sw_interface_t template; - memset (&template, 0, sizeof (template)); + clib_memset (&template, 0, sizeof (template)); template.type = VNET_SW_INTERFACE_TYPE_PIPE; template.flood_class = VNET_FLOOD_CLASS_NORMAL; template.sup_sw_if_index = hi->sw_if_index; @@ -557,7 +557,7 @@ vnet_create_pipe_interface (u8 is_specified, ASSERT (parent_sw_if_index); - memset (address, 0, sizeof (address)); + clib_memset (address, 0, sizeof (address)); /* * Allocate a pipe instance. Either select one dynamically diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index d3ed2af18fd..3bbdd05cd4d 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -115,7 +115,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) return; } - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); pool_get (vim->interfaces, vif); vif->dev_instance = vif - vim->interfaces; vif->tap_fd = -1; @@ -317,7 +317,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) /* Set vhost memory table */ i = sizeof (struct vhost_memory) + sizeof (struct vhost_memory_region); vhost_mem = clib_mem_alloc (i); - memset (vhost_mem, 0, i); + clib_memset (vhost_mem, 0, i); vhost_mem->nregions = 1; vhost_mem->regions[0].memory_size = (1ULL << 47) - 4096; _IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem); @@ -405,7 +405,7 @@ error: close (vif->fd); vec_foreach_index (i, vif->vrings) virtio_vring_free (vm, vif, i); vec_free (vif->vrings); - memset (vif, 0, sizeof (virtio_if_t)); + clib_memset (vif, 0, sizeof (virtio_if_t)); pool_put (vim->interfaces, vif); done: @@ -449,7 +449,7 @@ tap_delete_if (vlib_main_t * vm, u32 sw_if_index) tm->tap_ids = clib_bitmap_set (tm->tap_ids, vif->id, 0); clib_spinlock_free (&vif->lockp); - memset (vif, 0, sizeof (*vif)); + clib_memset (vif, 0, sizeof (*vif)); pool_put (mm->interfaces, vif); return 0; @@ -468,7 +468,7 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids) /* *INDENT-OFF* */ pool_foreach (vif, mm->interfaces, vec_add2(r_tapids, tapid, 1); - memset (tapid, 0, sizeof (*tapid)); + clib_memset (tapid, 0, sizeof (*tapid)); tapid->id = vif->id; tapid->sw_if_index = vif->sw_if_index; hi = vnet_get_hw_interface (vnm, vif->hw_if_index); diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c index f0c980a64fa..e70d63f914f 100644 --- a/src/vnet/devices/tap/tapv2_api.c +++ b/src/vnet/devices/tap/tapv2_api.c @@ -58,7 +58,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp) vl_api_registration_t *reg; tap_create_if_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->id = ntohl (mp->id); if (!mp->use_random_mac) @@ -142,7 +142,7 @@ tap_send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_sw_interface_event_t *mp; 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_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (sw_if_index); @@ -190,7 +190,7 @@ tap_send_sw_interface_details (vpe_api_main_t * am, { vl_api_sw_interface_tap_v2_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_TAP_V2_DETAILS); mp->id = htonl (tap_if->id); mp->sw_if_index = htonl (tap_if->sw_if_index); diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index c7efe6519cd..9b01b9183c8 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -132,7 +132,7 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_vring_t * vring, u32 bi, vlib_buffer_t *b = vlib_get_buffer (vm, bi); struct virtio_net_hdr_v1 *hdr = vlib_buffer_get_current (b) - hdr_sz; - memset (hdr, 0, hdr_sz); + clib_memset (hdr, 0, hdr_sz); if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0)) { diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c index 1342030a651..9725a91027d 100644 --- a/src/vnet/devices/virtio/vhost_user.c +++ b/src/vnet/devices/virtio/vhost_user.c @@ -307,7 +307,7 @@ static_always_inline void vhost_user_vring_init (vhost_user_intf_t * vui, u32 qid) { vhost_user_vring_t *vring = &vui->vrings[qid]; - memset (vring, 0, sizeof (*vring)); + clib_memset (vring, 0, sizeof (*vring)); vring->kickfd_idx = ~0; vring->callfd_idx = ~0; vring->errfd = -1; @@ -394,8 +394,8 @@ vhost_user_socket_read (clib_file_t * uf) char control[CMSG_SPACE (VHOST_MEMORY_MAX_NREGIONS * sizeof (int))]; - memset (&mh, 0, sizeof (mh)); - memset (control, 0, sizeof (control)); + clib_memset (&mh, 0, sizeof (mh)); + clib_memset (control, 0, sizeof (control)); for (i = 0; i < VHOST_MEMORY_MAX_NREGIONS; i++) fds[i] = -1; @@ -1419,7 +1419,7 @@ vhost_user_vui_init (vnet_main_t * vnm, { vui->vring_locks[q] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES, CLIB_CACHE_LINE_BYTES); - memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES); + clib_memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES); } vec_validate (vui->per_cpu_tx_qid, diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c index 016ccbd2687..b8d89a07cbc 100644 --- a/src/vnet/devices/virtio/vhost_user_api.c +++ b/src/vnet/devices/virtio/vhost_user_api.c @@ -58,7 +58,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_sw_interface_event_t *mp; 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_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (sw_if_index); @@ -165,7 +165,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am, vl_api_sw_interface_vhost_user_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 = ntohs (VL_API_SW_INTERFACE_VHOST_USER_DETAILS); mp->sw_if_index = ntohl (vui->sw_if_index); mp->virtio_net_hdr_sz = ntohl (vui->virtio_net_hdr_sz); diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c index 26140484d2e..291d687ab6a 100644 --- a/src/vnet/devices/virtio/vhost_user_input.c +++ b/src/vnet/devices/virtio/vhost_user_input.c @@ -101,7 +101,7 @@ vhost_user_rx_trace (vhost_trace_t * t, virtio_net_hdr_mrg_rxbuf_t *hdr; u32 hint = 0; - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); t->device_index = vui - vum->vhost_user_interfaces; t->qid = qid; diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c index dab8fa5fb3b..820594999c8 100644 --- a/src/vnet/devices/virtio/vhost_user_output.c +++ b/src/vnet/devices/virtio/vhost_user_output.c @@ -155,7 +155,7 @@ vhost_user_tx_trace (vhost_trace_t * t, vring_desc_t *hdr_desc = 0; u32 hint = 0; - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); t->device_index = vui - vum->vhost_user_interfaces; t->qid = qid; diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c index 072e8a755b0..17de781921d 100644 --- a/src/vnet/devices/virtio/virtio.c +++ b/src/vnet/devices/virtio/virtio.c @@ -85,19 +85,19 @@ virtio_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 idx, u16 sz) i = sizeof (struct vring_desc) * sz; i = round_pow2 (i, CLIB_CACHE_LINE_BYTES); vring->desc = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES); - memset (vring->desc, 0, i); + clib_memset (vring->desc, 0, i); i = sizeof (struct vring_avail) + sz * sizeof (vring->avail->ring[0]); i = round_pow2 (i, CLIB_CACHE_LINE_BYTES); vring->avail = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES); - memset (vring->avail, 0, i); + clib_memset (vring->avail, 0, i); // tell kernel that we don't need interrupt vring->avail->flags = VIRTIO_RING_FLAG_MASK_INT; i = sizeof (struct vring_used) + sz * sizeof (struct vring_used_elem); i = round_pow2 (i, CLIB_CACHE_LINE_BYTES); vring->used = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES); - memset (vring->used, 0, i); + clib_memset (vring->used, 0, i); ASSERT (vring->buffers == 0); vec_validate_aligned (vring->buffers, sz, CLIB_CACHE_LINE_BYTES); diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c index 98f212334f6..32333054fa3 100644 --- a/src/vnet/dhcp/client.c +++ b/src/vnet/dhcp/client.c @@ -422,7 +422,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, dhcp = (dhcp_header_t *) (udp + 1); /* $$$ optimize, maybe */ - memset (ip, 0, sizeof (*ip) + sizeof (*udp) + sizeof (*dhcp)); + clib_memset (ip, 0, sizeof (*ip) + sizeof (*udp) + sizeof (*dhcp)); ip->ip_version_and_header_length = 0x45; ip->ttl = 128; @@ -908,7 +908,7 @@ dhcp_client_add_del (dhcp_client_add_del_args_t * a) if (a->is_add) { pool_get (dcm->clients, c); - memset (c, 0, sizeof (*c)); + clib_memset (c, 0, sizeof (*c)); c->state = DHCP_DISCOVER; c->sw_if_index = a->sw_if_index; c->client_index = a->client_index; @@ -984,7 +984,7 @@ dhcp_client_config (u32 is_add, dhcp_client_add_del_args_t _a, *a = &_a; int rv; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = is_add; a->sw_if_index = sw_if_index; a->client_index = client_index; @@ -1106,7 +1106,7 @@ dhcp_client_set_command_fn (vlib_main_t * vm, if (sw_if_index_set == 0) return clib_error_return (0, "interface not specified"); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = is_add; a->sw_if_index = sw_if_index; a->hostname = hostname; diff --git a/src/vnet/dhcp/dhcp4_proxy_node.c b/src/vnet/dhcp/dhcp4_proxy_node.c index 6b15c51b38f..97ed3b5920a 100644 --- a/src/vnet/dhcp/dhcp4_proxy_node.c +++ b/src/vnet/dhcp/dhcp4_proxy_node.c @@ -685,7 +685,7 @@ dhcp_proxy_to_client_input (vlib_main_t * vm, hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index); ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance); clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); - memset (mac0->dst_address, 0xff, sizeof (mac0->dst_address)); + clib_memset (mac0->dst_address, 0xff, sizeof (mac0->dst_address)); mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ? clib_net_to_host_u16 (0x8100) : clib_net_to_host_u16 (0x0800); @@ -818,8 +818,8 @@ dhcp4_proxy_set_command_fn (vlib_main_t * vm, int is_del = 0; int set_src = 0, set_server = 0; - memset (&server_addr, 0, sizeof (server_addr)); - memset (&src_addr, 0, sizeof (src_addr)); + clib_memset (&server_addr, 0, sizeof (server_addr)); + clib_memset (&src_addr, 0, sizeof (src_addr)); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { diff --git a/src/vnet/dhcp/dhcp6_client_common_dp.c b/src/vnet/dhcp/dhcp6_client_common_dp.c index 1a3c7bcb278..a6ed42de578 100644 --- a/src/vnet/dhcp/dhcp6_client_common_dp.c +++ b/src/vnet/dhcp/dhcp6_client_common_dp.c @@ -192,7 +192,7 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, ntohs (ip0->payload_length) - dhcpv6_ip6_palyoad_offset - sizeof (*dhcpv60); - memset (&report, 0, sizeof (report)); + clib_memset (&report, 0, sizeof (report)); sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; if (sw_if_index >= vec_len (icm->client_state_by_sw_if_index)) diff --git a/src/vnet/dhcp/dhcp6_ia_na_client_dp.c b/src/vnet/dhcp/dhcp6_ia_na_client_dp.c index 60641227700..11abfccea76 100644 --- a/src/vnet/dhcp/dhcp6_ia_na_client_dp.c +++ b/src/vnet/dhcp/dhcp6_ia_na_client_dp.c @@ -516,7 +516,7 @@ dhcp6_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vec_len (events[i].addresses) * sizeof (vl_api_dhcp6_address_info_t); vl_api_dhcp6_reply_event_t *event = clib_mem_alloc (event_size); - memset (event, 0, event_size); + clib_memset (event, 0, event_size); event->sw_if_index = htonl (events[i].body.sw_if_index); event->server_index = htonl (events[i].body.server_index); diff --git a/src/vnet/dhcp/dhcp6_pd_client_cp.c b/src/vnet/dhcp/dhcp6_pd_client_cp.c index 33813789e70..9663a5718ec 100644 --- a/src/vnet/dhcp/dhcp6_pd_client_cp.c +++ b/src/vnet/dhcp/dhcp6_pd_client_cp.c @@ -1257,7 +1257,7 @@ dhcp6_pd_client_enable_disable (u32 sw_if_index, const u8 * prefix_group, vec_free (prefix_list); - memset (client_state, 0, sizeof (*client_state)); + clib_memset (client_state, 0, sizeof (*client_state)); } return 0; diff --git a/src/vnet/dhcp/dhcp6_pd_client_dp.c b/src/vnet/dhcp/dhcp6_pd_client_dp.c index 009de4a4431..9fb6096b8d5 100644 --- a/src/vnet/dhcp/dhcp6_pd_client_dp.c +++ b/src/vnet/dhcp/dhcp6_pd_client_dp.c @@ -523,7 +523,7 @@ dhcp6_pd_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt, sizeof (vl_api_dhcp6_pd_prefix_info_t); vl_api_dhcp6_pd_reply_event_t *event = clib_mem_alloc (event_size); - memset (event, 0, event_size); + clib_memset (event, 0, event_size); event->sw_if_index = htonl (events[i].body.sw_if_index); event->server_index = htonl (events[i].body.server_index); diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c index 7d157ad35a1..34454d6bd56 100644 --- a/src/vnet/dhcp/dhcp6_proxy_node.c +++ b/src/vnet/dhcp/dhcp6_proxy_node.c @@ -389,7 +389,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm, sizeof (*r1) + sizeof (*fwd_opt) + sizeof (*u1) + sizeof (*id1) + u1->length); - memset (ip1, 0, sizeof (*ip1)); + clib_memset (ip1, 0, sizeof (*ip1)); ip1->ip_version_traffic_class_and_flow_label = 0x60; ip1->payload_length = u1->length; ip1->protocol = PROTO_UDP; @@ -739,7 +739,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm, } len = clib_net_to_host_u16 (r0->length); - memset (ip1, 0, sizeof (*ip1)); + clib_memset (ip1, 0, sizeof (*ip1)); copy_ip6_address (&ip1->dst_address, &client_address); u1->checksum = 0; u1->src_port = clib_net_to_host_u16 (UDP_DST_PORT_dhcpv6_to_server); @@ -767,7 +767,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm, hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index); ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance); clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); - memset (&mac0->dst_address, 0xff, sizeof (mac0->dst_address)); + clib_memset (&mac0->dst_address, 0xff, sizeof (mac0->dst_address)); mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ? clib_net_to_host_u16 (0x8100) : clib_net_to_host_u16 (0x86dd); diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c index 59ab6dcbba5..cd30e1d2f94 100644 --- a/src/vnet/dhcp/dhcp_api.c +++ b/src/vnet/dhcp/dhcp_api.c @@ -148,7 +148,7 @@ dhcp_send_details (fib_protocol_t proto, mp = vl_msg_api_alloc (n); if (!mp) return; - memset (mp, 0, n); + clib_memset (mp, 0, n); mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_DETAILS); mp->context = context; mp->count = count; @@ -324,7 +324,7 @@ send_dhcp_client_entry (const dhcp_client_t * client, void *arg) ctx = arg; 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_DHCP_CLIENT_DETAILS); mp->context = ctx->context; diff --git a/src/vnet/dhcp/dhcp_proxy.c b/src/vnet/dhcp/dhcp_proxy.c index 88cdcacd62b..9a69041bc1d 100644 --- a/src/vnet/dhcp/dhcp_proxy.c +++ b/src/vnet/dhcp/dhcp_proxy.c @@ -198,7 +198,7 @@ dhcp_proxy_server_add (fib_protocol_t proto, rx_fib_index, ~0); pool_get (dpm->dhcp_servers[proto], proxy); - memset (proxy, 0, sizeof (*proxy)); + clib_memset (proxy, 0, sizeof (*proxy)); new = 1; dpm->dhcp_server_index_by_rx_fib_index[proto][rx_fib_index] = diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c index eff854933c4..54b75aa1708 100644 --- a/src/vnet/dns/dns.c +++ b/src/vnet/dns/dns.c @@ -278,9 +278,9 @@ found_src_address: vnet_buffer (b)->sw_if_index[VLIB_TX] = 0; /* default VRF for now */ ip = vlib_buffer_get_current (b); - memset (ip, 0, sizeof (*ip)); + clib_memset (ip, 0, sizeof (*ip)); udp = (udp_header_t *) (ip + 1); - memset (udp, 0, sizeof (*udp)); + clib_memset (udp, 0, sizeof (*udp)); dns_request = (u8 *) (udp + 1); @@ -384,9 +384,9 @@ found_src_address: VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_LOCALLY_ORIGINATED; ip = vlib_buffer_get_current (b); - memset (ip, 0, sizeof (*ip)); + clib_memset (ip, 0, sizeof (*ip)); udp = (udp_header_t *) (ip + 1); - memset (udp, 0, sizeof (*udp)); + clib_memset (udp, 0, sizeof (*udp)); dns_request = (u8 *) (udp + 1); @@ -768,7 +768,7 @@ dns_add_static_entry (dns_main_t * dm, u8 * name, u8 * dns_reply_data) } pool_get (dm->entries, ep); - memset (ep, 0, sizeof (*ep)); + clib_memset (ep, 0, sizeof (*ep)); /* Note: consumes the name vector */ ep->name = name; @@ -887,7 +887,7 @@ re_resolve: /* add new hash table entry */ pool_get (dm->entries, ep); - memset (ep, 0, sizeof (*ep)); + clib_memset (ep, 0, sizeof (*ep)); ep->name = format (0, "%s%c", name, 0); _vec_len (ep->name) = vec_len (ep->name) - 1; @@ -1063,7 +1063,7 @@ found_last_request: /* Need to recompute ep post pool-get */ ep = pool_elt_at_index (dm->entries, ep_index); - memset (next_ep, 0, sizeof (*next_ep)); + clib_memset (next_ep, 0, sizeof (*next_ep)); next_ep->name = vec_dup (cname); vec_add1 (next_ep->name, 0); _vec_len (next_ep->name) -= 1; @@ -2592,7 +2592,7 @@ test_dns_fmt_command_fn (vlib_main_t * vm, vlib_cli_output (vm, "%U", format_dns_reply, dns_reply_data, verbose); - memset (rmp, 0, sizeof (*rmp)); + clib_memset (rmp, 0, sizeof (*rmp)); rv = vnet_dns_response_to_reply (dns_reply_data, rmp, 0 /* ttl-ptr */ ); @@ -2758,7 +2758,7 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr, if (pr->request_type == DNS_PEER_PENDING_NAME_TO_IP) { /* Quick and dirty way to dig up the A-record address. $$ FIXME */ - memset (rnr, 0, sizeof (*rnr)); + clib_memset (rnr, 0, sizeof (*rnr)); if (vnet_dns_response_to_reply (ep->dns_response, rnr, &ttl)) { /* clib_warning ("response_to_reply failed..."); */ @@ -2772,7 +2772,7 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr, } else if (pr->request_type == DNS_PEER_PENDING_IP_TO_NAME) { - memset (rir, 0, sizeof (*rir)); + clib_memset (rir, 0, sizeof (*rir)); if (vnet_dns_response_to_name (ep->dns_response, rir, &ttl)) { /* clib_warning ("response_to_name failed..."); */ @@ -2859,7 +2859,7 @@ found_src_address: ip = vlib_buffer_get_current (b0); udp = (udp_header_t *) (ip + 1); dns_response = (u8 *) (udp + 1); - memset (ip, 0, sizeof (*ip) + sizeof (*udp)); + clib_memset (ip, 0, sizeof (*ip) + sizeof (*udp)); /* * Start with the variadic portion of the exercise. diff --git a/src/vnet/dpo/classify_dpo.c b/src/vnet/dpo/classify_dpo.c index 9e7886c9edd..08fab83f2ee 100644 --- a/src/vnet/dpo/classify_dpo.c +++ b/src/vnet/dpo/classify_dpo.c @@ -28,7 +28,7 @@ classify_dpo_alloc (void) classify_dpo_t *cd; pool_get_aligned(classify_dpo_pool, cd, CLIB_CACHE_LINE_BYTES); - memset(cd, 0, sizeof(*cd)); + clib_memset(cd, 0, sizeof(*cd)); return (cd); } diff --git a/src/vnet/dpo/l3_proxy_dpo.c b/src/vnet/dpo/l3_proxy_dpo.c index ea3db7151d0..41156301a0e 100644 --- a/src/vnet/dpo/l3_proxy_dpo.c +++ b/src/vnet/dpo/l3_proxy_dpo.c @@ -31,7 +31,7 @@ l3_proxy_dpo_alloc (void) l3_proxy_dpo_t *l3p; pool_get_aligned(l3_proxy_dpo_pool, l3p, CLIB_CACHE_LINE_BYTES); - memset(l3p, 0, sizeof(*l3p)); + clib_memset(l3p, 0, sizeof(*l3p)); return (l3p); } diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c index 6b77f477fae..1abfab1cb01 100644 --- a/src/vnet/dpo/load_balance.c +++ b/src/vnet/dpo/load_balance.c @@ -94,7 +94,7 @@ load_balance_alloc_i (void) load_balance_t *lb; pool_get_aligned(load_balance_pool, lb, CLIB_CACHE_LINE_BYTES); - memset(lb, 0, sizeof(*lb)); + clib_memset(lb, 0, sizeof(*lb)); lb->lb_map = INDEX_INVALID; lb->lb_urpf = INDEX_INVALID; diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c index 8f9bd366c4a..bf5d1fb2943 100644 --- a/src/vnet/dpo/load_balance_map.c +++ b/src/vnet/dpo/load_balance_map.c @@ -389,7 +389,7 @@ load_balance_map_alloc (const load_balance_path_t *paths) u32 ii; pool_get_aligned(load_balance_map_pool, lbm, CLIB_CACHE_LINE_BYTES); - memset(lbm, 0, sizeof(*lbm)); + clib_memset(lbm, 0, sizeof(*lbm)); vec_validate(lbm->lbm_paths, vec_len(paths)-1); diff --git a/src/vnet/dpo/mpls_disposition.c b/src/vnet/dpo/mpls_disposition.c index 66f74f9b29f..c2c9065f787 100644 --- a/src/vnet/dpo/mpls_disposition.c +++ b/src/vnet/dpo/mpls_disposition.c @@ -29,7 +29,7 @@ mpls_disp_dpo_alloc (void) mpls_disp_dpo_t *mdd; pool_get_aligned(mpls_disp_dpo_pool, mdd, CLIB_CACHE_LINE_BYTES); - memset(mdd, 0, sizeof(*mdd)); + clib_memset(mdd, 0, sizeof(*mdd)); dpo_reset(&mdd->mdd_dpo); diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c index bee155b9035..c3710aefe28 100644 --- a/src/vnet/dpo/mpls_label_dpo.c +++ b/src/vnet/dpo/mpls_label_dpo.c @@ -40,7 +40,7 @@ mpls_label_dpo_alloc (void) mpls_label_dpo_t *mld; pool_get_aligned(mpls_label_dpo_pool, mld, CLIB_CACHE_LINE_BYTES); - memset(mld, 0, sizeof(*mld)); + clib_memset(mld, 0, sizeof(*mld)); dpo_reset(&mld->mld_dpo); diff --git a/src/vnet/dpo/receive_dpo.c b/src/vnet/dpo/receive_dpo.c index 83e33ed8cf0..30ddceeb23e 100644 --- a/src/vnet/dpo/receive_dpo.c +++ b/src/vnet/dpo/receive_dpo.c @@ -31,7 +31,7 @@ receive_dpo_alloc (void) receive_dpo_t *rd; pool_get_aligned(receive_dpo_pool, rd, CLIB_CACHE_LINE_BYTES); - memset(rd, 0, sizeof(*rd)); + clib_memset(rd, 0, sizeof(*rd)); return (rd); } diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c index 443df66e238..c9d86f39832 100644 --- a/src/vnet/dpo/replicate_dpo.c +++ b/src/vnet/dpo/replicate_dpo.c @@ -90,7 +90,7 @@ replicate_alloc_i (void) replicate_t *rep; pool_get_aligned(replicate_pool, rep, CLIB_CACHE_LINE_BYTES); - memset(rep, 0, sizeof(*rep)); + clib_memset(rep, 0, sizeof(*rep)); vlib_validate_combined_counter(&(replicate_main.repm_counters), replicate_get_index(rep)); diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c index e0d1295f69d..2cb137c53b3 100644 --- a/src/vnet/ethernet/interface.c +++ b/src/vnet/ethernet/interface.c @@ -152,7 +152,7 @@ ethernet_build_rewrite (vnet_main_t * vnm, if (dst_address) clib_memcpy (h->dst_address, dst_address, sizeof (h->dst_address)); else - memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */ + clib_memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */ } if (PREDICT_FALSE (!is_p2p) && sub_sw->sub.eth.flags.one_tag) @@ -750,7 +750,7 @@ vnet_create_loopback_interface (u32 * sw_if_indexp, u8 * mac_address, *sw_if_indexp = (u32) ~ 0; - memset (address, 0, sizeof (address)); + clib_memset (address, 0, sizeof (address)); /* * Allocate a loopback instance. Either select on dynamically @@ -822,7 +822,7 @@ create_simulated_ethernet_interfaces (vlib_main_t * vm, u8 is_specified = 0; u32 user_instance = 0; - memset (mac_address, 0, sizeof (mac_address)); + clib_memset (mac_address, 0, sizeof (mac_address)); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c index 3c832eb01fb..d46b9e23b04 100644 --- a/src/vnet/fib/fib_api.c +++ b/src/vnet/fib/fib_api.c @@ -49,7 +49,7 @@ fib_path_api_parse (const vl_api_fib_path_t *in, path_flags = FIB_ROUTE_PATH_FLAG_NONE; next_hop_via_label = ntohl (in->via_label); - memset(out, 0, sizeof(*out)); + clib_memset(out, 0, sizeof(*out)); out->frp_sw_if_index = ~0; out->frp_proto = in->afi; @@ -207,7 +207,7 @@ void fib_api_path_encode (const fib_route_path_encode_t * api_rpath, vl_api_fib_path_t *out) { - memset (out, 0, sizeof (*out)); + clib_memset (out, 0, sizeof (*out)); switch (api_rpath->dpo.dpoi_type) { case DPO_RECEIVE: diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c index e522db44570..feb304bea36 100644 --- a/src/vnet/fib/fib_attached_export.c +++ b/src/vnet/fib/fib_attached_export.c @@ -107,7 +107,7 @@ fib_entry_ae_add_or_lock (fib_node_index_t connected) fed = fib_entry_delegate_find_or_add(entry, FIB_ENTRY_DELEGATE_ATTACHED_EXPORT); pool_get(fib_ae_export_pool, export); - memset(export, 0, sizeof(*export)); + clib_memset(export, 0, sizeof(*export)); fed->fd_index = (export - fib_ae_export_pool); export->faee_ei = connected; diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c index 7de521336b8..eaedc504d48 100644 --- a/src/vnet/fib/fib_entry.c +++ b/src/vnet/fib/fib_entry.c @@ -601,7 +601,7 @@ fib_entry_alloc (u32 fib_index, fib_prefix_t *fep; pool_get(fib_entry_pool, fib_entry); - memset(fib_entry, 0, sizeof(*fib_entry)); + clib_memset(fib_entry, 0, sizeof(*fib_entry)); fib_node_init(&fib_entry->fe_node, FIB_NODE_TYPE_ENTRY); diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c index e37d47482db..baf8275d181 100644 --- a/src/vnet/fib/fib_path.c +++ b/src/vnet/fib/fib_path.c @@ -1256,7 +1256,7 @@ fib_path_create (fib_node_index_t pl_index, fib_path_t *path; pool_get(fib_path_pool, path); - memset(path, 0, sizeof(*path)); + clib_memset(path, 0, sizeof(*path)); fib_node_init(&path->fp_node, FIB_NODE_TYPE_PATH); @@ -1397,7 +1397,7 @@ fib_path_create_special (fib_node_index_t pl_index, fib_path_t *path; pool_get(fib_path_pool, path); - memset(path, 0, sizeof(*path)); + clib_memset(path, 0, sizeof(*path)); fib_node_init(&path->fp_node, FIB_NODE_TYPE_PATH); @@ -1456,7 +1456,7 @@ fib_path_copy (fib_node_index_t path_index, path->fp_oper_flags = FIB_PATH_OPER_FLAG_NONE; path->fp_pl_index = path_list_index; path->fp_via_fib = FIB_NODE_INDEX_INVALID; - memset(&path->fp_dpo, 0, sizeof(path->fp_dpo)); + clib_memset(&path->fp_dpo, 0, sizeof(path->fp_dpo)); dpo_reset(&path->fp_dpo); return (fib_path_get_index(path)); diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c index 4655c687427..568886af143 100644 --- a/src/vnet/fib/fib_path_list.c +++ b/src/vnet/fib/fib_path_list.c @@ -542,7 +542,7 @@ fib_path_list_alloc (fib_node_index_t *path_list_index) fib_path_list_t *path_list; pool_get(fib_path_list_pool, path_list); - memset(path_list, 0, sizeof(*path_list)); + clib_memset(path_list, 0, sizeof(*path_list)); fib_node_init(&path_list->fpl_node, FIB_NODE_TYPE_PATH_LIST); diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c index 25606438491..7f0f13079ee 100644 --- a/src/vnet/fib/fib_types.c +++ b/src/vnet/fib/fib_types.c @@ -440,7 +440,7 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args) vnet_main_t *vnm; vnm = vnet_get_main (); - memset(rpath, 0, sizeof(*rpath)); + clib_memset(rpath, 0, sizeof(*rpath)); rpath->frp_weight = 1; rpath->frp_sw_if_index = ~0; diff --git a/src/vnet/fib/fib_urpf_list.c b/src/vnet/fib/fib_urpf_list.c index d5a406e6191..a895729e91a 100644 --- a/src/vnet/fib/fib_urpf_list.c +++ b/src/vnet/fib/fib_urpf_list.c @@ -57,7 +57,7 @@ fib_urpf_list_alloc_and_lock (void) fib_urpf_list_t *urpf; pool_get(fib_urpf_list_pool, urpf); - memset(urpf, 0, sizeof(*urpf)); + clib_memset(urpf, 0, sizeof(*urpf)); urpf->furpf_locks++; diff --git a/src/vnet/fib/fib_walk.c b/src/vnet/fib/fib_walk.c index 6a64d554f98..64c2527b7b6 100644 --- a/src/vnet/fib/fib_walk.c +++ b/src/vnet/fib/fib_walk.c @@ -1181,11 +1181,11 @@ fib_walk_clear (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { - memset(fib_walk_hist_vists_per_walk, 0, sizeof(fib_walk_hist_vists_per_walk)); - memset(fib_walk_history, 0, sizeof(fib_walk_history)); - memset(fib_walk_work_time_taken, 0, sizeof(fib_walk_work_time_taken)); - memset(fib_walk_work_nodes_visited, 0, sizeof(fib_walk_work_nodes_visited)); - memset(fib_walk_sleep_lengths, 0, sizeof(fib_walk_sleep_lengths)); + clib_memset(fib_walk_hist_vists_per_walk, 0, sizeof(fib_walk_hist_vists_per_walk)); + clib_memset(fib_walk_history, 0, sizeof(fib_walk_history)); + clib_memset(fib_walk_work_time_taken, 0, sizeof(fib_walk_work_time_taken)); + clib_memset(fib_walk_work_nodes_visited, 0, sizeof(fib_walk_work_nodes_visited)); + clib_memset(fib_walk_sleep_lengths, 0, sizeof(fib_walk_sleep_lengths)); return (NULL); } diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c index d8d983dd9c1..9ad1842dd1a 100644 --- a/src/vnet/fib/ip4_fib.c +++ b/src/vnet/fib/ip4_fib.c @@ -109,7 +109,7 @@ ip4_create_fib_with_table_id (u32 table_id, void *old_heap; pool_get(ip4_main.fibs, fib_table); - memset(fib_table, 0, sizeof(*fib_table)); + clib_memset(fib_table, 0, sizeof(*fib_table)); old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap); pool_get_aligned(ip4_main.v4_fibs, v4_fib, CLIB_CACHE_LINE_BYTES); diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c index 22b47579d3e..7375b56ee51 100644 --- a/src/vnet/fib/ip6_fib.c +++ b/src/vnet/fib/ip6_fib.c @@ -63,8 +63,8 @@ create_fib_with_table_id (u32 table_id, pool_get(ip6_main.fibs, fib_table); pool_get_aligned(ip6_main.v6_fibs, v6_fib, CLIB_CACHE_LINE_BYTES); - memset(fib_table, 0, sizeof(*fib_table)); - memset(v6_fib, 0, sizeof(*v6_fib)); + clib_memset(fib_table, 0, sizeof(*fib_table)); + clib_memset(v6_fib, 0, sizeof(*v6_fib)); ASSERT((fib_table - ip6_main.fibs) == (v6_fib - ip6_main.v6_fibs)); @@ -690,7 +690,7 @@ ip6_show_fib (vlib_main_t * vm, vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count"); - memset (ca, 0, sizeof(*ca)); + clib_memset (ca, 0, sizeof(*ca)); ca->fib_index = fib->index; BV(clib_bihash_foreach_key_value_pair) diff --git a/src/vnet/fib/mpls_fib.c b/src/vnet/fib/mpls_fib.c index 223a0ddd753..6670c99233f 100644 --- a/src/vnet/fib/mpls_fib.c +++ b/src/vnet/fib/mpls_fib.c @@ -98,7 +98,7 @@ mpls_fib_create_with_table_id (u32 table_id, ASSERT((fib_table - mpls_main.fibs) == (mf - mpls_main.mpls_fibs)); - memset(fib_table, 0, sizeof(*fib_table)); + clib_memset(fib_table, 0, sizeof(*fib_table)); fib_table->ft_proto = FIB_PROTOCOL_MPLS; fib_table->ft_index = (fib_table - mpls_main.fibs); diff --git a/src/vnet/flow/flow.c b/src/vnet/flow/flow.c index c4f57a21965..485a845e5ee 100644 --- a/src/vnet/flow/flow.c +++ b/src/vnet/flow/flow.c @@ -82,7 +82,7 @@ vnet_flow_del (vnet_main_t * vnm, u32 flow_index) /* *INDENT-ON* */ hash_free (f->private_data); - memset (f, 0, sizeof (*f)); + clib_memset (f, 0, sizeof (*f)); pool_put (fm->global_flow_pool, f); return 0; } diff --git a/src/vnet/flow/flow_cli.c b/src/vnet/flow/flow_cli.c index 27f2d386279..0e10c90f55b 100644 --- a/src/vnet/flow/flow_cli.c +++ b/src/vnet/flow/flow_cli.c @@ -278,7 +278,7 @@ test_flow (vlib_main_t * vm, unformat_input_t * input, int rv; u8 prot; - memset (&flow, 0, sizeof (vnet_flow_t)); + clib_memset (&flow, 0, sizeof (vnet_flow_t)); flow.index = ~0; flow.actions = 0; flow.ip4_n_tuple.protocol = ~0; diff --git a/src/vnet/geneve/decap.c b/src/vnet/geneve/decap.c index f525fa323a6..93f2a8548c1 100644 --- a/src/vnet/geneve/decap.c +++ b/src/vnet/geneve/decap.c @@ -88,7 +88,7 @@ geneve_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/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c index ac097f915cb..c53a67a1abd 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -395,7 +395,7 @@ int vnet_geneve_add_del_tunnel return VNET_API_ERROR_INVALID_DECAP_NEXT; pool_get_aligned (vxm->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; @@ -670,8 +670,8 @@ geneve_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 (&local, 0, sizeof local); - memset (&remote, 0, sizeof remote); + clib_memset (&local, 0, sizeof local); + clib_memset (&remote, 0, sizeof remote); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -807,7 +807,7 @@ geneve_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/vnet/geneve/geneve_api.c b/src/vnet/geneve/geneve_api.c index 9d0830c1ce5..6aa9fa43db2 100644 --- a/src/vnet/geneve/geneve_api.c +++ b/src/vnet/geneve/geneve_api.c @@ -121,7 +121,7 @@ static void send_geneve_tunnel_details u8 is_ipv6 = !ip46_address_is_ip4 (&t->remote); 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_GENEVE_TUNNEL_DETAILS); if (is_ipv6) { diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c index 070c78e8984..449968c1be0 100644 --- a/src/vnet/gre/gre.c +++ b/src/vnet/gre/gre.c @@ -597,7 +597,7 @@ gre_init (vlib_main_t * vm) ip_main_t *im = &ip_main; ip_protocol_info_t *pi; - memset (gm, 0, sizeof (gm[0])); + clib_memset (gm, 0, sizeof (gm[0])); gm->vlib_main = vm; gm->vnet_main = vnet_get_main (); diff --git a/src/vnet/gre/gre_api.c b/src/vnet/gre/gre_api.c index 63d4ca4695b..c5658b52660 100644 --- a/src/vnet/gre/gre_api.c +++ b/src/vnet/gre/gre_api.c @@ -63,7 +63,7 @@ static void vl_api_gre_add_del_tunnel_t_handler rv = VNET_API_ERROR_SAME_SRC_DST; goto out; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = mp->is_add; a->tunnel_type = mp->tunnel_type; @@ -103,7 +103,7 @@ static void send_gre_tunnel_details fib_table_t *ft; rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); + clib_memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = htons (VL_API_GRE_TUNNEL_DETAILS); if (!is_ipv6) { diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c index 181a908022b..6be934af56c 100644 --- a/src/vnet/gre/interface.c +++ b/src/vnet/gre/interface.c @@ -281,7 +281,7 @@ vnet_gre_tunnel_add (vnet_gre_add_del_tunnel_args_t * a, return VNET_API_ERROR_IF_ALREADY_EXISTS; pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); /* Reconcile the real dev_instance and a possible requested instance */ u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */ @@ -606,7 +606,7 @@ create_gre_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->outer_fib_id = outer_fib_id; a->tunnel_type = t_type; diff --git a/src/vnet/gre/node.c b/src/vnet/gre/node.c index 056d00b23b0..89109bbc053 100644 --- a/src/vnet/gre/node.c +++ b/src/vnet/gre/node.c @@ -82,11 +82,11 @@ gre_input (vlib_main_t * vm, vnet_interface_main_t *im = &gm->vnet_main->interface_main; if (!is_ipv6) - memset (&cached_tunnel_key.gtk_v4, 0xff, - sizeof (cached_tunnel_key.gtk_v4)); + clib_memset (&cached_tunnel_key.gtk_v4, 0xff, + sizeof (cached_tunnel_key.gtk_v4)); else - memset (&cached_tunnel_key.gtk_v6, 0xff, - sizeof (cached_tunnel_key.gtk_v6)); + clib_memset (&cached_tunnel_key.gtk_v6, 0xff, + sizeof (cached_tunnel_key.gtk_v6)); from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; diff --git a/src/vnet/hdlc/hdlc.c b/src/vnet/hdlc/hdlc.c index 5f7609d24a6..fa1e7cd5eaf 100644 --- a/src/vnet/hdlc/hdlc.c +++ b/src/vnet/hdlc/hdlc.c @@ -229,7 +229,7 @@ hdlc_init (vlib_main_t * vm) { hdlc_main_t *pm = &hdlc_main; - memset (pm, 0, sizeof (pm[0])); + clib_memset (pm, 0, sizeof (pm[0])); pm->vlib_main = vm; pm->protocol_info_by_name = hash_create_string (0, sizeof (uword)); diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 45a265ccdae..dba5a667b22 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -718,7 +718,7 @@ vnet_register_interface (vnet_main_t * vnm, char *tx_node_name = NULL, *output_node_name = NULL; pool_get (im->hw_interfaces, hw); - memset (hw, 0, sizeof (*hw)); + clib_memset (hw, 0, sizeof (*hw)); hw_index = hw - im->hw_interfaces; hw->hw_if_index = hw_index; @@ -831,7 +831,7 @@ vnet_register_interface (vnet_main_t * vnm, .is_deleted = 0, }; - memset (&r, 0, sizeof (r)); + clib_memset (&r, 0, sizeof (r)); r.type = VLIB_NODE_TYPE_INTERNAL; r.runtime_data = &rt; r.runtime_data_bytes = sizeof (rt); diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c index 644babef894..c27f3e87975 100644 --- a/src/vnet/interface_api.c +++ b/src/vnet/interface_api.c @@ -194,7 +194,7 @@ send_sw_interface_details (vpe_api_main_t * am, vnet_get_sup_hw_interface (am->vnet_main, swif->sw_if_index); vl_api_sw_interface_details_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_SW_INTERFACE_DETAILS); mp->sw_if_index = ntohl (swif->sw_if_index); mp->sup_sw_if_index = ntohl (swif->sup_sw_if_index); @@ -268,7 +268,7 @@ send_sw_interface_details (vpe_api_main_t * am, u16 outer_tag = 0; u16 b_vlanid = 0; u32 i_sid = 0; - memset (ð_hdr, 0, sizeof (eth_hdr)); + clib_memset (ð_hdr, 0, sizeof (eth_hdr)); if (!l2pbb_get (am->vlib_main, am->vnet_main, swif->sw_if_index, &vtr_op, &outer_tag, ð_hdr, &b_vlanid, &i_sid)) @@ -556,7 +556,7 @@ send_sw_interface_get_table_reply (vl_api_registration_t * reg, vl_api_sw_interface_get_table_reply_t *mp; 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_SW_INTERFACE_GET_TABLE_REPLY); mp->context = context; mp->retval = htonl (retval); @@ -719,7 +719,7 @@ send_sw_interface_event (vpe_api_main_t * am, vnet_hw_interface_t *hi = 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 = ntohs (VL_API_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (swif->sw_if_index); mp->client_index = reg->client_index; @@ -967,7 +967,7 @@ send_interface_rx_placement_details (vpe_api_main_t * am, { vl_api_sw_interface_rx_placement_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_RX_PLACEMENT_DETAILS); mp->sw_if_index = htonl (sw_if_index); @@ -1127,7 +1127,7 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) goto out; } - memset (&template, 0, sizeof (template)); + clib_memset (&template, 0, sizeof (template)); template.type = VNET_SW_INTERFACE_TYPE_SUB; template.sup_sw_if_index = hi->sw_if_index; template.sub.id = id; @@ -1207,7 +1207,7 @@ vl_api_create_subif_t_handler (vl_api_create_subif_t * mp) goto out; } - memset (&template, 0, sizeof (template)); + clib_memset (&template, 0, sizeof (template)); template.type = VNET_SW_INTERFACE_TYPE_SUB; template.sup_sw_if_index = sw_if_index; template.sub.id = sub_id; diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index 360898ea0fb..b11d35e9efa 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -687,7 +687,7 @@ create_sub_interfaces (vlib_main_t * vm, goto done; } - memset (&template, 0, sizeof (template)); + clib_memset (&template, 0, sizeof (template)); template.sub.eth.raw_flags = 0; if (unformat (input, "%d default", &id_min)) diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index 89ce274a6cc..f8585647c81 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -1157,7 +1157,7 @@ pcap_drop_trace_command_fn (vlib_main_t * vm, if (im->pcap_filename == 0) im->pcap_filename = format (0, "/tmp/drop.pcap%c", 0); - memset (&im->pcap_main, 0, sizeof (im->pcap_main)); + clib_memset (&im->pcap_main, 0, sizeof (im->pcap_main)); im->pcap_main.file_name = (char *) im->pcap_filename; im->pcap_main.n_packets_to_capture = 100; if (im->pcap_pkts_to_capture) diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c index a4808f23271..3626e96305b 100644 --- a/src/vnet/ip/icmp4.c +++ b/src/vnet/ip/icmp4.c @@ -766,8 +766,9 @@ icmp4_init (vlib_main_t * vm) foreach_icmp4_code; #undef _ - memset (cm->ip4_input_next_index_by_type, - ICMP_INPUT_NEXT_ERROR, sizeof (cm->ip4_input_next_index_by_type)); + clib_memset (cm->ip4_input_next_index_by_type, + ICMP_INPUT_NEXT_ERROR, + sizeof (cm->ip4_input_next_index_by_type)); ip4_icmp_register_type (vm, ICMP4_echo_request, ip4_icmp_echo_request_node.index); diff --git a/src/vnet/ip/icmp6.c b/src/vnet/ip/icmp6.c index 4252ac7ad59..37deb762d51 100644 --- a/src/vnet/ip/icmp6.c +++ b/src/vnet/ip/icmp6.c @@ -786,24 +786,25 @@ icmp6_init (vlib_main_t * vm) foreach_icmp6_code; #undef _ - memset (cm->input_next_index_by_type, - ICMP_INPUT_NEXT_DROP, sizeof (cm->input_next_index_by_type)); - memset (cm->max_valid_code_by_type, 0, sizeof (cm->max_valid_code_by_type)); + clib_memset (cm->input_next_index_by_type, + ICMP_INPUT_NEXT_DROP, sizeof (cm->input_next_index_by_type)); + clib_memset (cm->max_valid_code_by_type, 0, + sizeof (cm->max_valid_code_by_type)); #define _(a,n,t) cm->max_valid_code_by_type[ICMP6_##a] = clib_max (cm->max_valid_code_by_type[ICMP6_##a], n); foreach_icmp6_code; #undef _ - memset (cm->min_valid_hop_limit_by_type, 0, - sizeof (cm->min_valid_hop_limit_by_type)); + clib_memset (cm->min_valid_hop_limit_by_type, 0, + sizeof (cm->min_valid_hop_limit_by_type)); cm->min_valid_hop_limit_by_type[ICMP6_router_solicitation] = 255; cm->min_valid_hop_limit_by_type[ICMP6_router_advertisement] = 255; cm->min_valid_hop_limit_by_type[ICMP6_neighbor_solicitation] = 255; cm->min_valid_hop_limit_by_type[ICMP6_neighbor_advertisement] = 255; cm->min_valid_hop_limit_by_type[ICMP6_redirect] = 255; - memset (cm->min_valid_length_by_type, sizeof (icmp46_header_t), - sizeof (cm->min_valid_length_by_type)); + clib_memset (cm->min_valid_length_by_type, sizeof (icmp46_header_t), + sizeof (cm->min_valid_length_by_type)); cm->min_valid_length_by_type[ICMP6_router_solicitation] = sizeof (icmp6_neighbor_discovery_header_t); cm->min_valid_length_by_type[ICMP6_router_advertisement] = diff --git a/src/vnet/ip/ip4_format.c b/src/vnet/ip/ip4_format.c index 0a2d7d293d5..5399e44d93a 100644 --- a/src/vnet/ip/ip4_format.c +++ b/src/vnet/ip/ip4_format.c @@ -213,7 +213,7 @@ unformat_ip4_header (unformat_input_t * input, va_list * args) ip = p; } - memset (ip, 0, sizeof (ip[0])); + clib_memset (ip, 0, sizeof (ip[0])); ip->ip_version_and_header_length = IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS; if (!unformat (input, "%U: %U -> %U", diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 23e90df8b8a..192f301eb76 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -943,11 +943,11 @@ ip4_lookup_init (vlib_main_t * vm) { ethernet_arp_header_t h; - memset (&h, 0, sizeof (h)); + clib_memset (&h, 0, sizeof (h)); /* Set target ethernet address to all zeros. */ - memset (h.ip4_over_ethernet[1].ethernet, 0, - sizeof (h.ip4_over_ethernet[1].ethernet)); + clib_memset (h.ip4_over_ethernet[1].ethernet, 0, + sizeof (h.ip4_over_ethernet[1].ethernet)); #define _16(f,v) h.f = clib_host_to_net_u16 (v); #define _8(f,v) h.f = v; diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c index e6425ca703a..02ce12a5ff9 100755 --- a/src/vnet/ip/ip4_mtrie.c +++ b/src/vnet/ip/ip4_mtrie.c @@ -146,7 +146,7 @@ ip4_fib_mtrie_leaf_set_next_ply_index (u32 i) */ \ p->n_non_empty_leafs = (prefix_len > ply_base_len ? \ ARRAY_LEN (p->leaves) : 0); \ - memset (p->dst_address_bits_of_leaves, prefix_len, \ + clib_memset (p->dst_address_bits_of_leaves, prefix_len, \ sizeof (p->dst_address_bits_of_leaves)); \ p->dst_address_bits_base = ply_base_len; \ \ @@ -165,8 +165,8 @@ static void ply_16_init (ip4_fib_mtrie_16_ply_t * p, ip4_fib_mtrie_leaf_t init, uword prefix_len) { - memset (p->dst_address_bits_of_leaves, prefix_len, - sizeof (p->dst_address_bits_of_leaves)); + clib_memset (p->dst_address_bits_of_leaves, prefix_len, + sizeof (p->dst_address_bits_of_leaves)); PLY_INIT_LEAVES (p); } diff --git a/src/vnet/ip/ip4_pg.c b/src/vnet/ip/ip4_pg.c index 9697a3b9c89..d89424496f0 100644 --- a/src/vnet/ip/ip4_pg.c +++ b/src/vnet/ip/ip4_pg.c @@ -344,7 +344,7 @@ found: /* See if header is all fixed and specified except for checksum field. */ - memset (&cmp_mask, ~0, sizeof (cmp_mask)); + clib_memset (&cmp_mask, ~0, sizeof (cmp_mask)); cmp_mask.checksum = 0; pg_edit_group_get_fixed_packet_data (s, group_index, diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c index 3600d7cb9d3..ed4cbcf9f2e 100644 --- a/src/vnet/ip/ip4_punt_drop.c +++ b/src/vnet/ip/ip4_punt_drop.c @@ -445,7 +445,7 @@ ip4_punt_redirect_cmd (vlib_main_t * vm, ; else if (unformat (line_input, "via %U", unformat_vnet_sw_interface, vnm, &tx_sw_if_index)) - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); else { error = unformat_parse_error (line_input); diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c index 87fb7643823..42231d0e30d 100644 --- a/src/vnet/ip/ip4_reassembly.c +++ b/src/vnet/ip/ip4_reassembly.c @@ -368,7 +368,7 @@ ip4_reass_find_or_create (vlib_main_t * vm, ip4_reass_main_t * rm, else { pool_get (rt->pool, reass); - memset (reass, 0, sizeof (*reass)); + clib_memset (reass, 0, sizeof (*reass)); reass->id = ((u64) os_get_thread_index () * 1000000000) + rt->id_counter; ++rt->id_counter; @@ -1109,7 +1109,7 @@ ip4_reass_set (u32 timeout_ms, u32 max_reassemblies, if (ip4_reass_main.max_reass_n > 0 && new_nbuckets > old_nbuckets) { clib_bihash_16_8_t new_hash; - memset (&new_hash, 0, sizeof (new_hash)); + clib_memset (&new_hash, 0, sizeof (new_hash)); ip4_rehash_cb_ctx ctx; ctx.failure = 0; ctx.new_hash = &new_hash; diff --git a/src/vnet/ip/ip4_source_and_port_range_check.c b/src/vnet/ip/ip4_source_and_port_range_check.c index 1f9a32ea108..fe5c1f24309 100644 --- a/src/vnet/ip/ip4_source_and_port_range_check.c +++ b/src/vnet/ip/ip4_source_and_port_range_check.c @@ -903,7 +903,7 @@ protocol_port_range_dpo_alloc (void) protocol_port_range_dpo_t *ppr_dpo; pool_get_aligned (ppr_dpo_pool, ppr_dpo, CLIB_CACHE_LINE_BYTES); - memset (ppr_dpo, 0, sizeof (*ppr_dpo)); + clib_memset (ppr_dpo, 0, sizeof (*ppr_dpo)); ppr_dpo->n_free_ranges = N_PORT_RANGES_PER_DPO; diff --git a/src/vnet/ip/ip4_to_ip6.h b/src/vnet/ip/ip4_to_ip6.h index 9fedcc6fa35..b1905e4154b 100644 --- a/src/vnet/ip/ip4_to_ip6.h +++ b/src/vnet/ip/ip4_to_ip6.h @@ -260,8 +260,8 @@ icmp_to_icmp6 (vlib_buffer_t * p, ip4_to_ip6_set_fn_t fn, void *ctx, -2 * (sizeof (*ip6) - sizeof (*ip4)) - sizeof (*inner_frag)); ip6 = vlib_buffer_get_current (p); - clib_memcpy (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4, - 20 + 8); + memmove (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4, + 20 + 8); ip4 = (ip4_header_t *) u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)); icmp = (icmp46_header_t *) (ip4 + 1); @@ -286,8 +286,8 @@ icmp_to_icmp6 (vlib_buffer_t * p, ip4_to_ip6_set_fn_t fn, void *ctx, { vlib_buffer_advance (p, -2 * (sizeof (*ip6) - sizeof (*ip4))); ip6 = vlib_buffer_get_current (p); - clib_memcpy (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4, - 20 + 8); + memmove (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4, + 20 + 8); ip4 = (ip4_header_t *) u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)); icmp = (icmp46_header_t *) u8_ptr_add (ip4, sizeof (*ip4)); diff --git a/src/vnet/ip/ip6_format.c b/src/vnet/ip/ip6_format.c index b1a8adf58de..4d1793970df 100644 --- a/src/vnet/ip/ip6_format.c +++ b/src/vnet/ip/ip6_format.c @@ -235,8 +235,8 @@ unformat_ip6_address_and_mask (unformat_input_t * input, va_list * args) ip6_address_and_mask_t *am = va_arg (*args, ip6_address_and_mask_t *); ip6_address_t addr, mask; - memset (&addr, 0, sizeof (ip6_address_t)); - memset (&mask, 0, sizeof (ip6_address_t)); + clib_memset (&addr, 0, sizeof (ip6_address_t)); + clib_memset (&mask, 0, sizeof (ip6_address_t)); if (unformat (input, "any")) ; @@ -323,7 +323,7 @@ unformat_ip6_header (unformat_input_t * input, va_list * args) ip = p; } - memset (ip, 0, sizeof (ip[0])); + clib_memset (ip, 0, sizeof (ip[0])); ip->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (6 << 28); diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 9a9a64b54b8..54864ea5d08 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -2514,8 +2514,8 @@ static clib_error_t * ip6_hop_by_hop_init (vlib_main_t * vm) { ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main; - memset (hm->options, 0, sizeof (hm->options)); - memset (hm->trace, 0, sizeof (hm->trace)); + clib_memset (hm->options, 0, sizeof (hm->options)); + clib_memset (hm->trace, 0, sizeof (hm->trace)); hm->next_override = IP6_LOOKUP_NEXT_POP_HOP_BY_HOP; return (0); } @@ -2649,7 +2649,7 @@ ip6_lookup_init (vlib_main_t * vm) { icmp6_neighbor_solicitation_header_t p; - memset (&p, 0, sizeof (p)); + clib_memset (&p, 0, sizeof (p)); p.ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c index 355aba627fb..fbaf0007f19 100644 --- a/src/vnet/ip/ip6_hop_by_hop.c +++ b/src/vnet/ip/ip6_hop_by_hop.c @@ -809,9 +809,9 @@ ip6_hop_by_hop_ioam_init (vlib_main_t * vm) hm->unix_time_0 = (u32) time (0); /* Store starting time */ hm->vlib_time_0 = vlib_time_now (vm); hm->ioam_flag = IOAM_HBYH_MOD; - memset (hm->add_options, 0, sizeof (hm->add_options)); - memset (hm->pop_options, 0, sizeof (hm->pop_options)); - memset (hm->options_size, 0, sizeof (hm->options_size)); + clib_memset (hm->add_options, 0, sizeof (hm->add_options)); + clib_memset (hm->pop_options, 0, sizeof (hm->pop_options)); + clib_memset (hm->options_size, 0, sizeof (hm->options_size)); vnet_classify_register_unformat_opaque_index_fn (unformat_opaque_ioam); diff --git a/src/vnet/ip/ip6_hop_by_hop.h b/src/vnet/ip/ip6_hop_by_hop.h index 5f12f647dba..6ae2a2e8b51 100644 --- a/src/vnet/ip/ip6_hop_by_hop.h +++ b/src/vnet/ip/ip6_hop_by_hop.h @@ -214,7 +214,7 @@ ioam_flow_add (u8 encap, u8 * flow_name) u8 i; pool_get (hm->flows, flow); - memset (flow, 0, sizeof (flow_data_t)); + clib_memset (flow, 0, sizeof (flow_data_t)); index = flow - hm->flows; strncpy ((char *) flow->flow_name, (char *) flow_name, 31); diff --git a/src/vnet/ip/ip6_ll_table.c b/src/vnet/ip/ip6_ll_table.c index 67d05ed390f..dfcb2708259 100644 --- a/src/vnet/ip/ip6_ll_table.c +++ b/src/vnet/ip/ip6_ll_table.c @@ -304,7 +304,7 @@ ip6_ll_show_fib (vlib_main_t * vm, vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count"); - memset (ca, 0, sizeof (*ca)); + clib_memset (ca, 0, sizeof (*ca)); ca->fib_index = fib_index; BV (clib_bihash_foreach_key_value_pair) diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index 8466ba70313..369669cc303 100755 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -2653,7 +2653,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, nm->if_radv_pool_index_by_sw_if_index[sw_if_index] = ri; /* initialize default values (most of which are zero) */ - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); a->sw_if_index = sw_if_index; a->max_radv_interval = DEF_MAX_RADV_INTERVAL; @@ -2780,7 +2780,7 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index) ip0 = (ip6_header_t *) & rp0->ip; rh0 = (icmp6_multicast_listener_report_header_t *) & rp0->report_hdr; - memset (rp0, 0x0, sizeof (icmp6_multicast_listener_report_packet_t)); + clib_memset (rp0, 0x0, sizeof (icmp6_multicast_listener_report_packet_t)); ip0->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); @@ -2968,7 +2968,7 @@ ip6_neighbor_process_timer_event (vlib_main_t * vm, h0 = vlib_buffer_get_current (b0); - memset (h0, 0, sizeof (icmp6_router_solicitation_header_t)); + clib_memset (h0, 0, sizeof (icmp6_router_solicitation_header_t)); h0->ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28); h0->ip.payload_length = clib_host_to_net_u16 (sizeof (icmp6_router_solicitation_header_t) @@ -3176,8 +3176,8 @@ ip6_discover_neighbor_inline (vlib_main_t * vm, if (time_now - im->nd_throttle_last_seed_change_time[thread_index] > 1e-3) { (void) random_u64 (&im->nd_throttle_seeds[thread_index]); - memset (im->nd_throttle_bitmaps[thread_index], 0, - ND_THROTTLE_BITS / BITS (u8)); + clib_memset (im->nd_throttle_bitmaps[thread_index], 0, + ND_THROTTLE_BITS / BITS (u8)); im->nd_throttle_last_seed_change_time[thread_index] = time_now; } @@ -3571,7 +3571,7 @@ ip6_neighbor_ra_prefix (vlib_main_t * vm, u32 sw_if_index, mhash_set (&radv_info->address_to_prefix_index, prefix_addr, pi, /* old_value */ 0); - memset (prefix, 0x0, sizeof (ip6_radv_prefix_t)); + clib_memset (prefix, 0x0, sizeof (ip6_radv_prefix_t)); prefix->prefix_len = prefix_len; clib_memcpy (&prefix->prefix, prefix_addr, sizeof (ip6_address_t)); @@ -4677,7 +4677,7 @@ ip6_neighbor_init (vlib_main_t * vm) /* add call backs */ ip6_add_del_interface_address_callback_t cb; - memset (&cb, 0x0, sizeof (ip6_add_del_interface_address_callback_t)); + clib_memset (&cb, 0x0, sizeof (ip6_add_del_interface_address_callback_t)); /* when an interface address changes... */ cb.function = ip6_neighbor_add_del_interface_address; diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h index ea2fa155b5e..97d33713d3c 100644 --- a/src/vnet/ip/ip6_packet.h +++ b/src/vnet/ip/ip6_packet.h @@ -280,7 +280,7 @@ ip6_address_mask_from_width (ip6_address_t * a, u32 width) { int i, byte, bit, bitnum; ASSERT (width <= 128); - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); for (i = 0; i < width; i++) { bitnum = (7 - (i & 7)); diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c index b8944891cf9..ea8477f81a5 100644 --- a/src/vnet/ip/ip6_punt_drop.c +++ b/src/vnet/ip/ip6_punt_drop.c @@ -357,7 +357,7 @@ ip6_punt_redirect_cmd (vlib_main_t * vm, ; else if (unformat (line_input, "via %U", unformat_vnet_sw_interface, vnm, &tx_sw_if_index)) - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); else { error = unformat_parse_error (line_input); diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c index e62f9e50588..7f6c5ca4af7 100644 --- a/src/vnet/ip/ip6_reassembly.c +++ b/src/vnet/ip/ip6_reassembly.c @@ -402,7 +402,7 @@ ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node, else { pool_get (rt->pool, reass); - memset (reass, 0, sizeof (*reass)); + clib_memset (reass, 0, sizeof (*reass)); reass->id = ((u64) os_get_thread_index () * 1000000000) + rt->id_counter; ++rt->id_counter; @@ -1149,7 +1149,7 @@ ip6_reass_set (u32 timeout_ms, u32 max_reassemblies, if (ip6_reass_main.max_reass_n > 0 && new_nbuckets > old_nbuckets) { clib_bihash_48_8_t new_hash; - memset (&new_hash, 0, sizeof (new_hash)); + clib_memset (&new_hash, 0, sizeof (new_hash)); ip6_rehash_cb_ctx ctx; ctx.failure = 0; ctx.new_hash = &new_hash; diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index 2a342d08599..0d98ba5d597 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -128,7 +128,7 @@ send_ip_neighbor_details (u32 sw_if_index, vl_api_ip_neighbor_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 = ntohs (VL_API_IP_NEIGHBOR_DETAILS); mp->context = context; mp->sw_if_index = htonl (sw_if_index); @@ -204,7 +204,7 @@ send_ip_fib_details (vpe_api_main_t * am, mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp)); if (!mp) return; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS); mp->context = context; @@ -303,7 +303,7 @@ send_ip6_fib_details (vpe_api_main_t * am, mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp)); if (!mp) return; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS); mp->context = context; @@ -418,7 +418,7 @@ send_ip_mfib_details (vl_api_registration_t * reg, mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp)); if (!mp) return; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_IP_MFIB_DETAILS); mp->context = context; @@ -512,7 +512,7 @@ send_ip6_mfib_details (vpe_api_main_t * am, mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp)); if (!mp) return; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_IP6_MFIB_DETAILS); mp->context = context; @@ -622,7 +622,7 @@ vl_api_ip_punt_redirect_t_handler (vl_api_ip_punt_redirect_t * mp, { ip46_address_t nh; - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); if (mp->is_ip6) { @@ -998,7 +998,7 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp, clib_memcpy (&pfx.fp_addr.ip4, mp->dst_address, sizeof (pfx.fp_addr.ip4)); ip46_address_t nh; - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4)); n_labels = mp->next_hop_n_out_labels; @@ -1072,7 +1072,7 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp, clib_memcpy (&pfx.fp_addr.ip6, mp->dst_address, sizeof (pfx.fp_addr.ip6)); ip46_address_t nh; - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6)); n_labels = mp->next_hop_n_out_labels; @@ -1298,7 +1298,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp, sizeof (pfx.fp_grp_addr.ip4)); clib_memcpy (&pfx.fp_src_addr.ip4, mp->src_address, sizeof (pfx.fp_src_addr.ip4)); - memset (&nh.ip6, 0, sizeof (nh.ip6)); + clib_memset (&nh.ip6, 0, sizeof (nh.ip6)); clib_memcpy (&nh.ip4, mp->nh_address, sizeof (nh.ip4)); if (!ip46_address_is_zero (&pfx.fp_src_addr)) pfx.fp_len = 64; @@ -1361,7 +1361,7 @@ send_ip_details (vpe_api_main_t * am, vl_api_ip_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 = ntohs (VL_API_IP_DETAILS); mp->sw_if_index = ntohl (sw_if_index); @@ -1380,7 +1380,7 @@ send_ip_address_details (vpe_api_main_t * am, vl_api_ip_address_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 = ntohs (VL_API_IP_ADDRESS_DETAILS); if (is_ipv6) @@ -1463,7 +1463,7 @@ send_ip_unnumbered_details (vpe_api_main_t * am, vl_api_ip_unnumbered_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 = ntohs (VL_API_IP_UNNUMBERED_DETAILS); mp->context = context; @@ -1682,7 +1682,7 @@ send_ip6nd_proxy_details (vl_api_registration_t * reg, vl_api_ip6nd_proxy_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 = ntohs (VL_API_IP6ND_PROXY_DETAILS); mp->context = context; mp->sw_if_index = htonl (sw_if_index); @@ -1868,7 +1868,7 @@ vl_mfib_signal_send_one (vl_api_registration_t * reg, 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_MFIB_SIGNAL_DETAILS); mp->context = context; @@ -1932,7 +1932,7 @@ static void int rv = 0; clib_error_t *error; - memset (&args, 0, sizeof (args)); + clib_memset (&args, 0, sizeof (args)); ip_set (&args.prefix.fp_addr, mp->ip, mp->is_ip4); args.prefix.fp_len = mp->plen ? mp->plen : (mp->is_ip4 ? 32 : 128); args.sw_if_index = clib_net_to_host_u32 (mp->sw_if_index); @@ -1963,7 +1963,7 @@ ip_container_proxy_send_details (const fib_prefix_t * pfx, u32 sw_if_index, if (!mp) return 1; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_IP_CONTAINER_PROXY_DETAILS); mp->context = ctx->context; @@ -2416,7 +2416,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) if (reg && vl_api_can_send_msg (vl_reg)) { vl_api_ip4_arp_event_t * event = vl_msg_api_alloc (sizeof *event); - memset (event, 0, sizeof *event); + clib_memset (event, 0, sizeof *event); event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT); event->client_index = reg->client_index; event->pid = reg->client_pid; @@ -2455,7 +2455,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) if (vl_reg && vl_api_can_send_msg (vl_reg)) { vl_api_ip6_nd_event_t * event = vl_msg_api_alloc (sizeof *event); - memset (event, 0, sizeof *event); + clib_memset (event, 0, sizeof *event); event->_vl_msg_id = htons (VL_API_IP6_ND_EVENT); event->client_index = reg->client_index; event->pid = reg->client_pid; @@ -2493,7 +2493,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) sizeof (vl_api_ip6_ra_prefix_info_t); vl_api_ip6_ra_event_t *event = vl_msg_api_alloc (event_size); - memset (event, 0, event_size); + clib_memset (event, 0, event_size); event->_vl_msg_id = htons (VL_API_IP6_RA_EVENT); event->client_index = reg->client_index; event->pid = reg->client_pid; @@ -2641,7 +2641,7 @@ vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp) pool_put (am->arp_events, event); goto reply; } - memset (event, 0, sizeof (*event)); + clib_memset (event, 0, sizeof (*event)); /* Python API expects events to have no context */ event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT); @@ -2779,7 +2779,7 @@ vl_api_want_ip6_nd_events_t_handler (vl_api_want_ip6_nd_events_t * mp) pool_put (am->nd_events, event); goto reply; } - memset (event, 0, sizeof (*event)); + clib_memset (event, 0, sizeof (*event)); event->_vl_msg_id = ntohs (VL_API_IP6_ND_EVENT); event->client_index = mp->client_index; @@ -2959,7 +2959,7 @@ send_proxy_arp_details (const ip4_address_t * lo_addr, ctx = data; 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_PROXY_ARP_DETAILS); mp->context = ctx->context; mp->proxy.vrf_id = htonl (fib_index); @@ -3002,7 +3002,7 @@ send_proxy_arp_intfc_details (vnet_main_t * vnm, ctx = data; 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_PROXY_ARP_INTFC_DETAILS); mp->context = ctx->context; mp->sw_if_index = htonl (si->sw_if_index); @@ -3303,7 +3303,7 @@ vl_api_ip_reassembly_get_t_handler (vl_api_ip_reassembly_get_t * mp) return; vl_api_ip_reassembly_get_reply_t *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_IP_REASSEMBLY_GET_REPLY); rmp->context = mp->context; rmp->retval = 0; diff --git a/src/vnet/ip/ip_init.c b/src/vnet/ip/ip_init.c index ddd66c2e817..638cbd167db 100644 --- a/src/vnet/ip/ip_init.c +++ b/src/vnet/ip/ip_init.c @@ -47,7 +47,7 @@ ip_main_init (vlib_main_t * vm) ip_main_t *im = &ip_main; clib_error_t *error = 0; - memset (im, 0, sizeof (im[0])); + clib_memset (im, 0, sizeof (im[0])); { ip_protocol_info_t *pi; diff --git a/src/vnet/ip/ip_neighbor.c b/src/vnet/ip/ip_neighbor.c index f5a816d5a18..7d1998d25b8 100644 --- a/src/vnet/ip/ip_neighbor.c +++ b/src/vnet/ip/ip_neighbor.c @@ -312,7 +312,7 @@ ip_neighbor_scan_cli (vlib_main_t * vm, unformat_input_t * input, u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0; ip_neighbor_scan_arg_t arg; - memset (&arg, 0, sizeof (arg)); + clib_memset (&arg, 0, sizeof (arg)); arg.mode = IP_SCAN_V46_NEIGHBORS; /* Get a line of input. */ diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c index f173c28c83b..d5a56fa5547 100644 --- a/src/vnet/ip/ip_types_api.c +++ b/src/vnet/ip/ip_types_api.c @@ -38,7 +38,7 @@ ip_address_union_decode (const vl_api_address_union_t * in, switch (clib_net_to_host_u32 (af)) { case ADDRESS_IP4: - memset (out, 0, sizeof (*out)); + clib_memset (out, 0, sizeof (*out)); clib_memcpy (&out->ip4, &in->ip4, sizeof (out->ip4)); type = IP46_TYPE_IP4; break; diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c index 017ca0db39b..9986a709fef 100644 --- a/src/vnet/ip/lookup.c +++ b/src/vnet/ip/lookup.c @@ -137,7 +137,7 @@ ip_interface_address_add_del (ip_lookup_main_t * lm, u32 hi; /* head index */ pool_get (lm->if_address_pool, a); - memset (a, ~0, sizeof (a[0])); + clib_memset (a, ~0, sizeof (a[0])); ai = a - lm->if_address_pool; hi = pi = lm->if_address_pool_index_by_sw_if_index[sw_if_index]; @@ -336,7 +336,7 @@ vnet_ip_route_cmd (vlib_main_t * vm, is_del = 0; table_id = 0; count = 1; - memset (&pfx, 0, sizeof (pfx)); + clib_memset (&pfx, 0, sizeof (pfx)); /* Get a line of input. */ if (!unformat_user (main_input, unformat_line_input, line_input)) @@ -344,7 +344,7 @@ vnet_ip_route_cmd (vlib_main_t * vm, while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { - memset (&rpath, 0, sizeof (rpath)); + clib_memset (&rpath, 0, sizeof (rpath)); if (unformat (line_input, "table %d", &table_id)) ; @@ -819,8 +819,8 @@ vnet_ip_mroute_cmd (vlib_main_t * vm, vnm = vnet_get_main (); is_del = 0; table_id = 0; - memset (&pfx, 0, sizeof (pfx)); - memset (&rpath, 0, sizeof (rpath)); + clib_memset (&pfx, 0, sizeof (pfx)); + clib_memset (&rpath, 0, sizeof (rpath)); rpath.frp_sw_if_index = ~0; /* Get a line of input. */ @@ -859,27 +859,27 @@ vnet_ip_mroute_cmd (vlib_main_t * vm, unformat_ip4_address, &pfx.fp_grp_addr.ip4, &pfx.fp_len)) { - memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4)); + clib_memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4)); pfx.fp_proto = FIB_PROTOCOL_IP4; } else if (unformat (line_input, "%U/%d", unformat_ip6_address, &pfx.fp_grp_addr.ip6, &pfx.fp_len)) { - memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6)); + clib_memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6)); pfx.fp_proto = FIB_PROTOCOL_IP6; } else if (unformat (line_input, "%U", unformat_ip4_address, &pfx.fp_grp_addr.ip4)) { - memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4)); + clib_memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4)); pfx.fp_proto = FIB_PROTOCOL_IP4; pfx.fp_len = 32; } else if (unformat (line_input, "%U", unformat_ip6_address, &pfx.fp_grp_addr.ip6)) { - memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6)); + clib_memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6)); pfx.fp_proto = FIB_PROTOCOL_IP6; pfx.fp_len = 128; } @@ -901,12 +901,12 @@ vnet_ip_mroute_cmd (vlib_main_t * vm, unformat_vnet_sw_interface, vnm, &rpath.frp_sw_if_index)) { - memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr)); + clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr)); rpath.frp_weight = 1; } else if (unformat (line_input, "via local")) { - memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr)); + clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr)); rpath.frp_sw_if_index = ~0; rpath.frp_weight = 1; rpath.frp_flags |= FIB_ROUTE_PATH_LOCAL; @@ -1389,7 +1389,7 @@ ip_container_cmd (vlib_main_t * vm, vnm = vnet_get_main (); is_del = 0; sw_if_index = ~0; - memset (&pfx, 0, sizeof (pfx)); + clib_memset (&pfx, 0, sizeof (pfx)); /* Get a line of input. */ if (!unformat_user (main_input, unformat_line_input, line_input)) diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c index f24a43fdece..538a1ac610e 100644 --- a/src/vnet/ip/punt.c +++ b/src/vnet/ip/punt.c @@ -270,7 +270,7 @@ punt_socket_register (bool is_ip4, u8 protocol, u16 port, punt_client_t *v = is_ip4 ? pm->clients_by_dst_port4 : pm->clients_by_dst_port6; - memset (&c, 0, sizeof (c)); + clib_memset (&c, 0, sizeof (c)); memcpy (c.caddr.sun_path, client_pathname, sizeof (c.caddr.sun_path)); c.caddr.sun_family = AF_UNIX; c.port = port; @@ -866,7 +866,7 @@ punt_config (vlib_main_t * vm, unformat_input_t * input) return clib_error_return (0, "socket error"); } - memset (&addr, 0, sizeof (addr)); + clib_memset (&addr, 0, sizeof (addr)); addr.sun_family = AF_UNIX; if (*socket_path == '\0') { diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c index e6446ef7033..5df968414c8 100644 --- a/src/vnet/ipfix-export/flow_api.c +++ b/src/vnet/ipfix-export/flow_api.c @@ -158,7 +158,7 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp) 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_IPFIX_EXPORTER_DETAILS); rmp->context = mp->context; memcpy (rmp->collector_address, frm->ipfix_collector.data, @@ -219,7 +219,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_IPFIX_CLASSIFY_STREAM_DETAILS); rmp->context = mp->context; rmp->domain_id = htonl (fcm->domain_id); @@ -255,7 +255,7 @@ static void goto out; } - memset (&args, 0, sizeof (args)); + clib_memset (&args, 0, sizeof (args)); table = 0; int i; @@ -316,7 +316,7 @@ send_ipfix_classify_table_details (u32 table_index, ipfix_classify_table_t *table = &fcm->tables[table_index]; 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_IPFIX_CLASSIFY_TABLE_DETAILS); mp->context = context; mp->table_id = htonl (table->classify_table_index); diff --git a/src/vnet/ipfix-export/flow_report_classify.c b/src/vnet/ipfix-export/flow_report_classify.c index 196cb725ffe..449bf228ce9 100644 --- a/src/vnet/ipfix-export/flow_report_classify.c +++ b/src/vnet/ipfix-export/flow_report_classify.c @@ -408,7 +408,7 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm, if (fcm->src_port == 0) clib_error_return (0, "call 'set ipfix classify stream' first"); - memset (&args, 0, sizeof (args)); + clib_memset (&args, 0, sizeof (args)); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c index 718463d7352..9c58e520623 100644 --- a/src/vnet/ipip/ipip.c +++ b/src/vnet/ipip/ipip.c @@ -485,7 +485,7 @@ ipip_add_tunnel (ipip_transport_t transport, return VNET_API_ERROR_IF_ALREADY_EXISTS; pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); /* Reconcile the real dev_instance and a possible requested instance */ u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */ @@ -590,7 +590,7 @@ ipip_init (vlib_main_t * vm) { ipip_main_t *gm = &ipip_main; - memset (gm, 0, sizeof (gm[0])); + clib_memset (gm, 0, sizeof (gm[0])); gm->vlib_main = vm; gm->vnet_main = vnet_get_main (); gm->tunnel_by_key = diff --git a/src/vnet/ipip/ipip_api.c b/src/vnet/ipip/ipip_api.c index b3fc0817a85..94ba1bb4623 100644 --- a/src/vnet/ipip/ipip_api.c +++ b/src/vnet/ipip/ipip_api.c @@ -110,7 +110,7 @@ send_ipip_tunnel_details (ipip_tunnel_t * t, fib_table_t *ft; rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); + clib_memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = htons (VL_API_IPIP_TUNNEL_DETAILS); if (is_ipv6) { diff --git a/src/vnet/ipip/sixrd.c b/src/vnet/ipip/sixrd.c index b03572917cc..cc5bfa33d91 100644 --- a/src/vnet/ipip/sixrd.c +++ b/src/vnet/ipip/sixrd.c @@ -297,7 +297,7 @@ sixrd_add_tunnel (ip6_address_t * ip6_prefix, u8 ip6_prefix_len, /* Get tunnel index */ pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */ /* Init tunnel struct */ diff --git a/src/vnet/ipsec-gre/interface.c b/src/vnet/ipsec-gre/interface.c index 7dc8301e96a..700072350ca 100644 --- a/src/vnet/ipsec-gre/interface.c +++ b/src/vnet/ipsec-gre/interface.c @@ -105,7 +105,7 @@ vnet_ipsec_gre_add_del_tunnel (vnet_ipsec_gre_add_del_tunnel_args_t * a, u64 key; ipsec_add_del_ipsec_gre_tunnel_args_t args; - memset (&args, 0, sizeof (args)); + clib_memset (&args, 0, sizeof (args)); args.is_add = a->is_add; args.local_sa_id = a->lsa; args.remote_sa_id = a->rsa; @@ -122,7 +122,7 @@ vnet_ipsec_gre_add_del_tunnel (vnet_ipsec_gre_add_del_tunnel_args_t * a, return VNET_API_ERROR_INVALID_VALUE; pool_get_aligned (igm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); if (vec_len (igm->free_ipsec_gre_tunnel_hw_if_indices) > 0) { @@ -270,7 +270,7 @@ create_ipsec_gre_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->lsa = lsa; a->rsa = rsa; diff --git a/src/vnet/ipsec-gre/ipsec_gre.c b/src/vnet/ipsec-gre/ipsec_gre.c index abf81e05bb9..758807be175 100644 --- a/src/vnet/ipsec-gre/ipsec_gre.c +++ b/src/vnet/ipsec-gre/ipsec_gre.c @@ -374,7 +374,7 @@ ipsec_gre_init (vlib_main_t * vm) ipsec_gre_main_t *igm = &ipsec_gre_main; clib_error_t *error; - memset (igm, 0, sizeof (igm[0])); + clib_memset (igm, 0, sizeof (igm[0])); igm->vlib_main = vm; igm->vnet_main = vnet_get_main (); diff --git a/src/vnet/ipsec-gre/ipsec_gre_api.c b/src/vnet/ipsec-gre/ipsec_gre_api.c index c29b9b8816e..3f85c4fc266 100644 --- a/src/vnet/ipsec-gre/ipsec_gre_api.c +++ b/src/vnet/ipsec-gre/ipsec_gre_api.c @@ -62,7 +62,7 @@ vl_api_ipsec_gre_add_del_tunnel_t_handler (vl_api_ipsec_gre_add_del_tunnel_t * goto out; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); /* ip addresses sent in network byte order */ clib_memcpy (&(a->src), mp->src_address, 4); @@ -88,7 +88,7 @@ static void send_ipsec_gre_tunnel_details vl_api_ipsec_gre_tunnel_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 = ntohs (VL_API_IPSEC_GRE_TUNNEL_DETAILS); clib_memcpy (rmp->src_address, &(t->tunnel_src), 4); clib_memcpy (rmp->dst_address, &(t->tunnel_dst), 4); diff --git a/src/vnet/ipsec/ah_decrypt.c b/src/vnet/ipsec/ah_decrypt.c index 941368a9695..a69c7d24f47 100644 --- a/src/vnet/ipsec/ah_decrypt.c +++ b/src/vnet/ipsec/ah_decrypt.c @@ -179,11 +179,11 @@ ah_decrypt_inline (vlib_main_t * vm, { u8 sig[64]; u8 digest[64]; - memset (sig, 0, sizeof (sig)); - memset (digest, 0, sizeof (digest)); + clib_memset (sig, 0, sizeof (sig)); + clib_memset (digest, 0, sizeof (digest)); u8 *icv = ah0->auth_data; memcpy (digest, icv, icv_size); - memset (icv, 0, icv_size); + clib_memset (icv, 0, icv_size); if (is_ip6) { diff --git a/src/vnet/ipsec/ah_encrypt.c b/src/vnet/ipsec/ah_encrypt.c index 856eab62c91..47f3b3884c0 100644 --- a/src/vnet/ipsec/ah_encrypt.c +++ b/src/vnet/ipsec/ah_encrypt.c @@ -212,7 +212,7 @@ ah_encrypt_inline (vlib_main_t * vm, { ip_hdr_size = sizeof (ip4_header_t); oh0 = vlib_buffer_get_current (i_b0); - memset (oh0, 0, sizeof (ip4_and_ah_header_t)); + clib_memset (oh0, 0, sizeof (ip4_and_ah_header_t)); if (PREDICT_TRUE (sa0->is_tunnel)) { @@ -265,11 +265,11 @@ ah_encrypt_inline (vlib_main_t * vm, } u8 sig[64]; - memset (sig, 0, sizeof (sig)); + clib_memset (sig, 0, sizeof (sig)); u8 *digest = vlib_buffer_get_current (i_b0) + ip_hdr_size + sizeof (ah_header_t); - memset (digest, 0, icv_size); + clib_memset (digest, 0, icv_size); unsigned size = hmac_calc (sa0->integ_alg, sa0->integ_key, sa0->integ_key_len, diff --git a/src/vnet/ipsec/esp.h b/src/vnet/ipsec/esp.h index 73d43262e26..50c4d395ff9 100644 --- a/src/vnet/ipsec/esp.h +++ b/src/vnet/ipsec/esp.h @@ -259,7 +259,7 @@ ipsec_proto_init () ipsec_proto_main_t *em = &ipsec_proto_main; vlib_thread_main_t *tm = vlib_get_thread_main (); - memset (em, 0, sizeof (em[0])); + clib_memset (em, 0, sizeof (em[0])); vec_validate (em->ipsec_proto_main_crypto_algs, IPSEC_CRYPTO_N_ALG - 1); em->ipsec_proto_main_crypto_algs[IPSEC_CRYPTO_ALG_AES_CBC_128].type = diff --git a/src/vnet/ipsec/esp_decrypt.c b/src/vnet/ipsec/esp_decrypt.c index bfddb9ece8d..fc45d7ee63d 100644 --- a/src/vnet/ipsec/esp_decrypt.c +++ b/src/vnet/ipsec/esp_decrypt.c @@ -213,7 +213,7 @@ esp_decrypt_inline (vlib_main_t * vm, u8 sig[64]; int icv_size = em->ipsec_proto_main_integ_algs[sa0->integ_alg].trunc_size; - memset (sig, 0, sizeof (sig)); + clib_memset (sig, 0, sizeof (sig)); u8 *icv = vlib_buffer_get_current (i_b0) + i_b0->current_length - icv_size; diff --git a/src/vnet/ipsec/ikev2.c b/src/vnet/ipsec/ikev2.c index bb6818e311c..ac20d4a9a10 100644 --- a/src/vnet/ipsec/ikev2.c +++ b/src/vnet/ipsec/ikev2.c @@ -1488,7 +1488,7 @@ ikev2_create_tunnel_interface (vnet_main_t * vnm, ikev2_sa_t * sa, return 1; } - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); a.is_add = 1; if (sa->is_initiator) { @@ -1832,7 +1832,7 @@ ikev2_generate_message (ikev2_sa_t * sa, ike_header_t * ike, void *user) ikev2_sa_proposal_t *proposals = (ikev2_sa_proposal_t *) user; ikev2_notify_t notify; u8 *data = vec_new (u8, 4); - memset (¬ify, 0, sizeof (notify)); + clib_memset (¬ify, 0, sizeof (notify)); notify.protocol_id = IKEV2_PROTOCOL_ESP; notify.spi = sa->childs[0].i_proposals->spi; *(u32 *) data = clib_host_to_net_u32 (notify.spi); @@ -2116,7 +2116,7 @@ ikev2_node_fn (vlib_main_t * vm, if (ike0->exchange == IKEV2_EXCHANGE_SA_INIT) { sa0 = &sa; - memset (sa0, 0, sizeof (*sa0)); + clib_memset (sa0, 0, sizeof (*sa0)); if (ike0->flags & IKEV2_HDR_FLAG_INITIATOR) { @@ -2691,7 +2691,7 @@ ikev2_add_del_profile (vlib_main_t * vm, u8 * name, int is_add) return clib_error_return (0, "policy %v already exists", name); pool_get (km->profiles, p); - memset (p, 0, sizeof (*p)); + clib_memset (p, 0, sizeof (*p)); p->name = vec_dup (name); p->responder.sw_if_index = ~0; uword index = p - km->profiles; @@ -2956,7 +2956,7 @@ ikev2_initiate_sa_init (vlib_main_t * vm, u8 * name) /* Prepare the SA and the IKE payload */ ikev2_sa_t sa; - memset (&sa, 0, sizeof (ikev2_sa_t)); + clib_memset (&sa, 0, sizeof (ikev2_sa_t)); ikev2_payload_chain_t *chain = 0; ikev2_payload_new_chain (chain); @@ -3296,7 +3296,7 @@ ikev2_init (vlib_main_t * vm) vlib_thread_main_t *tm = vlib_get_thread_main (); int thread_id; - memset (km, 0, sizeof (ikev2_main_t)); + clib_memset (km, 0, sizeof (ikev2_main_t)); km->vnet_main = vnet_get_main (); km->vlib_main = vm; diff --git a/src/vnet/ipsec/ikev2_crypto.c b/src/vnet/ipsec/ikev2_crypto.c index d595570de44..037a3f5777e 100644 --- a/src/vnet/ipsec/ikev2_crypto.c +++ b/src/vnet/ipsec/ikev2_crypto.c @@ -539,10 +539,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t) { sa->i_dh_data = vec_new (u8, t->key_len); x_off = len - BN_num_bytes (x); - memset (sa->i_dh_data, 0, x_off); + clib_memset (sa->i_dh_data, 0, x_off); BN_bn2bin (x, sa->i_dh_data + x_off); y_off = t->key_len - BN_num_bytes (y); - memset (sa->i_dh_data + len, 0, y_off - len); + clib_memset (sa->i_dh_data + len, 0, y_off - len); BN_bn2bin (y, sa->i_dh_data + y_off); const BIGNUM *prv = EC_KEY_get0_private_key (ec); @@ -554,10 +554,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t) { sa->r_dh_data = vec_new (u8, t->key_len); x_off = len - BN_num_bytes (x); - memset (sa->r_dh_data, 0, x_off); + clib_memset (sa->r_dh_data, 0, x_off); BN_bn2bin (x, sa->r_dh_data + x_off); y_off = t->key_len - BN_num_bytes (y); - memset (sa->r_dh_data + len, 0, y_off - len); + clib_memset (sa->r_dh_data + len, 0, y_off - len); BN_bn2bin (y, sa->r_dh_data + y_off); x = BN_bin2bn (sa->i_dh_data, len, x); @@ -569,10 +569,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t) EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y, bn_ctx); x_off = len - BN_num_bytes (x); - memset (sa->dh_shared_key, 0, x_off); + clib_memset (sa->dh_shared_key, 0, x_off); BN_bn2bin (x, sa->dh_shared_key + x_off); y_off = t->key_len - BN_num_bytes (y); - memset (sa->dh_shared_key + len, 0, y_off - len); + clib_memset (sa->dh_shared_key + len, 0, y_off - len); BN_bn2bin (y, sa->dh_shared_key + y_off); } @@ -658,10 +658,10 @@ ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t) EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y, bn_ctx); sa->dh_shared_key = vec_new (u8, t->key_len); x_off = len - BN_num_bytes (x); - memset (sa->dh_shared_key, 0, x_off); + clib_memset (sa->dh_shared_key, 0, x_off); BN_bn2bin (x, sa->dh_shared_key + x_off); y_off = t->key_len - BN_num_bytes (y); - memset (sa->dh_shared_key + len, 0, y_off - len); + clib_memset (sa->dh_shared_key + len, 0, y_off - len); BN_bn2bin (y, sa->dh_shared_key + y_off); EC_KEY_free (ec); diff --git a/src/vnet/ipsec/ikev2_payload.c b/src/vnet/ipsec/ikev2_payload.c index 34595380ec1..e5fa0149feb 100644 --- a/src/vnet/ipsec/ikev2_payload.c +++ b/src/vnet/ipsec/ikev2_payload.c @@ -111,7 +111,7 @@ ikev2_payload_add_hdr (ikev2_payload_chain_t * c, u8 payload_type, int len) c->last_hdr_off = vec_len (c->data); vec_add2 (c->data, tmp, len); hdr = (ike_payload_header_t *) tmp; - memset (hdr, 0, len); + clib_memset (hdr, 0, len); hdr->length = clib_host_to_net_u16 (len); diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c index d1b82b51326..6e4c7f1b687 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -126,7 +126,7 @@ ipsec_add_del_spd (vlib_main_t * vm, u32 spd_id, int is_add) else /* create new SPD */ { pool_get (im->spds, spd); - memset (spd, 0, sizeof (*spd)); + clib_memset (spd, 0, sizeof (*spd)); spd_index = spd - im->spds; spd->id = spd_id; hash_set (im->spd_index_by_spd_id, spd_id, spd_index); @@ -546,7 +546,7 @@ ipsec_init (vlib_main_t * vm) ipsec_rand_seed (); - memset (im, 0, sizeof (im[0])); + clib_memset (im, 0, sizeof (im[0])); im->vnet_main = vnet_get_main (); im->vlib_main = vm; diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c index 37daee0b64f..f80c3400a6f 100644 --- a/src/vnet/ipsec/ipsec_api.c +++ b/src/vnet/ipsec/ipsec_api.c @@ -125,7 +125,7 @@ static void vl_api_ipsec_spd_add_del_entry_t_handler #if WITH_LIBSSL > 0 ipsec_policy_t p; - memset (&p, 0, sizeof (p)); + clib_memset (&p, 0, sizeof (p)); p.id = ntohl (mp->spd_id); p.priority = ntohl (mp->priority); @@ -189,7 +189,7 @@ static void vl_api_ipsec_sad_add_del_entry_t_handler ipsec_main_t *im = &ipsec_main; ipsec_sa_t sa; - memset (&sa, 0, sizeof (sa)); + clib_memset (&sa, 0, sizeof (sa)); sa.id = ntohl (mp->sad_id); sa.spi = ntohl (mp->spi); @@ -259,7 +259,7 @@ send_ipsec_spds_details (ipsec_spd_t * spd, vl_api_registration_t * reg, vl_api_ipsec_spds_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 = ntohs (VL_API_IPSEC_SPDS_DETAILS); mp->context = context; @@ -297,7 +297,7 @@ send_ipsec_spd_details (ipsec_policy_t * p, vl_api_registration_t * reg, vl_api_ipsec_spd_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 = ntohs (VL_API_IPSEC_SPD_DETAILS); mp->context = context; @@ -401,7 +401,7 @@ vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t * #if WITH_LIBSSL > 0 ipsec_add_del_tunnel_args_t tun; - memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t)); + clib_memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t)); tun.is_add = mp->is_add; tun.esn = mp->esn; @@ -447,7 +447,7 @@ send_ipsec_sa_details (ipsec_sa_t * sa, vl_api_registration_t * reg, vl_api_ipsec_sa_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 = ntohs (VL_API_IPSEC_SA_DETAILS); mp->context = context; diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c index 9cbd2493ed4..4e382bdeab5 100644 --- a/src/vnet/ipsec/ipsec_cli.c +++ b/src/vnet/ipsec/ipsec_cli.c @@ -79,7 +79,7 @@ ipsec_sa_add_del_command_fn (vlib_main_t * vm, u8 *ck = 0, *ik = 0; clib_error_t *error = NULL; - memset (&sa, 0, sizeof (sa)); + clib_memset (&sa, 0, sizeof (sa)); if (!unformat_user (input, unformat_line_input, line_input)) return 0; @@ -262,7 +262,7 @@ ipsec_policy_add_del_command_fn (vlib_main_t * vm, u32 tmp, tmp2; clib_error_t *error = NULL; - memset (&p, 0, sizeof (p)); + clib_memset (&p, 0, sizeof (p)); p.lport.stop = p.rport.stop = ~0; p.laddr.stop.ip4.as_u32 = p.raddr.stop.ip4.as_u32 = (u32) ~ 0; p.laddr.stop.ip6.as_u64[0] = p.laddr.stop.ip6.as_u64[1] = (u64) ~ 0; @@ -394,7 +394,7 @@ set_ipsec_sa_key_command_fn (vlib_main_t * vm, u8 *ck = 0, *ik = 0; clib_error_t *error = NULL; - memset (&sa, 0, sizeof (sa)); + clib_memset (&sa, 0, sizeof (sa)); if (!unformat_user (input, unformat_line_input, line_input)) return 0; @@ -746,7 +746,7 @@ create_ipsec_tunnel_command_fn (vlib_main_t * vm, u32 num_m_args = 0; clib_error_t *error = NULL; - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); a.is_add = 1; /* Get a line of input. */ diff --git a/src/vnet/ipsec/ipsec_if.c b/src/vnet/ipsec/ipsec_if.c index 2640f25c011..b8cba149584 100644 --- a/src/vnet/ipsec/ipsec_if.c +++ b/src/vnet/ipsec/ipsec_if.c @@ -291,7 +291,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, return VNET_API_ERROR_INVALID_VALUE; pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); dev_instance = t - im->tunnel_interfaces; if (args->renumber) @@ -309,7 +309,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, dev_instance); pool_get (im->sad, sa); - memset (sa, 0, sizeof (*sa)); + clib_memset (sa, 0, sizeof (*sa)); t->input_sa_index = sa - im->sad; sa->spi = args->remote_spi; sa->tunnel_src_addr.ip4.as_u32 = args->remote_ip.as_u32; @@ -334,7 +334,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm, } pool_get (im->sad, sa); - memset (sa, 0, sizeof (*sa)); + clib_memset (sa, 0, sizeof (*sa)); t->output_sa_index = sa - im->sad; sa->spi = args->local_spi; sa->tunnel_src_addr.ip4.as_u32 = args->local_ip.as_u32; @@ -456,7 +456,7 @@ ipsec_add_del_ipsec_gre_tunnel (vnet_main_t * vnm, return VNET_API_ERROR_INVALID_VALUE; pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); t->input_sa_index = isa; t->output_sa_index = osa; diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c index eb04459f234..377880c3e64 100644 --- a/src/vnet/l2/l2_api.c +++ b/src/vnet/l2/l2_api.c @@ -80,7 +80,7 @@ send_l2_xconnect_details (vl_api_registration_t * reg, u32 context, vl_api_l2_xconnect_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 = ntohs (VL_API_L2_XCONNECT_DETAILS); mp->context = context; mp->rx_sw_if_index = htonl (rx_sw_if_index); @@ -135,7 +135,7 @@ send_l2fib_table_entry (vpe_api_main_t * am, vl_api_l2_fib_table_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 = ntohs (VL_API_L2_FIB_TABLE_DETAILS); mp->bd_id = @@ -456,7 +456,7 @@ send_bridge_domain_details (l2input_main_t * l2im, mp = vl_msg_api_alloc (sizeof (*mp) + (n_sw_ifs * sizeof (vl_api_bridge_domain_sw_if_t))); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS); mp->bd_id = ntohl (bd_config->bd_id); mp->flood = bd_feature_flood (bd_config); @@ -781,7 +781,7 @@ send_bd_ip_mac_entry (vpe_api_main_t * am, vl_api_bd_ip_mac_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 = ntohs (VL_API_BD_IP_MAC_DETAILS); mp->bd_id = ntohl (bd_id); diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c index 47bdce6af68..59149093b21 100644 --- a/src/vnet/l2/l2_bd.c +++ b/src/vnet/l2/l2_bd.c @@ -1298,7 +1298,7 @@ bd_add_del_command_fn (vlib_main_t * vm, unformat_input_t * input, goto done; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = is_add; a->bd_id = bd_id; a->flood = (u8) flood; diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c index aa325052487..46c041e72a0 100644 --- a/src/vnet/l2/l2_fib.c +++ b/src/vnet/l2/l2_fib.c @@ -1242,7 +1242,7 @@ l2fib_init (vlib_main_t * vm) L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE); /* verify the key constructor is good, since it is endian-sensitive */ - memset (test_mac, 0, sizeof (test_mac)); + clib_memset (test_mac, 0, sizeof (test_mac)); test_mac[0] = 0x11; test_key.raw = 0; test_key.raw = l2fib_make_key ((u8 *) & test_mac, 0x1234); diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c index 9727d408088..fbd3b940fae 100644 --- a/src/vnet/l2/l2_input.c +++ b/src/vnet/l2/l2_input.c @@ -649,7 +649,7 @@ set_int_l2_mode (vlib_main_t * vm, vnet_main_t * vnet_main, /* */ /* Clear L2 output config */ out_config = l2output_intf_config (sw_if_index); - memset (out_config, 0, sizeof (l2_output_config_t)); + clib_memset (out_config, 0, sizeof (l2_output_config_t)); /* Make sure any L2-output packet to this interface now in L3 mode is * dropped. This may happen if L2 FIB MAC entry is stale */ diff --git a/src/vnet/l2/l2_rw.c b/src/vnet/l2/l2_rw.c index 0b5e970944d..5b0034ca43e 100644 --- a/src/vnet/l2/l2_rw.c +++ b/src/vnet/l2/l2_rw.c @@ -381,9 +381,9 @@ l2_rw_mod_entry (u32 * index, skip -= e->skip_n_vectors * sizeof (u32x4); e->rewrite_n_vectors = (skip + len - 1) / sizeof (u32x4) + 1; vec_alloc_aligned (e->mask, e->rewrite_n_vectors, sizeof (u32x4)); - memset (e->mask, 0, e->rewrite_n_vectors * sizeof (u32x4)); + clib_memset (e->mask, 0, e->rewrite_n_vectors * sizeof (u32x4)); vec_alloc_aligned (e->value, e->rewrite_n_vectors, sizeof (u32x4)); - memset (e->value, 0, e->rewrite_n_vectors * sizeof (u32x4)); + clib_memset (e->value, 0, e->rewrite_n_vectors * sizeof (u32x4)); clib_memcpy (((u8 *) e->value) + skip, value, len); clib_memcpy (((u8 *) e->mask) + skip, mask, len); diff --git a/src/vnet/l2/l2_xcrw.c b/src/vnet/l2/l2_xcrw.c index 334e8641455..b7ccd81806f 100644 --- a/src/vnet/l2/l2_xcrw.c +++ b/src/vnet/l2/l2_xcrw.c @@ -306,7 +306,7 @@ create_xcrw_interface (vlib_main_t * vm) u32 sw_if_index; /* mac address doesn't really matter */ - memset (address, 0, sizeof (address)); + clib_memset (address, 0, sizeof (address)); address[2] = 0x12; /* can returns error iff phy != 0 */ @@ -352,7 +352,7 @@ vnet_configure_l2_xcrw (vlib_main_t * vm, vnet_main_t * vnm, vec_validate (xcm->adj_by_sw_if_index, t->l2_sw_if_index); a = vec_elt_at_index (xcm->adj_by_sw_if_index, t->l2_sw_if_index); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->rewrite_header.sw_if_index = tx_fib_index; @@ -382,7 +382,7 @@ vnet_configure_l2_xcrw (vlib_main_t * vm, vnet_main_t * vnm, a = vec_elt_at_index (xcm->adj_by_sw_if_index, t->l2_sw_if_index); /* Reset adj to drop traffic */ - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); set_int_l2_mode (vm, vnm, MODE_L3, t->l2_sw_if_index, 0, L2_BD_PORT_TYPE_NORMAL, 0, 0); diff --git a/src/vnet/l2tp/l2tp.c b/src/vnet/l2tp/l2tp.c index 300bd53a430..99ae6c4d79e 100644 --- a/src/vnet/l2tp/l2tp.c +++ b/src/vnet/l2tp/l2tp.c @@ -334,7 +334,7 @@ create_l2tpv3_ipv6_tunnel (l2t_main_t * lm, return VNET_API_ERROR_INVALID_VALUE; pool_get (lm->sessions, s); - memset (s, 0, sizeof (*s)); + clib_memset (s, 0, sizeof (*s)); clib_memcpy (&s->our_address, our_address, sizeof (s->our_address)); clib_memcpy (&s->client_address, client_address, sizeof (s->client_address)); diff --git a/src/vnet/l2tp/l2tp_api.c b/src/vnet/l2tp/l2tp_api.c index 0e0e2c2186e..6b48c140c71 100644 --- a/src/vnet/l2tp/l2tp_api.c +++ b/src/vnet/l2tp/l2tp_api.c @@ -65,7 +65,7 @@ send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am, format_vnet_sw_interface_name, lm->vnet_main, si); 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_SW_IF_L2TPV3_TUNNEL_DETAILS); strncpy ((char *) mp->interface_name, (char *) if_name, ARRAY_LEN (mp->interface_name) - 1); diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c index 67b1fc4822a..a432783ddd8 100644 --- a/src/vnet/lisp-cp/control.c +++ b/src/vnet/lisp-cp/control.c @@ -149,7 +149,7 @@ ip_address_to_fib_prefix (const ip_address_t * addr, fib_prefix_t * prefix) { prefix->fp_len = 32; prefix->fp_proto = FIB_PROTOCOL_IP4; - memset (&prefix->fp_addr.pad, 0, sizeof (prefix->fp_addr.pad)); + clib_memset (&prefix->fp_addr.pad, 0, sizeof (prefix->fp_addr.pad)); memcpy (&prefix->fp_addr.ip4, &addr->ip, sizeof (prefix->fp_addr.ip4)); } else @@ -272,7 +272,7 @@ dp_del_fwd_entry (lisp_cp_main_t * lcm, u32 dst_map_index) vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a; fwd_entry_t *fe = 0; uword *feip = 0; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); feip = hash_get (lcm->fwd_entry_by_mapping_index, dst_map_index); if (!feip) @@ -377,7 +377,7 @@ get_locator_pairs (lisp_cp_main_t * lcm, mapping_t * lcl_map, lcl_addr)) continue; - memset (&pair, 0, sizeof (pair)); + clib_memset (&pair, 0, sizeof (pair)); ip_address_copy (&pair.rmt_loc, &gid_address_ip (&rmt->address)); ip_address_copy (&pair.lcl_loc, lcl_addr); @@ -446,7 +446,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index) u8 type, is_src_dst = 0; int rv; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); /* remove entry if it already exists */ feip = hash_get (lcm->fwd_entry_by_mapping_index, dst_map_index); @@ -574,7 +574,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index) if (!rmts_stored_idxp) { pool_get (lcm->lcl_to_rmt_adjacencies, rmts); - memset (rmts, 0, sizeof (*rmts)); + clib_memset (rmts, 0, sizeof (*rmts)); rmts_idx = rmts - lcm->lcl_to_rmt_adjacencies; hash_set (lcm->lcl_to_rmt_adjs_by_lcl_idx, src_map_index, rmts_idx); } @@ -606,7 +606,7 @@ dp_add_fwd_entry_from_mt (u32 si, u32 di) { fwd_entry_mt_arg_t a; - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); a.si = si; a.di = di; @@ -699,7 +699,7 @@ vnet_lisp_add_del_map_server (ip_address_t * addr, u8 is_add) return -1; } - memset (ms, 0, sizeof (*ms)); + clib_memset (ms, 0, sizeof (*ms)); ip_address_copy (&ms->address, addr); vec_add1 (lcm->map_servers, ms[0]); @@ -1213,7 +1213,7 @@ remove_overlapping_sub_prefixes (lisp_cp_main_t * lcm, gid_address_t * eid, gid_address_t *e; remove_mapping_args_t a; - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); /* do this only in src/dst mode ... */ if (MR_MODE_SRC_DST != lcm->map_request_mode) @@ -1234,7 +1234,7 @@ remove_overlapping_sub_prefixes (lisp_cp_main_t * lcm, gid_address_t * eid, { vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args; - memset (adj_args, 0, sizeof (adj_args[0])); + clib_memset (adj_args, 0, sizeof (adj_args[0])); gid_address_copy (&adj_args->reid, e); adj_args->is_add = 0; if (vnet_lisp_add_del_adjacency (adj_args)) @@ -1297,7 +1297,7 @@ vnet_lisp_add_mapping (vnet_lisp_add_del_mapping_args_t * a, if (is_updated) is_updated[0] = 0; - memset (ls_args, 0, sizeof (ls_args[0])); + clib_memset (ls_args, 0, sizeof (ls_args[0])); ls_args->locators = rlocs; mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &a->eid); @@ -1393,8 +1393,8 @@ vnet_lisp_del_mapping (gid_address_t * eid, u32 * res_map_index) mapping_t *old_map; u32 mi; - memset (ls_args, 0, sizeof (ls_args[0])); - memset (m_args, 0, sizeof (m_args[0])); + clib_memset (ls_args, 0, sizeof (ls_args[0])); + clib_memset (m_args, 0, sizeof (m_args[0])); if (res_map_index) res_map_index[0] = ~0; @@ -1604,7 +1604,7 @@ vnet_lisp_nsh_set_locator_set (u8 * locator_set_name, u8 is_add) locator_set_index = p[0]; pool_get (lcm->mapping_pool, m); - memset (m, 0, sizeof *m); + clib_memset (m, 0, sizeof *m); m->locator_set_index = locator_set_index; m->local = 1; m->nsh_set = 1; @@ -1709,12 +1709,12 @@ vnet_lisp_use_petr (ip_address_t * ip, u8 is_add) return VNET_API_ERROR_LISP_DISABLED; } - memset (ls_args, 0, sizeof (*ls_args)); + clib_memset (ls_args, 0, sizeof (*ls_args)); if (is_add) { /* Create dummy petr locator-set */ - memset (&loc, 0, sizeof (loc)); + clib_memset (&loc, 0, sizeof (loc)); gid_address_from_ip (&loc.address, ip); loc.priority = 1; loc.state = loc.weight = 1; @@ -1848,7 +1848,7 @@ update_adjacencies_by_map_index (lisp_cp_main_t * lcm, uword *fei = 0, *rmts_idxp = 0; u32 **rmts = 0, *remote_idxp = 0, *rmts_copy = 0; vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); map = pool_elt_at_index (lcm->mapping_pool, mapping_index); @@ -2089,7 +2089,7 @@ vnet_lisp_add_del_locator_set (vnet_lisp_add_del_locator_set_args_t * a, else { pool_get (lcm->locator_set_pool, ls); - memset (ls, 0, sizeof (*ls)); + clib_memset (ls, 0, sizeof (*ls)); ls_index = ls - lcm->locator_set_pool; if (a->local) @@ -2348,7 +2348,7 @@ vnet_lisp_add_del_map_resolver (vnet_lisp_add_del_map_resolver_args_t * a) return -1; } - memset (mr, 0, sizeof (*mr)); + clib_memset (mr, 0, sizeof (*mr)); ip_address_copy (&mr->address, &a->address); vec_add1 (lcm->map_resolvers, *mr); @@ -2511,7 +2511,7 @@ build_itr_rloc_list (lisp_cp_main_t * lcm, locator_set_t * loc_set) ip_prefix_t *ippref = &gid_address_ippref (gid); ip_address_t *rloc = &ip_prefix_addr (ippref); - memset (gid, 0, sizeof (gid[0])); + clib_memset (gid, 0, sizeof (gid[0])); gid_address_type (gid) = GID_ADDR_IP_PREFIX; for (i = 0; i < vec_len (loc_set->locator_indices); i++) { @@ -2611,7 +2611,7 @@ build_encapsulated_map_request (lisp_cp_main_t * lcm, && GID_ADDR_SRC_DST != gid_address_type (deid)) { gid_address_t sd; - memset (&sd, 0, sizeof (sd)); + clib_memset (&sd, 0, sizeof (sd)); build_src_dst (&sd, seid, deid); lisp_msg_put_mreq (lcm, b, seid, &sd, rlocs, is_smr_invoked, 0 /* rloc probe */ , nonce_res); @@ -3010,7 +3010,7 @@ send_map_register (lisp_cp_main_t * lcm, u8 want_map_notif) map_registers_sent++; pool_get (lcm->pending_map_registers_pool, pmr); - memset (pmr, 0, sizeof (*pmr)); + clib_memset (pmr, 0, sizeof (*pmr)); pmr->time_to_expire = PENDING_MREG_EXPIRATION_TIME; hash_set (lcm->map_register_messages_by_nonce, nonce, pmr - lcm->pending_map_registers_pool); @@ -3178,7 +3178,7 @@ _send_encapsulated_map_request (lisp_cp_main_t * lcm, { /* add map-request to pending requests table */ pool_get (lcm->pending_map_requests_pool, pmr); - memset (pmr, 0, sizeof (*pmr)); + clib_memset (pmr, 0, sizeof (*pmr)); gid_address_copy (&pmr->src, seid); gid_address_copy (&pmr->dst, deid); clib_fifo_add1 (pmr->nonces, nonce); @@ -3274,8 +3274,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b, u32 vni = 0; icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt; - memset (src, 0, sizeof (*src)); - memset (dst, 0, sizeof (*dst)); + clib_memset (src, 0, sizeof (*src)); + clib_memset (dst, 0, sizeof (*dst)); gid_address_type (dst) = GID_ADDR_NO_ADDRESS; gid_address_type (src) = GID_ADDR_NO_ADDRESS; @@ -3314,8 +3314,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b, if (clib_net_to_host_u16 (ah->opcode) != ETHERNET_ARP_OPCODE_request) { - memset (&gid_address_arp_ndp_ip (dst), 0, - sizeof (ip_address_t)); + clib_memset (&gid_address_arp_ndp_ip (dst), 0, + sizeof (ip_address_t)); ip_addr_version (&gid_address_arp_ndp_ip (dst)) = IP4; gid_address_arp_ndp_bd (dst) = ~0; return; @@ -3346,8 +3346,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b, ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address) || (opt->header.n_data_u64s != 1)) { - memset (&gid_address_arp_ndp_ip (dst), 0, - sizeof (ip_address_t)); + clib_memset (&gid_address_arp_ndp_ip (dst), 0, + sizeof (ip_address_t)); ip_addr_version (&gid_address_arp_ndp_ip (dst)) = IP6; gid_address_arp_ndp_bd (dst) = ~0; @@ -3556,7 +3556,7 @@ lisp_cp_lookup_inline (vlib_main_t * vm, lisp_cp_lookup_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - memset (tr, 0, sizeof (*tr)); + clib_memset (tr, 0, sizeof (*tr)); gid_address_copy (&tr->dst_eid, &dst); ip_address_copy (&tr->map_resolver_ip, &lcm->active_map_resolver); @@ -3727,7 +3727,7 @@ remove_expired_mapping (lisp_cp_main_t * lcm, u32 mi) { mapping_t *m; vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args; - memset (adj_args, 0, sizeof (adj_args[0])); + clib_memset (adj_args, 0, sizeof (adj_args[0])); m = pool_elt_at_index (lcm->mapping_pool, mi); @@ -3778,7 +3778,7 @@ process_expired_mapping (lisp_cp_main_t * lcm, u32 mi) fe = pool_elt_at_index (lcm->fwd_entry_pool, fei[0]); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->rmt_eid = fe->reid; if (fe->is_src_dst) a->lcl_eid = fe->leid; @@ -3797,7 +3797,7 @@ process_expired_mapping (lisp_cp_main_t * lcm, u32 mi) { /* mapping is in use, re-fetch */ map_request_args_t mr_args; - memset (&mr_args, 0, sizeof (mr_args)); + clib_memset (&mr_args, 0, sizeof (mr_args)); mr_args.seid = fe->leid; mr_args.deid = fe->reid; @@ -3861,7 +3861,7 @@ process_map_reply (map_records_arg_t * a) vec_foreach (m, a->mappings) { vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args; - memset (m_args, 0, sizeof (m_args[0])); + clib_memset (m_args, 0, sizeof (m_args[0])); gid_address_copy (&m_args->eid, &m->eid); m_args->action = m->action; m_args->authoritative = m->authoritative; @@ -3878,7 +3878,7 @@ process_map_reply (map_records_arg_t * a) { /* try to program forwarding only if mapping saved or updated */ vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args; - memset (adj_args, 0, sizeof (adj_args[0])); + clib_memset (adj_args, 0, sizeof (adj_args[0])); gid_address_copy (&adj_args->leid, &pmr->src); gid_address_copy (&adj_args->reid, &m->eid); @@ -3929,7 +3929,7 @@ is_auth_data_valid (map_notify_hdr_t * h, u32 msg_len, clib_memcpy (auth_data, MNOTIFY_DATA (h), auth_data_len); /* clear auth data */ - memset (MNOTIFY_DATA (h), 0, auth_data_len); + clib_memset (MNOTIFY_DATA (h), 0, auth_data_len); /* get hash of the message */ unsigned char *code = HMAC (get_encrypt_fcn (key_id), key, vec_len (key), @@ -4022,7 +4022,7 @@ parse_map_records (vlib_buffer_t * b, map_records_arg_t * a, u8 count) mapping_t m; locator_t *loc; - memset (&m, 0, sizeof (m)); + clib_memset (&m, 0, sizeof (m)); /* parse record eid */ for (i = 0; i < count; i++) @@ -4077,10 +4077,10 @@ parse_map_notify (vlib_buffer_t * b) map_records_arg_t *a; a = map_record_args_get (); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); mnotif_hdr = vlib_buffer_get_current (b); vlib_buffer_pull (b, sizeof (*mnotif_hdr)); - memset (&deid, 0, sizeof (deid)); + clib_memset (&deid, 0, sizeof (deid)); a->nonce = MNOTIFY_NONCE (mnotif_hdr); key_id = clib_net_to_host_u16 (MNOTIFY_KEY_ID (mnotif_hdr)); @@ -4163,7 +4163,7 @@ send_map_reply (lisp_cp_main_t * lcm, u32 mi, ip_address_t * dst, vec_add1 (records, m[0]); add_locators (lcm, &records[0], m->locator_set_index, probed_loc); - memset (&src, 0, sizeof (src)); + clib_memset (&src, 0, sizeof (src)); if (!ip_fib_get_first_egress_ip_for_dst (lcm, dst, &src)) { @@ -4244,7 +4244,7 @@ process_map_request (vlib_main_t * vm, vlib_node_runtime_t * node, /* parse eid records and send SMR-invoked map-requests */ for (i = 0; i < MREQ_REC_COUNT (mreq_hdr); i++) { - memset (&dst, 0, sizeof (dst)); + clib_memset (&dst, 0, sizeof (dst)); len = lisp_msg_parse_eid_rec (b, &dst); if (len == ~0) { @@ -4266,7 +4266,7 @@ process_map_request (vlib_main_t * vm, vlib_node_runtime_t * node, goto done; } rloc_probe_recv++; - memset (&m, 0, sizeof (m)); + clib_memset (&m, 0, sizeof (m)); u32 mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &dst); // TODO: select best locator; for now use the first one @@ -4302,7 +4302,7 @@ parse_map_reply (vlib_buffer_t * b) map_records_arg_t *a; a = map_record_args_get (); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); locator_t *locators; @@ -4318,7 +4318,7 @@ parse_map_reply (vlib_buffer_t * b) for (i = 0; i < MREP_REC_COUNT (mrep_hdr); i++) { - memset (&m, 0, sizeof (m)); + clib_memset (&m, 0, sizeof (m)); locators = 0; h = vlib_buffer_get_current (b); @@ -4473,8 +4473,9 @@ lisp_cp_init (vlib_main_t * vm) lcm->flags = 0; lcm->pitr_map_index = ~0; lcm->petr_map_index = ~0; - memset (&lcm->active_map_resolver, 0, sizeof (lcm->active_map_resolver)); - memset (&lcm->active_map_server, 0, sizeof (lcm->active_map_server)); + clib_memset (&lcm->active_map_resolver, 0, + sizeof (lcm->active_map_resolver)); + clib_memset (&lcm->active_map_server, 0, sizeof (lcm->active_map_server)); gid_dictionary_init (&lcm->mapping_index_by_gid); lcm->do_map_resolver_election = 1; @@ -4512,8 +4513,8 @@ lisp_stats_api_fill (lisp_cp_main_t * lcm, lisp_gpe_main_t * lgm, const lisp_gpe_tunnel_t *lgt; fwd_entry_t *fe; - memset (stat, 0, sizeof (*stat)); - memset (&fwd_key, 0, sizeof (fwd_key)); + clib_memset (stat, 0, sizeof (*stat)); + clib_memset (&fwd_key, 0, sizeof (fwd_key)); fe = pool_elt_at_index (lcm->fwd_entry_pool, key->fwd_entry_index); ASSERT (fe != 0); diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/vnet/lisp-cp/gid_dictionary.c index 73aecbe3408..2d8fbc80404 100644 --- a/src/vnet/lisp-cp/gid_dictionary.c +++ b/src/vnet/lisp-cp/gid_dictionary.c @@ -305,7 +305,7 @@ ip_sd_lookup (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst, if (!src) { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); return ip4_lookup_exact_match (sfib4, 0, &sp); } else @@ -322,7 +322,7 @@ ip_sd_lookup (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst, if (!src) { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); ip_prefix_version (&sp) = IP6; return ip6_lookup_exact_match (sfib6, 0, &sp); } @@ -557,8 +557,8 @@ ip4_lookup_init (gid_ip4_table_t * db) { uword i; - memset (db->ip4_prefix_len_refcount, 0, - sizeof (db->ip4_prefix_len_refcount)); + clib_memset (db->ip4_prefix_len_refcount, 0, + sizeof (db->ip4_prefix_len_refcount)); for (i = 0; i < ARRAY_LEN (db->ip4_fib_masks); i++) { @@ -606,7 +606,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add); } } @@ -622,7 +622,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); old_val = add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add); } @@ -638,7 +638,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); old_val = add_del_ip4_key (sfib, 0, &sp, 0, is_add); } @@ -755,8 +755,8 @@ ip6_lookup_init (gid_ip6_table_t * db) { uword i; - memset (db->ip6_prefix_len_refcount, 0, - sizeof (db->ip6_prefix_len_refcount)); + clib_memset (db->ip6_prefix_len_refcount, 0, + sizeof (db->ip6_prefix_len_refcount)); for (i = 0; i < ARRAY_LEN (db->ip6_fib_masks); i++) { @@ -809,7 +809,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); ip_prefix_version (&sp) = IP6; add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add); } @@ -826,7 +826,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); ip_prefix_version (&sp) = IP6; old_val = add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add); @@ -843,7 +843,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref, else { ip_prefix_t sp; - memset (&sp, 0, sizeof (sp)); + clib_memset (&sp, 0, sizeof (sp)); ip_prefix_version (&sp) = IP6; old_val = add_del_ip6_key (sfib, 0, &sp, 0, is_add); } diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c index b116ecf4239..5d426b6277c 100644 --- a/src/vnet/lisp-cp/lisp_api.c +++ b/src/vnet/lisp-cp/lisp_api.c @@ -102,7 +102,7 @@ unformat_lisp_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num) { /* remote locators */ r = &rmt_locs[i]; - memset (&loc, 0, sizeof (loc)); + clib_memset (&loc, 0, sizeof (loc)); gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6); loc.priority = r->priority; @@ -126,7 +126,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t * u8 *locator_name = NULL; int i; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0; locator_name = format (0, "%s", mp->locator_set_name); @@ -137,7 +137,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t * a->local = 1; locator_num = clib_net_to_host_u32 (mp->locator_num); - memset (&locator, 0, sizeof (locator)); + clib_memset (&locator, 0, sizeof (locator)); for (i = 0; i < locator_num; i++) { ls_loc = &mp->locators[i]; @@ -175,8 +175,8 @@ vl_api_lisp_add_del_locator_t_handler (vl_api_lisp_add_del_locator_t * mp) u32 ls_index = ~0; u8 *locator_name = NULL; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); locator.sw_if_index = ntohl (mp->sw_if_index); locator.priority = mp->priority; @@ -244,8 +244,8 @@ vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp) u32 locator_set_index = ~0, map_index = ~0; vnet_lisp_add_del_mapping_args_t _a, *a = &_a; u8 *name = NULL, *key = NULL; - memset (a, 0, sizeof (a[0])); - memset (eid, 0, sizeof (eid[0])); + clib_memset (a, 0, sizeof (a[0])); + clib_memset (eid, 0, sizeof (eid[0])); rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->prefix_len); @@ -303,7 +303,7 @@ vl_api_lisp_add_del_map_server_t_handler (vl_api_lisp_add_del_map_server_t int rv = 0; ip_address_t addr; - memset (&addr, 0, sizeof (addr)); + clib_memset (&addr, 0, sizeof (addr)); ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4); rv = vnet_lisp_add_del_map_server (&addr, mp->is_add); @@ -319,7 +319,7 @@ vl_api_lisp_add_del_map_resolver_t_handler (vl_api_lisp_add_del_map_resolver_t int rv = 0; vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); a->is_add = mp->is_add; ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4); @@ -429,7 +429,7 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) u8 status = 0; gid_address_t addr; - memset (&addr, 0, sizeof (addr)); + clib_memset (&addr, 0, sizeof (addr)); status = lcm->flags & LISP_FLAG_USE_PETR; if (status) { @@ -501,7 +501,7 @@ static void gid_address_t _eid, *eid = &_eid; u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num); - memset (eid, 0, sizeof (eid[0])); + clib_memset (eid, 0, sizeof (eid[0])); rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->eid_len); @@ -513,7 +513,7 @@ static void if (!mp->is_add) { vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); gid_address_copy (&a->reid, eid); a->is_add = 0; rv = vnet_lisp_add_del_adjacency (a); @@ -528,7 +528,7 @@ static void if (mp->is_add) { vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args; - memset (m_args, 0, sizeof (m_args[0])); + clib_memset (m_args, 0, sizeof (m_args[0])); gid_address_copy (&m_args->eid, eid); m_args->action = mp->action; m_args->is_static = 1; @@ -557,7 +557,7 @@ vl_api_lisp_add_del_adjacency_t_handler (vl_api_lisp_add_del_adjacency_t * mp) vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; int rv = 0; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->leid, mp->leid_len); @@ -582,7 +582,7 @@ send_lisp_locator_details (lisp_cp_main_t * lcm, vl_api_lisp_locator_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 = ntohs (VL_API_LISP_LOCATOR_DETAILS); rmp->context = context; @@ -655,7 +655,7 @@ send_lisp_locator_set_details (lisp_cp_main_t * lcm, u8 *str = 0; 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_LISP_LOCATOR_SET_DETAILS); rmp->context = context; @@ -795,7 +795,7 @@ send_lisp_eid_table_details (mapping_t * mapit, mac = gid_address_mac (gid); 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_LISP_EID_TABLE_DETAILS); ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index); @@ -864,7 +864,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) if (mp->eid_set) { - memset (eid, 0, sizeof (*eid)); + clib_memset (eid, 0, sizeof (*eid)); unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->prefix_length); @@ -896,7 +896,7 @@ send_lisp_map_server_details (ip_address_t * ip, vl_api_registration_t * reg, vl_api_lisp_map_server_details_t *rmp = NULL; 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_LISP_MAP_SERVER_DETAILS); switch (ip_addr_version (ip)) @@ -945,7 +945,7 @@ send_lisp_map_resolver_details (ip_address_t * ip, vl_api_lisp_map_resolver_details_t *rmp = NULL; 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_LISP_MAP_RESOLVER_DETAILS); switch (ip_addr_version (ip)) @@ -994,7 +994,7 @@ send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg, vl_api_lisp_eid_table_map_details_t *rmp = NULL; 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_LISP_EID_TABLE_MAP_DETAILS); rmp->vni = clib_host_to_net_u32 (p->key); @@ -1039,7 +1039,7 @@ send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context) vl_api_lisp_eid_table_vni_details_t *rmp = 0; 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_LISP_EID_TABLE_VNI_DETAILS); rmp->context = context; rmp->vni = clib_host_to_net_u32 (vni); @@ -1056,7 +1056,7 @@ lisp_adjacency_copy (vl_api_lisp_adjacency_t * dst, lisp_adjacency_t * adjs) for (i = 0; i < n; i++) { adj = vec_elt_at_index (adjs, i); - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); switch (gid_address_type (&adj->reid)) { diff --git a/src/vnet/lisp-cp/lisp_cli.c b/src/vnet/lisp-cp/lisp_cli.c index a044d23ed53..690850c7ac2 100644 --- a/src/vnet/lisp-cp/lisp_cli.c +++ b/src/vnet/lisp-cp/lisp_cli.c @@ -148,8 +148,8 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 *key = 0; u32 key_id = 0; - memset (&eid, 0, sizeof (eid)); - memset (a, 0, sizeof (*a)); + clib_memset (&eid, 0, sizeof (eid)); + clib_memset (a, 0, sizeof (*a)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -308,8 +308,8 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&eid, 0, sizeof (eid)); - memset (&rloc, 0, sizeof (rloc)); + clib_memset (&eid, 0, sizeof (eid)); + clib_memset (&rloc, 0, sizeof (rloc)); while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { @@ -384,7 +384,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (!is_add) { vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); gid_address_copy (&a->reid, &eid); if (vnet_lisp_add_del_adjacency (a)) { @@ -398,7 +398,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (is_add) { vnet_lisp_add_del_mapping_args_t _map_args, *map_args = &_map_args; - memset (map_args, 0, sizeof (map_args[0])); + clib_memset (map_args, 0, sizeof (map_args[0])); gid_address_copy (&map_args->eid, &eid); map_args->action = action; map_args->is_static = 1; @@ -449,8 +449,8 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&reid, 0, sizeof (reid)); - memset (&leid, 0, sizeof (leid)); + clib_memset (&reid, 0, sizeof (reid)); + clib_memset (&leid, 0, sizeof (leid)); leid_ippref = &gid_address_ippref (&leid); reid_ippref = &gid_address_ippref (&reid); @@ -510,7 +510,7 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input, goto done; } - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); gid_address_copy (&a->leid, &leid); gid_address_copy (&a->reid, &reid); a->is_add = is_add; @@ -811,7 +811,7 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm, u8 filter = 0; clib_error_t *error = NULL; - memset (&eid, 0, sizeof (eid)); + clib_memset (&eid, 0, sizeof (eid)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -1158,8 +1158,8 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm, u32 ls_index = 0; int rv = 0; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -1232,8 +1232,8 @@ lisp_add_del_locator_in_set_command_fn (vlib_main_t * vm, vnet_lisp_add_del_locator_set_args_t _a, *a = &_a; u32 ls_index = 0; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) diff --git a/src/vnet/lisp-cp/lisp_msg_serdes.c b/src/vnet/lisp-cp/lisp_msg_serdes.c index 25188b46189..f45f08fad6c 100644 --- a/src/vnet/lisp-cp/lisp_msg_serdes.c +++ b/src/vnet/lisp-cp/lisp_msg_serdes.c @@ -27,7 +27,7 @@ lisp_msg_put_locators (vlib_buffer_t * b, locator_t * locators) vec_foreach (loc, locators) { u8 *p = vlib_buffer_put_uninit (b, sizeof (locator_hdr_t)); - memset (p, 0, sizeof (locator_hdr_t)); + clib_memset (p, 0, sizeof (locator_hdr_t)); LOC_PRIORITY (p) = loc->priority; LOC_MPRIORITY (p) = loc->mpriority; LOC_WEIGHT (p) = loc->weight; @@ -45,7 +45,7 @@ lisp_msg_put_mapping_record (vlib_buffer_t * b, mapping_t * record) vlib_buffer_put_uninit (b, sizeof (mapping_record_hdr_t)); gid_address_t *eid = &record->eid; - memset (p, 0, sizeof (*p)); + clib_memset (p, 0, sizeof (*p)); MAP_REC_EID_PLEN (p) = gid_address_len (eid); MAP_REC_TTL (p) = clib_host_to_net_u32 (MAP_REGISTER_DEFAULT_TTL); MAP_REC_AUTH (p) = record->authoritative ? 1 : 0; @@ -104,7 +104,7 @@ lisp_msg_put_eid_rec (vlib_buffer_t * b, gid_address_t * eid) { eid_record_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (*h)); - memset (h, 0, sizeof (*h)); + clib_memset (h, 0, sizeof (*h)); EID_REC_MLEN (h) = gid_address_len (eid); lisp_msg_put_gid (b, eid); return h; @@ -139,7 +139,7 @@ lisp_msg_put_map_reply (vlib_buffer_t * b, mapping_t * records, u64 nonce, { map_reply_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0])); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); MREP_TYPE (h) = LISP_MAP_REPLY; MREP_NONCE (h) = nonce; MREP_REC_COUNT (h) = 1; @@ -159,14 +159,14 @@ lisp_msg_put_map_register (vlib_buffer_t * b, mapping_t * records, /* Basic header init */ map_register_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0])); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); MREG_TYPE (h) = LISP_MAP_REGISTER; MREG_NONCE (h) = nonce_build (0); MREG_WANT_MAP_NOTIFY (h) = want_map_notify ? 1 : 0; MREG_REC_COUNT (h) = vec_len (records); auth_data = vlib_buffer_put_uninit (b, auth_data_len); - memset (auth_data, 0, auth_data_len); + clib_memset (auth_data, 0, auth_data_len); /* Put map register records */ lisp_msg_put_mreg_records (b, records); @@ -187,7 +187,7 @@ lisp_msg_put_mreq (lisp_cp_main_t * lcm, vlib_buffer_t * b, /* Basic header init */ map_request_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0])); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); MREQ_TYPE (h) = LISP_MAP_REQUEST; MREQ_NONCE (h) = nonce_build (0); MREQ_SMR_INVOKED (h) = is_smr_invoked ? 1 : 0; @@ -219,8 +219,8 @@ lisp_msg_push_ecm (vlib_main_t * vm, vlib_buffer_t * b, int lp, int rp, if (gid_address_type (la) != GID_ADDR_IP_PREFIX) { /* empty ip4 */ - memset (src_ip, 0, sizeof (src_ip[0])); - memset (dst_ip, 0, sizeof (dst_ip[0])); + clib_memset (src_ip, 0, sizeof (src_ip[0])); + clib_memset (dst_ip, 0, sizeof (dst_ip[0])); } else { @@ -261,7 +261,7 @@ u32 lisp_msg_parse_addr (vlib_buffer_t * b, gid_address_t * eid) { u32 len; - memset (eid, 0, sizeof (*eid)); + clib_memset (eid, 0, sizeof (*eid)); len = gid_address_parse (vlib_buffer_get_current (b), eid); if (len != ~0) vlib_buffer_pull (b, len); @@ -273,7 +273,7 @@ lisp_msg_parse_eid_rec (vlib_buffer_t * b, gid_address_t * eid) { eid_record_hdr_t *h = vlib_buffer_get_current (b); u32 len; - memset (eid, 0, sizeof (*eid)); + clib_memset (eid, 0, sizeof (*eid)); len = gid_address_parse (EID_REC_ADDR (h), eid); if (len == ~0) return len; @@ -333,7 +333,7 @@ lisp_msg_parse_mapping_record (vlib_buffer_t * b, gid_address_t * eid, vlib_buffer_pull (b, sizeof (mapping_record_hdr_t)); - memset (eid, 0, sizeof (*eid)); + clib_memset (eid, 0, sizeof (*eid)); len = gid_address_parse (vlib_buffer_get_current (b), eid); if (len == ~0) return len; diff --git a/src/vnet/lisp-cp/lisp_types.c b/src/vnet/lisp-cp/lisp_types.c index fb3fa6cc33e..a706832a249 100644 --- a/src/vnet/lisp-cp/lisp_types.c +++ b/src/vnet/lisp-cp/lisp_types.c @@ -165,7 +165,7 @@ unformat_ip_address (unformat_input_t * input, va_list * args) { ip_address_t *a = va_arg (*args, ip_address_t *); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (a))) ip_addr_version (a) = IP4; else if (unformat_user (input, unformat_ip6_address, &ip_addr_v6 (a))) @@ -339,9 +339,9 @@ unformat_gid_address (unformat_input_t * input, va_list * args) fid_address_t sim1, sim2; nsh_t nsh; - memset (&ippref, 0, sizeof (ippref)); - memset (&sim1, 0, sizeof (sim1)); - memset (&sim2, 0, sizeof (sim2)); + clib_memset (&ippref, 0, sizeof (ippref)); + clib_memset (&sim1, 0, sizeof (sim1)); + clib_memset (&sim2, 0, sizeof (sim2)); if (unformat (input, "%U|%U", unformat_fid_address, &sim1, unformat_fid_address, &sim2)) @@ -844,7 +844,7 @@ gid_address_free (gid_address_t * a) void gid_address_from_ip (gid_address_t * g, ip_address_t * ip) { - memset (g, 0, sizeof (g[0])); + clib_memset (g, 0, sizeof (g[0])); ip_address_set (&gid_address_ip (g), ip, ip_addr_version (ip)); gid_address_ippref_len (g) = 32; } @@ -872,7 +872,7 @@ ip_address_copy (ip_address_t * dst, const ip_address_t * src) if (IP4 == ip_addr_version (src)) { /* don't copy any garbage from the union */ - memset (dst, 0, sizeof (*dst)); + clib_memset (dst, 0, sizeof (*dst)); dst->ip.v4 = src->ip.v4; dst->version = IP4; } @@ -941,7 +941,7 @@ ip_prefix_normalize_ip6 (ip6_address_t * ip6, u8 preflen) ASSERT (ip6); - memset (mask_6, 0, sizeof (mask_6)); + clib_memset (mask_6, 0, sizeof (mask_6)); if (128 <= preflen) { @@ -1178,7 +1178,7 @@ lcaf_write (u8 * p, void *a) *(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF); size += sizeof (u16); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); LCAF_TYPE (h) = type; u16 lcaf_len = (*lcaf_body_length_fcts[type]) (lcaf); LCAF_LENGTH (h) = clib_host_to_net_u16 (lcaf_len); @@ -1243,7 +1243,7 @@ sd_write (u8 * p, void *a) *(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF); size += sizeof (u16); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); LCAF_TYPE (h) = LCAF_SOURCE_DEST; u16 lcaf_len = sizeof (lcaf_src_dst_hdr_t) + fid_addr_size_to_write (&sd_src (sd)) @@ -1253,7 +1253,7 @@ sd_write (u8 * p, void *a) clib_memcpy (p + size, h, sizeof (h[0])); size += sizeof (h[0]); - memset (&sd_hdr, 0, sizeof (sd_hdr)); + clib_memset (&sd_hdr, 0, sizeof (sd_hdr)); LCAF_SD_SRC_ML (&sd_hdr) = fid_address_length (&sd_src (sd)); LCAF_SD_DST_ML (&sd_hdr) = fid_address_length (&sd_dst (sd)); clib_memcpy (p + size, &sd_hdr, sizeof (sd_hdr)); @@ -1282,8 +1282,8 @@ nsh_write (u8 * p, void *a) ASSERT (gid_address_type (g) == GID_ADDR_NSH); - memset (&lcaf, 0, sizeof (lcaf)); - memset (&spi, 0, sizeof (spi)); + clib_memset (&lcaf, 0, sizeof (lcaf)); + clib_memset (&spi, 0, sizeof (spi)); LCAF_TYPE (&lcaf) = LCAF_NSH; LCAF_LENGTH (&lcaf) = clib_host_to_net_u16 (sizeof (lcaf_spi_hdr_t)); @@ -1314,7 +1314,7 @@ vni_write (u8 * p, void *a) /* put lcaf header */ *(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF); size += sizeof (u16); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); LCAF_TYPE (h) = LCAF_INSTANCE_ID; u16 lcaf_len = sizeof (u32) /* Instance ID size */ + gid_address_size_to_put_no_vni (g); @@ -1726,7 +1726,7 @@ locator_free (locator_t * l) void build_src_dst (gid_address_t * sd, gid_address_t * src, gid_address_t * dst) { - memset (sd, 0, sizeof (*sd)); + clib_memset (sd, 0, sizeof (*sd)); gid_address_type (sd) = GID_ADDR_SRC_DST; gid_address_vni (sd) = gid_address_vni (dst); gid_address_vni_mask (sd) = gid_address_vni_mask (dst); diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c index 85c5d7e1945..fa67536c32d 100644 --- a/src/vnet/lisp-cp/one_api.c +++ b/src/vnet/lisp-cp/one_api.c @@ -154,7 +154,7 @@ unformat_one_locs (vl_api_one_remote_locator_t * rmt_locs, u32 rloc_num) { /* remote locators */ r = &rmt_locs[i]; - memset (&loc, 0, sizeof (loc)); + clib_memset (&loc, 0, sizeof (loc)); gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6); loc.priority = r->priority; @@ -207,7 +207,7 @@ vl_api_one_add_del_locator_set_t_handler (vl_api_one_add_del_locator_set_t * u8 *locator_name = NULL; int i; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0; locator_name = format (0, "%s", mp->locator_set_name); @@ -218,7 +218,7 @@ vl_api_one_add_del_locator_set_t_handler (vl_api_one_add_del_locator_set_t * a->local = 1; locator_num = clib_net_to_host_u32 (mp->locator_num); - memset (&locator, 0, sizeof (locator)); + clib_memset (&locator, 0, sizeof (locator)); for (i = 0; i < locator_num; i++) { ls_loc = &mp->locators[i]; @@ -256,8 +256,8 @@ vl_api_one_add_del_locator_t_handler (vl_api_one_add_del_locator_t * mp) u32 ls_index = ~0; u8 *locator_name = NULL; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); locator.sw_if_index = ntohl (mp->sw_if_index); locator.priority = mp->priority; @@ -339,8 +339,8 @@ vl_api_one_add_del_local_eid_t_handler (vl_api_one_add_del_local_eid_t * mp) u32 locator_set_index = ~0, map_index = ~0; vnet_lisp_add_del_mapping_args_t _a, *a = &_a; u8 *name = NULL, *key = NULL; - memset (a, 0, sizeof (a[0])); - memset (eid, 0, sizeof (eid[0])); + clib_memset (a, 0, sizeof (a[0])); + clib_memset (eid, 0, sizeof (eid[0])); rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->prefix_len); @@ -403,7 +403,7 @@ vl_api_one_add_del_map_server_t_handler (vl_api_one_add_del_map_server_t * mp) int rv = 0; ip_address_t addr; - memset (&addr, 0, sizeof (addr)); + clib_memset (&addr, 0, sizeof (addr)); ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4); rv = vnet_lisp_add_del_map_server (&addr, mp->is_add); @@ -419,7 +419,7 @@ vl_api_one_add_del_map_resolver_t_handler (vl_api_one_add_del_map_resolver_t int rv = 0; vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); a->is_add = mp->is_add; ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4); @@ -546,7 +546,7 @@ vl_api_show_one_use_petr_t_handler (vl_api_show_one_use_petr_t * mp) u8 status = 0; gid_address_t addr; - memset (&addr, 0, sizeof (addr)); + clib_memset (&addr, 0, sizeof (addr)); status = lcm->flags & LISP_FLAG_USE_PETR; if (status) { @@ -618,7 +618,7 @@ static void gid_address_t _eid, *eid = &_eid; u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num); - memset (eid, 0, sizeof (eid[0])); + clib_memset (eid, 0, sizeof (eid[0])); rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->eid_len); @@ -630,7 +630,7 @@ static void if (!mp->is_add) { vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); gid_address_copy (&a->reid, eid); a->is_add = 0; rv = vnet_lisp_add_del_adjacency (a); @@ -645,7 +645,7 @@ static void if (mp->is_add) { vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args; - memset (m_args, 0, sizeof (m_args[0])); + clib_memset (m_args, 0, sizeof (m_args[0])); gid_address_copy (&m_args->eid, eid); m_args->action = mp->action; m_args->is_static = 1; @@ -672,7 +672,7 @@ vl_api_one_add_del_adjacency_t_handler (vl_api_one_add_del_adjacency_t * mp) vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; int rv = 0; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->leid, mp->leid_len); @@ -697,7 +697,7 @@ send_one_locator_details (lisp_cp_main_t * lcm, vl_api_one_locator_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 = ntohs (VL_API_ONE_LOCATOR_DETAILS); rmp->context = context; @@ -770,7 +770,7 @@ send_one_locator_set_details (lisp_cp_main_t * lcm, u8 *str = 0; 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_ONE_LOCATOR_SET_DETAILS); rmp->context = context; @@ -909,7 +909,7 @@ send_one_eid_table_details (mapping_t * mapit, mac = gid_address_mac (gid); 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_ONE_EID_TABLE_DETAILS); ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index); @@ -985,7 +985,7 @@ vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp) if (mp->eid_set) { - memset (eid, 0, sizeof (*eid)); + clib_memset (eid, 0, sizeof (*eid)); unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni), mp->eid_type, mp->eid, mp->prefix_length); @@ -1017,7 +1017,7 @@ send_one_map_server_details (ip_address_t * ip, vl_api_registration_t * reg, vl_api_one_map_server_details_t *rmp = NULL; 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_ONE_MAP_SERVER_DETAILS); switch (ip_addr_version (ip)) @@ -1066,7 +1066,7 @@ send_one_map_resolver_details (ip_address_t * ip, vl_api_one_map_resolver_details_t *rmp = NULL; 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_ONE_MAP_RESOLVER_DETAILS); switch (ip_addr_version (ip)) @@ -1115,7 +1115,7 @@ send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg, vl_api_one_eid_table_map_details_t *rmp = NULL; 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_ONE_EID_TABLE_MAP_DETAILS); rmp->vni = clib_host_to_net_u32 (p->key); @@ -1159,7 +1159,7 @@ send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context) vl_api_one_eid_table_vni_details_t *rmp = 0; 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_ONE_EID_TABLE_VNI_DETAILS); rmp->context = context; rmp->vni = clib_host_to_net_u32 (vni); @@ -1177,7 +1177,7 @@ one_adjacency_copy (vl_api_one_adjacency_t * dst, lisp_adjacency_t * adjs) for (i = 0; i < n; i++) { adj = vec_elt_at_index (adjs, i); - memset (&a, 0, sizeof (a)); + clib_memset (&a, 0, sizeof (a)); switch (gid_address_type (&adj->reid)) { @@ -1536,7 +1536,7 @@ static void vl_api_one_add_del_l2_arp_entry_reply_t *rmp; int rv = 0; gid_address_t _arp, *arp = &_arp; - memset (arp, 0, sizeof (*arp)); + clib_memset (arp, 0, sizeof (*arp)); gid_address_type (arp) = GID_ADDR_ARP; gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd); @@ -1555,7 +1555,7 @@ vl_api_one_add_del_ndp_entry_t_handler (vl_api_one_add_del_ndp_entry_t * mp) vl_api_one_add_del_ndp_entry_reply_t *rmp; int rv = 0; gid_address_t _g, *g = &_g; - memset (g, 0, sizeof (*g)); + clib_memset (g, 0, sizeof (*g)); gid_address_type (g) = GID_ADDR_NDP; gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd); diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c index a11138f822a..7823ea14cd9 100644 --- a/src/vnet/lisp-cp/one_cli.c +++ b/src/vnet/lisp-cp/one_cli.c @@ -144,8 +144,8 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 *key = 0; u32 key_id = 0; - memset (&eid, 0, sizeof (eid)); - memset (a, 0, sizeof (*a)); + clib_memset (&eid, 0, sizeof (eid)); + clib_memset (a, 0, sizeof (*a)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -290,9 +290,9 @@ lisp_add_del_ndp_entry_command_fn (vlib_main_t * vm, u32 hw_addr_set = 0, ip_set = 0, is_add = 1; gid_address_t _g, *g = &_g; - memset (&ip6, 0, sizeof (ip6)); - memset (hw_addr, 0, sizeof (hw_addr)); - memset (g, 0, sizeof (*g)); + clib_memset (&ip6, 0, sizeof (ip6)); + clib_memset (hw_addr, 0, sizeof (hw_addr)); + clib_memset (g, 0, sizeof (*g)); if (!unformat_user (input, unformat_line_input, line_input)) return 0; @@ -354,9 +354,9 @@ lisp_add_del_l2_arp_entry_command_fn (vlib_main_t * vm, u32 hw_addr_set = 0, ip_set = 0, is_add = 1; gid_address_t _arp, *arp = &_arp; - memset (&ip4, 0, sizeof (ip4)); - memset (hw_addr, 0, sizeof (hw_addr)); - memset (arp, 0, sizeof (*arp)); + clib_memset (&ip4, 0, sizeof (ip4)); + clib_memset (hw_addr, 0, sizeof (hw_addr)); + clib_memset (arp, 0, sizeof (*arp)); if (!unformat_user (input, unformat_line_input, line_input)) return 0; @@ -503,8 +503,8 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&eid, 0, sizeof (eid)); - memset (&rloc, 0, sizeof (rloc)); + clib_memset (&eid, 0, sizeof (eid)); + clib_memset (&rloc, 0, sizeof (rloc)); while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { @@ -577,7 +577,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (!is_add) { vnet_lisp_add_del_adjacency_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); gid_address_copy (&a->reid, &eid); if (vnet_lisp_add_del_adjacency (a)) { @@ -591,7 +591,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, if (is_add) { vnet_lisp_add_del_mapping_args_t _map_args, *map_args = &_map_args; - memset (map_args, 0, sizeof (map_args[0])); + clib_memset (map_args, 0, sizeof (map_args[0])); gid_address_copy (&map_args->eid, &eid); map_args->action = action; map_args->is_static = 1; @@ -645,8 +645,8 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&reid, 0, sizeof (reid)); - memset (&leid, 0, sizeof (leid)); + clib_memset (&reid, 0, sizeof (reid)); + clib_memset (&leid, 0, sizeof (leid)); leid_ippref = &gid_address_ippref (&leid); reid_ippref = &gid_address_ippref (&reid); @@ -706,7 +706,7 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input, goto done; } - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); gid_address_copy (&a->leid, &leid); gid_address_copy (&a->reid, &reid); a->is_add = is_add; @@ -1127,7 +1127,7 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm, u8 filter = 0; clib_error_t *error = NULL; - memset (&eid, 0, sizeof (eid)); + clib_memset (&eid, 0, sizeof (eid)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -1700,8 +1700,8 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm, u32 ls_index = 0; int rv = 0; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -1774,8 +1774,8 @@ lisp_add_del_locator_in_set_command_fn (vlib_main_t * vm, vnet_lisp_add_del_locator_set_args_t _a, *a = &_a; u32 ls_index = 0; - memset (&locator, 0, sizeof (locator)); - memset (a, 0, sizeof (a[0])); + clib_memset (&locator, 0, sizeof (locator)); + clib_memset (a, 0, sizeof (a[0])); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) diff --git a/src/vnet/lisp-cp/packets.c b/src/vnet/lisp-cp/packets.c index 25086b8e7d9..5cb2cfa12c3 100644 --- a/src/vnet/lisp-cp/packets.c +++ b/src/vnet/lisp-cp/packets.c @@ -85,7 +85,7 @@ udp_ip6_checksum (ip6_header_t * ip6, udp_header_t * up, u32 len) } phu; /* pseudo-header */ - memset (&phu, 0, sizeof (phu)); + clib_memset (&phu, 0, sizeof (phu)); phu.ph.ph_src = ip6->src_address; phu.ph.ph_dst = ip6->dst_address; phu.ph.ph_len = clib_host_to_net_u32 (len); @@ -208,9 +208,9 @@ pkt_push_ecm_hdr (vlib_buffer_t * b) ecm_hdr_t *h; h = vlib_buffer_push_uninit (b, sizeof (h[0])); - memset (h, 0, sizeof (h[0])); + clib_memset (h, 0, sizeof (h[0])); h->type = LISP_ENCAP_CONTROL_TYPE; - memset (h->reserved2, 0, sizeof (h->reserved2)); + clib_memset (h->reserved2, 0, sizeof (h->reserved2)); return h; } diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c index 66304ae344a..367dbae4159 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.c +++ b/src/vnet/lisp-gpe/lisp_gpe.c @@ -47,8 +47,8 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm, locator_pair_t pair, *pairs = 0; int rv; - memset (leid, 0, sizeof (*leid)); - memset (reid, 0, sizeof (*reid)); + clib_memset (leid, 0, sizeof (*leid)); + clib_memset (reid, 0, sizeof (*reid)); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -145,7 +145,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm, /* add fwd entry */ vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); a->is_add = is_add; a->is_negative = is_negative; @@ -503,7 +503,7 @@ gpe_native_forward_command_fn (vlib_main_t * vm, unformat_input_t * input, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&rpath, 0, sizeof (rpath)); + clib_memset (&rpath, 0, sizeof (rpath)); while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { @@ -621,7 +621,7 @@ lisp_gpe_init (vlib_main_t * vm) lgm->lisp_stats_index_by_key = hash_create_mem (0, sizeof (lisp_stats_key_t), sizeof (uword)); - memset (&lgm->counters, 0, sizeof (lgm->counters)); + clib_memset (&lgm->counters, 0, sizeof (lgm->counters)); lgm->counters.name = "LISP counters"; return 0; @@ -646,7 +646,7 @@ lisp_gpe_test_send_nsh_packet (u8 * file_name) if (!file_name) return clib_error_create ("no pcap file specified!"); - memset (&pm, 0, sizeof (pm)); + clib_memset (&pm, 0, sizeof (pm)); pm.file_name = (char *) file_name; error = pcap_read (&pm); if (error) diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c index 7464af3d441..6f85dc4a761 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c +++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c @@ -115,7 +115,7 @@ ip46_address_to_ip_address (const ip46_address_t * a, ip_address_t * b) { if (ip46_address_is_ip4 (a)) { - memset (b, 0, sizeof (*b)); + clib_memset (b, 0, sizeof (*b)); ip_address_set (b, &a->ip4, IP4); } else @@ -293,7 +293,7 @@ lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm, ip_adjacency_t * adj, return; lisp_stats_key_t key; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.fwd_entry_index = feip[0]; key.tunnel_index = ladj->tunnel_index; @@ -395,7 +395,7 @@ lisp_gpe_adjacency_find_or_create_and_lock (const locator_pair_t * pair, { pool_get (lisp_adj_pool, ladj); - memset (ladj, 0, sizeof (*ladj)); + clib_memset (ladj, 0, sizeof (*ladj)); lai = (ladj - lisp_adj_pool); ip_address_copy (&ladj->remote_rloc, &pair->rmt_loc); diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c index 97409f597ca..86328fc2cf8 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_api.c +++ b/src/vnet/lisp-gpe/lisp_gpe_api.c @@ -74,7 +74,7 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num) { /* local locator */ r = &((vl_api_gpe_locator_t *) locs)[i]; - memset (&pair, 0, sizeof (pair)); + clib_memset (&pair, 0, sizeof (pair)); ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6); pair.weight = r->weight; @@ -174,7 +174,7 @@ static void vec_foreach (path, lfe->paths) { rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); + clib_memset (rmp, 0, sizeof (*rmp)); const lisp_gpe_tunnel_t *lgt; rmp->_vl_msg_id = @@ -200,7 +200,7 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst, vec_foreach (e, src) { - memset (&dst[i], 0, sizeof (*dst)); + clib_memset (&dst[i], 0, sizeof (*dst)); dst[i].dp_table = e->dp_table; dst[i].fwd_entry_index = e->fwd_entry_index; dst[i].vni = e->vni; @@ -332,7 +332,7 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp) int rv = 0; gpe_add_del_fwd_entry_t_net_to_host (mp); - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type, mp->rmt_eid, mp->rmt_len); @@ -447,7 +447,7 @@ static void vnet_gpe_native_fwd_rpath_args_t _a, *a = &_a; int rv = 0; - memset (a, 0, sizeof (a[0])); + clib_memset (a, 0, sizeof (a[0])); if (mp->is_ip4) clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr, sizeof (ip4_address_t)); @@ -483,7 +483,7 @@ gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst, vec_foreach (e, src) { - memset (&dst[i], 0, sizeof (*dst)); + clib_memset (&dst[i], 0, sizeof (*dst)); table = fib_table_get (e->frp_fib_index, dpo_proto_to_fib (e->frp_proto)); dst[i].fib_index = table->ft_table_id; dst[i].nh_sw_if_index = e->frp_sw_if_index; diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c index f810ae5fec4..2d6cd013941 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c +++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c @@ -409,7 +409,7 @@ find_fwd_entry (lisp_gpe_main_t * lgm, { uword *p; - memset (key, 0, sizeof (*key)); + clib_memset (key, 0, sizeof (*key)); if (GID_ADDR_IP_PREFIX == gid_address_type (&a->rmt_eid)) { @@ -486,7 +486,7 @@ vnet_lisp_gpe_add_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a, if (LISP_GPE_FWD_ENTRY_TYPE_NORMAL != lfe->type) return; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.fwd_entry_index = fwd_entry_index; vec_foreach (path, lfe->paths) @@ -531,7 +531,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm, return VNET_API_ERROR_INVALID_VALUE; pool_get (lgm->lisp_fwd_entry_pool, lfe); - memset (lfe, 0, sizeof (*lfe)); + clib_memset (lfe, 0, sizeof (*lfe)); lfe->key = clib_mem_alloc (sizeof (key)); memcpy (lfe->key, &key, sizeof (key)); @@ -848,7 +848,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm, return VNET_API_ERROR_INVALID_VALUE; pool_get (lgm->lisp_fwd_entry_pool, lfe); - memset (lfe, 0, sizeof (*lfe)); + clib_memset (lfe, 0, sizeof (*lfe)); lfe->key = clib_mem_alloc (sizeof (key)); memcpy (lfe->key, &key, sizeof (key)); @@ -916,7 +916,7 @@ lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm, u32 spi_si_net_order) int rv; BVT (clib_bihash_kv) kv, value; - memset (&kv, 0, sizeof (kv)); + clib_memset (&kv, 0, sizeof (kv)); kv.key[0] = spi_si_net_order; rv = BV (clib_bihash_search_inline_2) (&lgm->nsh_fib, &kv, &value); @@ -951,7 +951,7 @@ lisp_nsh_fib_add_del_entry (u32 spi_si_host_order, u32 lfei, u8 is_add) BVT (clib_bihash_kv) kv, value; u32 old_val = ~0; - memset (&kv, 0, sizeof (kv)); + clib_memset (&kv, 0, sizeof (kv)); kv.key[0] = clib_host_to_net_u32 (spi_si_host_order); kv.value = 0ULL; @@ -1123,7 +1123,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm, return VNET_API_ERROR_INVALID_VALUE; pool_get (lgm->lisp_fwd_entry_pool, lfe); - memset (lfe, 0, sizeof (*lfe)); + clib_memset (lfe, 0, sizeof (*lfe)); lfe->key = clib_mem_alloc (sizeof (key)); memcpy (lfe->key, &key, sizeof (key)); @@ -1307,7 +1307,7 @@ lisp_del_adj_stats (lisp_gpe_main_t * lgm, u32 fwd_entry_index, u32 ti) uword *p; u8 *s; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); key.fwd_entry_index = fwd_entry_index; key.tunnel_index = ti; @@ -1543,7 +1543,7 @@ vnet_lisp_gpe_fwd_entries_get_by_vni (u32 vni) ({ if (lfe->key->vni == vni) { - memset (&e, 0, sizeof (e)); + clib_memset (&e, 0, sizeof (e)); e.dp_table = lfe->eid_table_id; e.vni = lfe->key->vni; if (lfe->type == LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE) diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c index 3f56dbea08d..1ccd5817d7f 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c +++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c @@ -51,7 +51,7 @@ lisp_gpe_sub_interface_db_find (const ip_address_t * lrloc, u32 vni) lisp_gpe_sub_interface_key_t key; - memset (&key, 0, sizeof (key)); + clib_memset (&key, 0, sizeof (key)); ip_address_copy (&key.local_rloc, lrloc); key.vni = vni; p = hash_get_mem (lisp_gpe_sub_interfaces, &key); @@ -151,9 +151,9 @@ lisp_gpe_sub_interface_find_or_create_and_lock (const ip_address_t * lrloc, return (INDEX_INVALID); pool_get (lisp_gpe_sub_interface_pool, l3s); - memset (l3s, 0, sizeof (*l3s)); + clib_memset (l3s, 0, sizeof (*l3s)); l3s->key = clib_mem_alloc (sizeof (*l3s->key)); - memset (l3s->key, 0, sizeof (*l3s->key)); + clib_memset (l3s->key, 0, sizeof (*l3s->key)); ip_address_copy (&l3s->key->local_rloc, lrloc); l3s->key->vni = vni; diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.c b/src/vnet/lisp-gpe/lisp_gpe_tenant.c index 814b0d316cb..8da1fd40b9d 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_tenant.c +++ b/src/vnet/lisp-gpe/lisp_gpe_tenant.c @@ -48,7 +48,7 @@ lisp_gpe_tenant_find_or_create_i (u32 vni) if (NULL == lt) { pool_get (lisp_gpe_tenant_pool, lt); - memset (lt, 0, sizeof (*lt)); + clib_memset (lt, 0, sizeof (*lt)); lt->lt_vni = vni; lt->lt_table_id = ~0; diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c index dd6c6fddfd9..e4ad872790c 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c +++ b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c @@ -161,10 +161,10 @@ lisp_gpe_tunnel_find_or_create_and_lock (const locator_pair_t * pair, if (NULL == lgt) { pool_get (lisp_gpe_tunnel_pool, lgt); - memset (lgt, 0, sizeof (*lgt)); + clib_memset (lgt, 0, sizeof (*lgt)); lgt->key = clib_mem_alloc (sizeof (*lgt->key)); - memset (lgt->key, 0, sizeof (*lgt->key)); + clib_memset (lgt->key, 0, sizeof (*lgt->key)); lgt->key->rmt = pair->rmt_loc; lgt->key->lcl = pair->lcl_loc; diff --git a/src/vnet/llc/llc.c b/src/vnet/llc/llc.c index 706d478853e..4a7fdf9d9ba 100644 --- a/src/vnet/llc/llc.c +++ b/src/vnet/llc/llc.c @@ -213,7 +213,7 @@ llc_init (vlib_main_t * vm) clib_error_t *error; llc_main_t *pm = &llc_main; - memset (pm, 0, sizeof (pm[0])); + clib_memset (pm, 0, sizeof (pm[0])); pm->vlib_main = vm; pm->protocol_info_by_name = hash_create_string (0, sizeof (uword)); diff --git a/src/vnet/lldp/lldp_api.c b/src/vnet/lldp/lldp_api.c index 28706194513..00b71f97dad 100644 --- a/src/vnet/lldp/lldp_api.c +++ b/src/vnet/lldp/lldp_api.c @@ -74,7 +74,7 @@ vl_api_sw_interface_set_lldp_t_handler (vl_api_sw_interface_set_lldp_t * mp) u8 *port_desc = 0, *mgmt_ip4 = 0, *mgmt_ip6 = 0, *mgmt_oid = 0; u8 no_data[256]; - memset (no_data, 0, 256); + clib_memset (no_data, 0, 256); if (memcmp (mp->port_desc, no_data, strlen ((char *) mp->port_desc)) != 0) { diff --git a/src/vnet/lldp/lldp_input.c b/src/vnet/lldp/lldp_input.c index e88f6fdba5f..cfae30e32ca 100644 --- a/src/vnet/lldp/lldp_input.c +++ b/src/vnet/lldp/lldp_input.c @@ -231,7 +231,7 @@ lldp_create_intf (lldp_main_t * lm, u32 hw_if_index) if (p == 0) { pool_get (lm->intfs, n); - memset (n, 0, sizeof (*n)); + clib_memset (n, 0, sizeof (*n)); n->hw_if_index = hw_if_index; hash_set (lm->intf_by_hw_if_index, n->hw_if_index, n - lm->intfs); } diff --git a/src/vnet/lldp/lldp_output.c b/src/vnet/lldp/lldp_output.c index cffe7ba9804..4ae25a45b7b 100644 --- a/src/vnet/lldp/lldp_output.c +++ b/src/vnet/lldp/lldp_output.c @@ -271,7 +271,7 @@ lldp_template_init (vlib_main_t * vm) { ethernet_header_t h; - memset (&h, 0, sizeof (h)); + clib_memset (&h, 0, sizeof (h)); /* * Send to 01:80:C2:00:00:0E - propagation constrained to a single @@ -280,8 +280,8 @@ lldp_template_init (vlib_main_t * vm) h.dst_address[0] = 0x01; h.dst_address[1] = 0x80; h.dst_address[2] = 0xC2; - /* h.dst_address[3] = 0x00; (memset) */ - /* h.dst_address[4] = 0x00; (memset) */ + /* h.dst_address[3] = 0x00; (clib_memset) */ + /* h.dst_address[4] = 0x00; (clib_memset) */ h.dst_address[5] = 0x0E; /* leave src address blank (fill in at send time) */ diff --git a/src/vnet/mfib/ip4_mfib.c b/src/vnet/mfib/ip4_mfib.c index 7040fa71764..eaa61c0f86c 100644 --- a/src/vnet/mfib/ip4_mfib.c +++ b/src/vnet/mfib/ip4_mfib.c @@ -39,7 +39,7 @@ ip4_create_mfib_with_table_id (u32 table_id, mfib_table_t *mfib_table; pool_get_aligned(ip4_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES); - memset(mfib_table, 0, sizeof(*mfib_table)); + clib_memset(mfib_table, 0, sizeof(*mfib_table)); mfib_table->mft_proto = FIB_PROTOCOL_IP4; mfib_table->mft_index = @@ -425,12 +425,12 @@ ip4_show_mfib (vlib_main_t * vm, } else if (unformat (input, "%U/%d", unformat_ip4_address, &grp, &mask)) { - memset(&src, 0, sizeof(src)); + clib_memset(&src, 0, sizeof(src)); matching = 1; } else if (unformat (input, "%U", unformat_ip4_address, &grp)) { - memset(&src, 0, sizeof(src)); + clib_memset(&src, 0, sizeof(src)); matching = 1; mask = 32; } diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c index 1c1f5db71f7..e98ac42374a 100644 --- a/src/vnet/mfib/ip6_mfib.c +++ b/src/vnet/mfib/ip6_mfib.c @@ -168,7 +168,7 @@ ip6_create_mfib_with_table_id (u32 table_id, }; pool_get_aligned(ip6_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES); - memset(mfib_table, 0, sizeof(*mfib_table)); + clib_memset(mfib_table, 0, sizeof(*mfib_table)); mfib_table->mft_proto = FIB_PROTOCOL_IP6; mfib_table->mft_index = @@ -340,7 +340,7 @@ ip6_mfib_table_get_index_for_sw_if_index (u32 sw_if_index) if (_len <= 128) \ { \ memcpy((_key)->mask+1, &ip6_main.fib_masks[_len], 16); \ - memset((_key)->mask+17, 0, 16); \ + clib_memset((_key)->mask+17, 0, 16); \ } \ else \ { \ @@ -434,7 +434,7 @@ ip6_mfib_table_entry_insert (ip6_mfib_t *mfib, { ip6_mfib_node_t *i6mn = clib_mem_alloc(sizeof(*i6mn)); - memset(i6mn->i6mn_nodes, 0, sizeof(i6mn->i6mn_nodes)); + clib_memset(i6mn->i6mn_nodes, 0, sizeof(i6mn->i6mn_nodes)); IP6_MFIB_MK_KEY_MASK(grp, src, len, &i6mn->i6mn_key); i6mn->i6mn_entry = mfib_entry_index; @@ -601,12 +601,12 @@ ip6_show_mfib (vlib_main_t * vm, } else if (unformat (input, "%U/%d", unformat_ip6_address, &grp, &mask)) { - memset(&src, 0, sizeof(src)); + clib_memset(&src, 0, sizeof(src)); matching = 1; } else if (unformat (input, "%U", unformat_ip6_address, &grp)) { - memset(&src, 0, sizeof(src)); + clib_memset(&src, 0, sizeof(src)); matching = 1; mask = 128; } diff --git a/src/vnet/mfib/mfib_entry.c b/src/vnet/mfib/mfib_entry.c index a8d2f89cd55..90b223e3c25 100644 --- a/src/vnet/mfib/mfib_entry.c +++ b/src/vnet/mfib/mfib_entry.c @@ -403,7 +403,7 @@ mfib_entry_alloc (u32 fib_index, /* * Some of the members require non-default initialisation - * so we also init those that don't and thus save on the call to memset. + * so we also init those that don't and thus save on the call to clib_memset. */ mfib_entry->mfe_flags = 0; mfib_entry->mfe_fib_index = fib_index; diff --git a/src/vnet/mfib/mfib_test.c b/src/vnet/mfib/mfib_test.c index 4d519cd460f..2a12a38ef80 100644 --- a/src/vnet/mfib/mfib_test.c +++ b/src/vnet/mfib/mfib_test.c @@ -342,7 +342,7 @@ mfib_test_i (fib_protocol_t PROTO, int res; mfib_prefix_t all_1s; - memset(&all_1s, 0xfd, sizeof(all_1s)); + clib_memset(&all_1s, 0xfd, sizeof(all_1s)); res = 0; n_entries = pool_elts(mfib_entry_pool); diff --git a/src/vnet/mpls/mpls.c b/src/vnet/mpls/mpls.c index c35aef943cd..05361de505d 100644 --- a/src/vnet/mpls/mpls.c +++ b/src/vnet/mpls/mpls.c @@ -228,7 +228,7 @@ vnet_mpls_local_label (vlib_main_t * vm, eos = MPLS_EOS; is_del = 0; local_label = MPLS_LABEL_INVALID; - memset(&pfx, 0, sizeof(pfx)); + clib_memset(&pfx, 0, sizeof(pfx)); payload_proto = DPO_PROTO_MPLS; /* Get a line of input. */ diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c index 84532bffbda..0f2ebb11bca 100644 --- a/src/vnet/mpls/mpls_api.c +++ b/src/vnet/mpls/mpls_api.c @@ -202,7 +202,7 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm, return (rv); ip46_address_t nh; - memset (&nh, 0, sizeof (nh)); + clib_memset (&nh, 0, sizeof (nh)); if (DPO_PROTO_IP4 == mp->mr_next_hop_proto) memcpy (&nh.ip4, mp->mr_next_hop, sizeof (nh.ip4)); @@ -316,7 +316,7 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp) fib_route_path_t rpath, *rpaths = NULL; int ii, rv = 0; - memset (&rpath, 0, sizeof (rpath)); + clib_memset (&rpath, 0, sizeof (rpath)); stats_dslock_with_hint (1 /* release hint */ , 5 /* tag */ ); @@ -450,7 +450,7 @@ send_mpls_tunnel_entry (u32 mti, void *arg) n = fib_path_list_get_n_paths (mt->mt_path_list); mp = vl_msg_api_alloc (sizeof (*mp) + n * sizeof (vl_api_fib_path_t)); - memset (mp, 0, sizeof (*mp) + n * sizeof (vl_api_fib_path_t)); + clib_memset (mp, 0, sizeof (*mp) + n * sizeof (vl_api_fib_path_t)); mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS); mp->context = ctx->context; @@ -504,7 +504,7 @@ send_mpls_fib_details (vpe_api_main_t * am, mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp)); if (!mp) return; - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS); mp->context = context; diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c index f6e5dabdd8f..27c2a2a6f00 100644 --- a/src/vnet/mpls/mpls_tunnel.c +++ b/src/vnet/mpls/mpls_tunnel.c @@ -609,7 +609,7 @@ vnet_mpls_tunnel_create (u8 l2_only, vnm = vnet_get_main(); pool_get(mpls_tunnel_pool, mt); - memset (mt, 0, sizeof (*mt)); + clib_memset (mt, 0, sizeof (*mt)); mti = mt - mpls_tunnel_pool; fib_node_init(&mt->mt_node, FIB_NODE_TYPE_MPLS_TUNNEL); mt->mt_path_list = FIB_NODE_INDEX_INVALID; @@ -788,7 +788,7 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm, u32 sw_if_index = ~0, payload_proto; clib_error_t *error = NULL; - memset(&rpath, 0, sizeof(rpath)); + clib_memset(&rpath, 0, sizeof(rpath)); payload_proto = DPO_PROTO_MPLS; /* Get a line of input. */ diff --git a/src/vnet/osi/osi.c b/src/vnet/osi/osi.c index 0134eb0f5ea..9556481448a 100644 --- a/src/vnet/osi/osi.c +++ b/src/vnet/osi/osi.c @@ -176,7 +176,7 @@ osi_init (vlib_main_t * vm) if ((error = vlib_call_init_function (vm, llc_init))) return error; - memset (pm, 0, sizeof (pm[0])); + clib_memset (pm, 0, sizeof (pm[0])); pm->vlib_main = vm; pm->protocol_info_by_name = hash_create_string (0, sizeof (uword)); diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c index 745b9b2bf69..13b0e97cf4c 100644 --- a/src/vnet/pg/cli.c +++ b/src/vnet/pg/cli.c @@ -92,7 +92,7 @@ pg_capture (pg_capture_args_t * a) pi = pool_elt_at_index (pg->interfaces, a->dev_instance); vec_free (pi->pcap_file_name); - memset (&pi->pcap_main, 0, sizeof (pi->pcap_main)); + clib_memset (&pi->pcap_main, 0, sizeof (pi->pcap_main)); if (a->is_enabled == 0) return 0; @@ -224,7 +224,7 @@ pg_pcap_read (pg_stream_t * s, char *file_name) #else pcap_main_t pm; clib_error_t *error; - memset (&pm, 0, sizeof (pm)); + clib_memset (&pm, 0, sizeof (pm)); pm.file_name = file_name; error = pcap_read (&pm); s->replay_packet_templates = pm.packets_read; diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h index b2b5798eb22..ab3ae44aed6 100644 --- a/src/vnet/pg/pg.h +++ b/src/vnet/pg/pg.h @@ -287,7 +287,7 @@ pg_free_edit_group (pg_stream_t * s) pg_edit_group_t *g = pg_stream_get_group (s, i); pg_edit_group_free (g); - memset (g, 0, sizeof (g[0])); + clib_memset (g, 0, sizeof (g[0])); _vec_len (s->edit_groups) = i; } diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c index 37380034fd2..9611fe0fa4e 100644 --- a/src/vnet/policer/policer.c +++ b/src/vnet/policer/policer.c @@ -434,7 +434,7 @@ configure_policer_command_fn (vlib_main_t * vm, if (!unformat_user (input, unformat_line_input, line_input)) return 0; - memset (&c, 0, sizeof (c)); + clib_memset (&c, 0, sizeof (c)); while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c index d6d6b07ac34..96ee781ca18 100644 --- a/src/vnet/policer/policer_api.c +++ b/src/vnet/policer/policer_api.c @@ -60,7 +60,7 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp) name = format (0, "%s", mp->name); vec_terminate_c_string (name); - memset (&cfg, 0, sizeof (cfg)); + clib_memset (&cfg, 0, sizeof (cfg)); cfg.rfc = mp->type; cfg.rnd_type = mp->round_type; cfg.rate_type = mp->rate_type; @@ -101,7 +101,7 @@ send_policer_details (u8 * name, vl_api_policer_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 = ntohs (VL_API_POLICER_DETAILS); mp->context = context; mp->cir = htonl (config->rb.kbps.cir_kbps); diff --git a/src/vnet/policer/xlate.c b/src/vnet/policer/xlate.c index 5905aa53351..afc0c05c376 100644 --- a/src/vnet/policer/xlate.c +++ b/src/vnet/policer/xlate.c @@ -798,7 +798,7 @@ sse2_pol_convert_cfg_to_hw_params (sse2_qos_pol_cfg_params_st * cfg, /* * clear the hw_params */ - memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st)); hw->allow_negative = SSE2_QOS_POL_ALLOW_NEGATIVE; @@ -1174,8 +1174,8 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg, int rc; sse2_qos_pol_cfg_params_st kbps_cfg; - memset (phys, 0, sizeof (policer_read_response_type_st)); - memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); + clib_memset (phys, 0, sizeof (policer_read_response_type_st)); + clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); if (!cfg) { @@ -1279,7 +1279,7 @@ static void sse2_qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st * bkt, sse2_qos_pol_hw_params_st * hw_fmt) { - memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st)); #if !defined (INTERNAL_SS) && !defined (X86) hw_fmt->rfc = (u8) bkt->rfc; hw_fmt->allow_negative = (u8) bkt->an; @@ -1436,8 +1436,8 @@ sse2_pol_physical_2_logical (policer_read_response_type_st * phys, sse2_qos_pol_hw_params_st pol_hw; sse2_qos_pol_cfg_params_st kbps_cfg; - memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st)); - memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); + clib_memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); if (!phys) { diff --git a/src/vnet/ppp/ppp.c b/src/vnet/ppp/ppp.c index 2b3b3b23b5f..b1fafa13145 100644 --- a/src/vnet/ppp/ppp.c +++ b/src/vnet/ppp/ppp.c @@ -229,7 +229,7 @@ ppp_init (vlib_main_t * vm) { ppp_main_t *pm = &ppp_main; - memset (pm, 0, sizeof (pm[0])); + clib_memset (pm, 0, sizeof (pm[0])); pm->vlib_main = vm; pm->protocol_info_by_name = hash_create_string (0, sizeof (uword)); diff --git a/src/vnet/qos/qos_egress_map.c b/src/vnet/qos/qos_egress_map.c index 365643995ba..158ff8445c6 100644 --- a/src/vnet/qos/qos_egress_map.c +++ b/src/vnet/qos/qos_egress_map.c @@ -73,7 +73,7 @@ qos_egress_map_find_or_create (qos_egress_map_id_t mid) pool_get_aligned (qem_pool, qem, CLIB_CACHE_LINE_BYTES); qemi = qem - qem_pool; - memset (qem, 0, sizeof (*qem)); + clib_memset (qem, 0, sizeof (*qem)); hash_set (qem_db, mid, qemi); } diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c index f97039c7936..53b44410f07 100644 --- a/src/vnet/sctp/sctp.c +++ b/src/vnet/sctp/sctp.c @@ -25,7 +25,7 @@ sctp_connection_bind (u32 session_index, transport_endpoint_t * tep) void *iface_ip; pool_get (tm->listener_pool, listener); - memset (listener, 0, sizeof (*listener)); + clib_memset (listener, 0, sizeof (*listener)); listener->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx = SCTP_PRIMARY_PATH_IDX; @@ -78,7 +78,7 @@ sctp_connection_unbind (u32 listener_index) /* Poison the entry */ if (CLIB_DEBUG > 0) - memset (sctp_conn, 0xFA, sizeof (*sctp_conn)); + clib_memset (sctp_conn, 0xFA, sizeof (*sctp_conn)); pool_put_index (tm->listener_pool, listener_index); } @@ -424,7 +424,7 @@ sctp_connection_new (u8 thread_index) sctp_connection_t *sctp_conn; pool_get (sctp_main->connections[thread_index], sctp_conn); - memset (sctp_conn, 0, sizeof (*sctp_conn)); + clib_memset (sctp_conn, 0, sizeof (*sctp_conn)); sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx = SCTP_PRIMARY_PATH_IDX; sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index = @@ -442,7 +442,7 @@ sctp_half_open_connection_new (u8 thread_index) sctp_connection_t *sctp_conn = 0; ASSERT (vlib_get_thread_index () == 0); pool_get (tm->half_open_connections, sctp_conn); - memset (sctp_conn, 0, sizeof (*sctp_conn)); + clib_memset (sctp_conn, 0, sizeof (*sctp_conn)); sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index = sctp_conn - tm->half_open_connections; sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx = @@ -537,7 +537,7 @@ sctp_connection_cleanup (sctp_connection_t * sctp_conn) /* Poison the entry */ if (CLIB_DEBUG > 0) - memset (sctp_conn, 0xFA, sizeof (*sctp_conn)); + clib_memset (sctp_conn, 0xFA, sizeof (*sctp_conn)); pool_put (tm->connections[thread_index], sctp_conn); } diff --git a/src/vnet/sctp/sctp.h b/src/vnet/sctp/sctp.h index 577c2aff8b0..c40de10a409 100644 --- a/src/vnet/sctp/sctp.h +++ b/src/vnet/sctp/sctp.h @@ -578,7 +578,7 @@ sctp_half_open_connection_del (sctp_connection_t * tc) pool_put_index (sctp_main->half_open_connections, tc->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index); if (CLIB_DEBUG) - memset (tc, 0xFA, sizeof (*tc)); + clib_memset (tc, 0xFA, sizeof (*tc)); clib_spinlock_unlock_if_init (&sctp_main->half_open_lock); } diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c index 08640a44311..2b65d97e093 100644 --- a/src/vnet/sctp/sctp_output.c +++ b/src/vnet/sctp/sctp_output.c @@ -1847,7 +1847,7 @@ sctp46_output_inline (vlib_main_t * vm, } else { - memset (&t0->sctp_header, 0, sizeof (t0->sctp_header)); + clib_memset (&t0->sctp_header, 0, sizeof (t0->sctp_header)); } clib_memcpy (&t0->sctp_connection, sctp_conn, sizeof (t0->sctp_connection)); diff --git a/src/vnet/sctp/sctp_packet.h b/src/vnet/sctp/sctp_packet.h index 427e2f39496..04995aa7ee3 100644 --- a/src/vnet/sctp/sctp_packet.h +++ b/src/vnet/sctp/sctp_packet.h @@ -951,7 +951,7 @@ vnet_sctp_set_hostname_address (sctp_hostname_param_t * h, char *hostname) { h->param_hdr.length = FQDN_MAX_LENGTH; h->param_hdr.type = clib_host_to_net_u16 (SCTP_HOSTNAME_ADDRESS_TYPE); - memset (h->hostname, '0', FQDN_MAX_LENGTH); + clib_memset (h->hostname, '0', FQDN_MAX_LENGTH); memcpy (h->hostname, hostname, FQDN_MAX_LENGTH); } diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c index c3d838d49cc..7935eb8b242 100644 --- a/src/vnet/session-apps/echo_client.c +++ b/src/vnet/session-apps/echo_client.c @@ -387,7 +387,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context, pool_get (ecm->sessions, session); clib_spinlock_unlock_if_init (&ecm->sessions_lock); - memset (session, 0, sizeof (*session)); + clib_memset (session, 0, sizeof (*session)); session_index = session - ecm->sessions; session->bytes_to_send = ecm->bytes_to_send; session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send; @@ -507,8 +507,8 @@ echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) u64 options[16]; clib_error_t *error = 0; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->api_client_index = ecm->my_client_index; a->session_cb_vft = &echo_clients; @@ -588,7 +588,7 @@ echo_clients_connect (vlib_main_t * vm, u32 n_clients) clib_error_t *error = 0; int i; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); for (i = 0; i < n_clients; i++) { a->uri = (char *) ecm->connect_uri; diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c index 14ab36d796c..3ee33ea8e29 100644 --- a/src/vnet/session-apps/echo_server.c +++ b/src/vnet/session-apps/echo_server.c @@ -287,8 +287,8 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) u64 options[APP_OPTIONS_N_OPTIONS]; u32 segment_size = 512 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (esm->no_echo) echo_server_session_cb_vft.builtin_app_rx_callback = @@ -327,13 +327,13 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) } esm->app_index = a->app_index; - memset (a_cert, 0, sizeof (*a_cert)); + clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; vec_validate (a_cert->cert, test_srv_crt_rsa_len); clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len); vnet_app_add_tls_cert (a_cert); - memset (a_key, 0, sizeof (*a_key)); + clib_memset (a_key, 0, sizeof (*a_key)); a_key->app_index = a->app_index; vec_validate (a_key->key, test_srv_key_rsa_len); clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len); @@ -359,7 +359,7 @@ echo_server_listen () { echo_server_main_t *esm = &echo_server_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = esm->app_index; a->uri = esm->server_uri; return vnet_bind_uri (a); diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c index ef9f760c992..8501cb4ee70 100644 --- a/src/vnet/session-apps/http_server.c +++ b/src/vnet/session-apps/http_server.c @@ -498,8 +498,8 @@ server_attach () vnet_app_attach_args_t _a, *a = &_a; u32 segment_size = 128 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (hsm->private_segment_size) segment_size = hsm->private_segment_size; @@ -522,13 +522,13 @@ server_attach () } hsm->app_index = a->app_index; - memset (a_cert, 0, sizeof (*a_cert)); + clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; vec_validate (a_cert->cert, test_srv_crt_rsa_len); clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len); vnet_app_add_tls_cert (a_cert); - memset (a_key, 0, sizeof (*a_key)); + clib_memset (a_key, 0, sizeof (*a_key)); a_key->app_index = a->app_index; vec_validate (a_key->key, test_srv_key_rsa_len); clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len); @@ -542,7 +542,7 @@ http_server_listen () { http_server_main_t *hsm = &http_server_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = hsm->app_index; a->uri = "tcp://0.0.0.0/80"; if (hsm->uri) diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c index 6260ad350f0..f7896a5b0ae 100644 --- a/src/vnet/session-apps/proxy.c +++ b/src/vnet/session-apps/proxy.c @@ -116,7 +116,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open) if (ps) { if (CLIB_DEBUG > 0) - memset (ps, 0xFE, sizeof (*ps)); + clib_memset (ps, 0xFE, sizeof (*ps)); pool_put (pm->sessions, ps); } @@ -235,11 +235,11 @@ proxy_rx_callback (stream_session_t * s) /* $$$ your message in this space: parse url, etc. */ - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); clib_spinlock_lock_if_init (&pm->sessions_lock); pool_get (pm->sessions, ps); - memset (ps, 0, sizeof (*ps)); + clib_memset (ps, 0, sizeof (*ps)); ps->server_rx_fifo = rx_fifo; ps->server_tx_fifo = tx_fifo; ps->vpp_server_handle = session_handle (s); @@ -397,8 +397,8 @@ proxy_server_attach () vnet_app_attach_args_t _a, *a = &_a; u32 segment_size = 512 << 20; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); if (pm->private_segment_size) segment_size = pm->private_segment_size; @@ -431,8 +431,8 @@ active_open_attach (void) vnet_app_attach_args_t _a, *a = &_a; u64 options[16]; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->api_client_index = pm->active_open_client_index; a->session_cb_vft = &active_open_clients; @@ -463,7 +463,7 @@ proxy_server_listen () { proxy_main_t *pm = &proxy_main; vnet_bind_args_t _a, *a = &_a; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = pm->server_app_index; a->uri = (char *) pm->server_uri; return vnet_bind_uri (a); diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index fad3e1c2292..90c067d6d31 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -25,7 +25,7 @@ app_listener_alloc (application_t * app) { app_listener_t *app_listener; pool_get (app->listeners, app_listener); - memset (app_listener, 0, sizeof (*app_listener)); + clib_memset (app_listener, 0, sizeof (*app_listener)); app_listener->al_index = app_listener - app->listeners; return app_listener; } @@ -42,7 +42,7 @@ app_listener_free (application_t * app, app_listener_t * app_listener) clib_bitmap_free (app_listener->workers); pool_put (app->listeners, app_listener); if (CLIB_DEBUG) - memset (app_listener, 0xfa, sizeof (*app_listener)); + clib_memset (app_listener, 0xfa, sizeof (*app_listener)); } static app_listener_t * @@ -50,7 +50,7 @@ app_local_listener_alloc (application_t * app) { app_listener_t *app_listener; pool_get (app->local_listeners, app_listener); - memset (app_listener, 0, sizeof (*app_listener)); + clib_memset (app_listener, 0, sizeof (*app_listener)); app_listener->al_index = app_listener - app->local_listeners; return app_listener; } @@ -67,7 +67,7 @@ app_local_listener_free (application_t * app, app_listener_t * app_listener) clib_bitmap_free (app_listener->workers); pool_put (app->local_listeners, app_listener); if (CLIB_DEBUG) - memset (app_listener, 0xfa, sizeof (*app_listener)); + clib_memset (app_listener, 0xfa, sizeof (*app_listener)); } static app_worker_map_t * @@ -75,7 +75,7 @@ app_worker_map_alloc (application_t * app) { app_worker_map_t *map; pool_get (app->worker_maps, map); - memset (map, 0, sizeof (*map)); + clib_memset (map, 0, sizeof (*map)); return map; } @@ -234,7 +234,7 @@ application_alloc (void) { application_t *app; pool_get (app_main.app_pool, app); - memset (app, 0, sizeof (*app)); + clib_memset (app, 0, sizeof (*app)); app->app_index = app - app_main.app_pool; return app; } @@ -484,7 +484,7 @@ app_worker_alloc (application_t * app) { app_worker_t *app_wrk; pool_get (app_main.workers, app_wrk); - memset (app_wrk, 0, sizeof (*app_wrk)); + clib_memset (app_wrk, 0, sizeof (*app_wrk)); app_wrk->wrk_index = app_wrk - app_main.workers; app_wrk->app_index = app->app_index; app_wrk->wrk_map_index = ~0; @@ -572,7 +572,7 @@ app_worker_free (app_worker_t * app_wrk) pool_put (app_main.workers, app_wrk); if (CLIB_DEBUG) - memset (app_wrk, 0xfe, sizeof (*app_wrk)); + clib_memset (app_wrk, 0xfe, sizeof (*app_wrk)); } int @@ -1347,7 +1347,7 @@ application_local_session_alloc (app_worker_t * app_wrk) { local_session_t *s; pool_get (app_wrk->local_sessions, s); - memset (s, 0, sizeof (*s)); + clib_memset (s, 0, sizeof (*s)); s->app_wrk_index = app_wrk->wrk_index; s->session_index = s - app_wrk->local_sessions; s->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE, 0); @@ -1359,7 +1359,7 @@ application_local_session_free (app_worker_t * app, local_session_t * s) { pool_put (app->local_sessions, s); if (CLIB_DEBUG) - memset (s, 0xfc, sizeof (*s)); + clib_memset (s, 0xfc, sizeof (*s)); } local_session_t * @@ -1387,7 +1387,7 @@ application_local_listen_session_alloc (application_t * app) { local_session_t *ll; pool_get (app->local_listen_sessions, ll); - memset (ll, 0, sizeof (*ll)); + clib_memset (ll, 0, sizeof (*ll)); return ll; } @@ -1403,7 +1403,7 @@ application_local_listen_session_free (application_t * app, { pool_put (app->local_listen_sessions, ll); if (CLIB_DEBUG) - memset (ll, 0xfb, sizeof (*ll)); + clib_memset (ll, 0xfb, sizeof (*ll)); } int diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 5b28a29c45b..c8ceb4e07a5 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -314,7 +314,7 @@ app_alloc_ctrl_evt_to_vpp (svm_msg_q_t * mq, app_session_evt_t * app_evt, SVM_Q_WAIT, &app_evt->msg); svm_msg_q_unlock (mq); app_evt->evt = svm_msg_q_msg_data (mq, &app_evt->msg); - memset (app_evt->evt, 0, sizeof (*app_evt->evt)); + clib_memset (app_evt->evt, 0, sizeof (*app_evt->evt)); app_evt->evt->event_type = evt_type; } diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c index ce44547a86d..1896a723115 100644 --- a/src/vnet/session/application_namespace.c +++ b/src/vnet/session/application_namespace.c @@ -54,7 +54,7 @@ app_namespace_alloc (u8 * ns_id) { app_namespace_t *app_ns; pool_get (app_namespace_pool, app_ns); - memset (app_ns, 0, sizeof (*app_ns)); + clib_memset (app_ns, 0, sizeof (*app_ns)); app_ns->ns_id = vec_dup (ns_id); hash_set_mem (app_namespace_lookup_table, app_ns->ns_id, app_ns - app_namespace_pool); diff --git a/src/vnet/session/mma_template.c b/src/vnet/session/mma_template.c index 248ced61451..15fd7c7aeed 100644 --- a/src/vnet/session/mma_template.c +++ b/src/vnet/session/mma_template.c @@ -53,7 +53,7 @@ RTT (mma_rule) * RT (mma_rules_table_rule_alloc) (RTT (mma_rules_table) * srt) { RTT (mma_rule) * rule; pool_get (srt->rules, rule); - memset (rule, 0, sizeof (*rule)); + clib_memset (rule, 0, sizeof (*rule)); return rule; } @@ -61,7 +61,7 @@ RTT (mma_rule) * RT (mma_rule_free) (RTT (mma_rules_table) * srt, RTT (mma_rule) * rule) { pool_put (srt->rules, rule); - memset (rule, 0xfa, sizeof (*rule)); + clib_memset (rule, 0xfa, sizeof (*rule)); return rule; } diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c index 8dd72928ec4..6386645a974 100644 --- a/src/vnet/session/segment_manager.c +++ b/src/vnet/session/segment_manager.c @@ -82,7 +82,7 @@ segment_manager_del_segment (segment_manager_t * sm, ssvm_delete (&fs->ssvm); if (CLIB_DEBUG) - memset (fs, 0xfb, sizeof (*fs)); + clib_memset (fs, 0xfb, sizeof (*fs)); pool_put (sm->segments, fs); } @@ -182,7 +182,7 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size) { pool_get (sm->segments, seg); } - memset (seg, 0, sizeof (*seg)); + clib_memset (seg, 0, sizeof (*seg)); /* * Initialize ssvm segment and svm fifo private header @@ -238,7 +238,7 @@ segment_manager_new () segment_manager_main_t *smm = &segment_manager_main; segment_manager_t *sm; pool_get (smm->segment_managers, sm); - memset (sm, 0, sizeof (*sm)); + clib_memset (sm, 0, sizeof (*sm)); clib_rwlock_init (&sm->segments_rwlock); return sm; } @@ -419,7 +419,7 @@ segment_manager_del (segment_manager_t * sm) clib_rwlock_free (&sm->segments_rwlock); if (CLIB_DEBUG) - memset (sm, 0xfe, sizeof (*sm)); + clib_memset (sm, 0xfe, sizeof (*sm)); pool_put (smm->segment_managers, sm); } diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 81c93064d38..189c5375fbb 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -139,7 +139,7 @@ session_alloc (u32 thread_index) pool_get_aligned (session_manager_main.sessions[thread_index], s, CLIB_CACHE_LINE_BYTES); } - memset (s, 0, sizeof (*s)); + clib_memset (s, 0, sizeof (*s)); s->session_index = s - session_manager_main.sessions[thread_index]; s->thread_index = thread_index; return s; @@ -150,7 +150,7 @@ session_free (stream_session_t * s) { pool_put (session_manager_main.sessions[s->thread_index], s); if (CLIB_DEBUG) - memset (s, 0xFA, sizeof (*s)); + clib_memset (s, 0xFA, sizeof (*s)); } void @@ -1087,7 +1087,7 @@ stream_session_disconnect (stream_session_t * s) if (vlib_thread_is_main_w_barrier () || thread_index == s->thread_index) { vec_add2 (smm->pending_disconnects[s->thread_index], evt, 1); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->session_handle = session_handle (s); evt->event_type = FIFO_EVENT_DISCONNECT; } diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 56593865381..f0273641e7f 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -107,7 +107,7 @@ send_add_segment_callback (u32 api_client_index, const ssvm_private_t * sp) } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT); mp->segment_size = sp->ssvm_size; mp->fd_flags = fd_flags; @@ -136,7 +136,7 @@ send_del_segment_callback (u32 api_client_index, const ssvm_private_t * fs) } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT); strncpy ((char *) mp->segment_name, (char *) fs->name, sizeof (mp->segment_name) - 1); @@ -164,7 +164,7 @@ send_app_cut_through_registration_add (u32 api_client_index, } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_APP_CUT_THROUGH_REGISTRATION_ADD); @@ -215,7 +215,7 @@ send_session_accept_callback (stream_session_t * s) } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION); mp->context = server_wrk->wrk_index; @@ -295,7 +295,7 @@ send_session_disconnect_callback (stream_session_t * s) } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_DISCONNECT_SESSION); mp->handle = session_handle (s); mp->context = app->api_client_index; @@ -319,7 +319,7 @@ send_session_reset_callback (stream_session_t * s) } mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_RESET_SESSION); mp->handle = session_handle (s); vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp); @@ -433,7 +433,7 @@ mq_send_session_accepted_cb (stream_session_t * s) return -1; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_ACCEPTED; mp = (session_accepted_msg_t *) evt->data; mp->context = app->app_index; @@ -519,7 +519,7 @@ mq_send_session_disconnected_cb (stream_session_t * s) if (mq_try_lock_and_alloc_msg (app_mq, msg)) return; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_DISCONNECTED; mp = (session_disconnected_msg_t *) evt->data; mp->handle = session_handle (s); @@ -543,7 +543,7 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index, if (mq_try_lock_and_alloc_msg (app_mq, msg)) return; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_DISCONNECTED; mp = (session_disconnected_msg_t *) evt->data; mp->handle = application_local_session_handle (ls); @@ -564,7 +564,7 @@ mq_send_session_reset_cb (stream_session_t * s) if (mq_try_lock_and_alloc_msg (app_mq, msg)) return; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_RESET; mp = (session_reset_msg_t *) evt->data; mp->handle = session_handle (s); @@ -596,7 +596,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context, if (mq_try_lock_and_alloc_msg (app_mq, msg)) return -1; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_CONNECTED; mp = (session_connected_msg_t *) evt->data; mp->context = api_context; @@ -677,7 +677,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context, return -1; evt = svm_msg_q_msg_data (app_mq, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_BOUND; mp = (session_bound_msg_t *) evt->data; mp->context = api_context; @@ -761,7 +761,7 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp) sizeof (mp->options), "Out of options, fix api message definition"); - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->api_client_index = mp->client_index; a->options = mp->options; @@ -883,7 +883,7 @@ vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp) app = application_lookup (mp->client_index); if (app) { - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->uri = (char *) mp->uri; a->app_index = app->app_index; rv = vnet_bind_uri (a); @@ -976,7 +976,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp) app = application_lookup (mp->client_index); if (app) { - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->uri = (char *) mp->uri; a->api_context = mp->context; a->app_index = app->app_index; @@ -1180,7 +1180,7 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp) } ip46 = (ip46_address_t *) mp->ip; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->sep.is_ip4 = mp->is_ip4; a->sep.ip = *ip46; a->sep.port = mp->port; @@ -1283,7 +1283,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp) svm_queue_t *client_q; ip46_address_t *ip46 = (ip46_address_t *) mp->ip; - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); client_q = vl_api_client_index_to_input_queue (mp->client_index); mp->client_queue_address = pointer_to_uword (client_q); a->sep.is_ip4 = mp->is_ip4; @@ -1474,7 +1474,7 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) u8 fib_proto; int rv = 0; - memset (&args, 0, sizeof (args)); + clib_memset (&args, 0, sizeof (args)); fib_proto = mp->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6; table_args->lcl.fp_len = mp->lcl_plen; @@ -1491,8 +1491,8 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) args.scope = mp->scope; args.transport_proto = mp->transport_proto; - memset (&table_args->lcl.fp_addr, 0, sizeof (table_args->lcl.fp_addr)); - memset (&table_args->rmt.fp_addr, 0, sizeof (table_args->rmt.fp_addr)); + clib_memset (&table_args->lcl.fp_addr, 0, sizeof (table_args->lcl.fp_addr)); + clib_memset (&table_args->rmt.fp_addr, 0, sizeof (table_args->rmt.fp_addr)); ip_set (&table_args->lcl.fp_addr, mp->lcl_ip, mp->is_ip4); ip_set (&table_args->rmt.fp_addr, mp->rmt_ip, mp->is_ip4); error = vnet_session_rule_add_del (&args); @@ -1517,7 +1517,7 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, (session_mask_or_match_4_t *) & rule->mask; 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_SESSION_RULES_DETAILS); rmp->context = context; @@ -1554,7 +1554,7 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, (session_mask_or_match_6_t *) & rule->mask; 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_SESSION_RULES_DETAILS); rmp->context = context; @@ -1662,7 +1662,7 @@ vl_api_application_tls_cert_add_t_handler (vl_api_application_tls_cert_add_t * rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED; goto done; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = app->app_index; cert_len = clib_net_to_host_u16 (mp->cert_len); if (cert_len > 10000) @@ -1702,7 +1702,7 @@ vl_api_application_tls_key_add_t_handler (vl_api_application_tls_key_add_t * rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED; goto done; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->app_index = app->app_index; key_len = clib_net_to_host_u16 (mp->key_len); if (key_len > 10000) diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c index 36133523e34..57f3d3ad7f1 100755 --- a/src/vnet/session/session_cli.c +++ b/src/vnet/session/session_cli.c @@ -109,8 +109,8 @@ unformat_stream_session_id (unformat_input_t * input, va_list * args) u8 *is_ip4 = va_arg (*args, u8 *); u8 tuple_is_set = 0; - memset (lcl, 0, sizeof (*lcl)); - memset (rmt, 0, sizeof (*rmt)); + clib_memset (lcl, 0, sizeof (*lcl)); + clib_memset (rmt, 0, sizeof (*rmt)); if (unformat (input, "tcp")) { diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c index 19aeb0b24e0..927922e7e64 100644 --- a/src/vnet/session/session_lookup.c +++ b/src/vnet/session/session_lookup.c @@ -460,7 +460,7 @@ session_lookup_endpoint_listener (u32 table_index, session_endpoint_t * sep, return kv4.value; if (use_rules) { - memset (&lcl4, 0, sizeof (lcl4)); + clib_memset (&lcl4, 0, sizeof (lcl4)); srt = &st->session_rules[sep->transport_proto]; ai = session_rules_table_lookup4 (srt, &lcl4, &sep->ip.ip4, 0, sep->port); @@ -481,7 +481,7 @@ session_lookup_endpoint_listener (u32 table_index, session_endpoint_t * sep, if (use_rules) { - memset (&lcl6, 0, sizeof (lcl6)); + clib_memset (&lcl6, 0, sizeof (lcl6)); srt = &st->session_rules[sep->transport_proto]; ai = session_rules_table_lookup6 (srt, &lcl6, &sep->ip.ip6, 0, sep->port); @@ -529,7 +529,7 @@ session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep) /* * Check if endpoint has special rules associated */ - memset (&lcl4, 0, sizeof (lcl4)); + clib_memset (&lcl4, 0, sizeof (lcl4)); srt = &st->session_rules[sep->transport_proto]; ai = session_rules_table_lookup4 (srt, &lcl4, &sep->ip.ip4, 0, sep->port); @@ -574,7 +574,7 @@ session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep) session_kv6_t kv6; ip6_address_t lcl6; - memset (&lcl6, 0, sizeof (lcl6)); + clib_memset (&lcl6, 0, sizeof (lcl6)); srt = &st->session_rules[sep->transport_proto]; ai = session_rules_table_lookup6 (srt, &lcl6, &sep->ip.ip6, 0, sep->port); @@ -1267,7 +1267,7 @@ vnet_session_rule_add_del (session_rule_add_del_args_t * args) } if (args->scope & SESSION_RULE_SCOPE_LOCAL) { - memset (&args->table_args.lcl, 0, sizeof (args->table_args.lcl)); + clib_memset (&args->table_args.lcl, 0, sizeof (args->table_args.lcl)); args->table_args.lcl.fp_proto = args->table_args.rmt.fp_proto; args->table_args.lcl_port = 0; st = app_namespace_get_local_table (app_ns); @@ -1383,8 +1383,8 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input, app_namespace_t *app_ns; clib_error_t *error; - memset (&lcl_ip, 0, sizeof (lcl_ip)); - memset (&rmt_ip, 0, sizeof (rmt_ip)); + clib_memset (&lcl_ip, 0, sizeof (lcl_ip)); + clib_memset (&rmt_ip, 0, sizeof (rmt_ip)); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "del")) @@ -1530,8 +1530,8 @@ show_session_rules_command_fn (vlib_main_t * vm, unformat_input_t * input, session_table_t *st; u8 *ns_id = 0, fib_proto; - memset (&lcl_ip, 0, sizeof (lcl_ip)); - memset (&rmt_ip, 0, sizeof (rmt_ip)); + clib_memset (&lcl_ip, 0, sizeof (lcl_ip)); + clib_memset (&rmt_ip, 0, sizeof (rmt_ip)); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "%U", unformat_transport_proto, &transport_proto)) diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 281622bcc9b..c1aea6723b6 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -159,7 +159,7 @@ session_mq_disconnected_handler (void *data) SVM_Q_WAIT, msg); svm_msg_q_unlock (app_wrk->event_queue); evt = svm_msg_q_msg_data (app_wrk->event_queue, msg); - memset (evt, 0, sizeof (*evt)); + clib_memset (evt, 0, sizeof (*evt)); evt->event_type = SESSION_CTRL_EVT_DISCONNECTED; rmp = (session_disconnected_reply_msg_t *) evt->data; rmp->handle = mp->handle; diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c index dee445dd0ad..33f7de07944 100644 --- a/src/vnet/session/session_rules_table.c +++ b/src/vnet/session/session_rules_table.c @@ -445,7 +445,7 @@ session_rules_table_add_del (session_rules_table_t * srt, { mma_rule_16_t _rule; rule = &_rule; - memset (rule, 0, sizeof (*rule)); + clib_memset (rule, 0, sizeof (*rule)); session_rules_table_init_rule_16 (rule, &args->lcl, args->lcl_port, &args->rmt, args->rmt_port); @@ -499,7 +499,7 @@ session_rules_table_add_del (session_rules_table_t * srt, { mma_rule_40_t _rule; rule = &_rule; - memset (rule, 0, sizeof (*rule)); + clib_memset (rule, 0, sizeof (*rule)); session_rules_table_init_rule_40 (rule, &args->lcl, args->lcl_port, &args->rmt, args->rmt_port); @@ -522,7 +522,7 @@ session_rules_table_init (session_rules_table_t * srt) mma_rule_40_t *rule6; fib_prefix_t null_prefix; - memset (&null_prefix, 0, sizeof (null_prefix)); + clib_memset (&null_prefix, 0, sizeof (null_prefix)); srt4 = &srt->session_rules_tables_16; rule4 = session_rules_table_alloc_rule_16 (srt4, &null_prefix, 0, diff --git a/src/vnet/session/session_table.c b/src/vnet/session/session_table.c index 47d19092e2b..c74e290bda7 100644 --- a/src/vnet/session/session_table.c +++ b/src/vnet/session/session_table.c @@ -32,7 +32,7 @@ session_table_alloc (void) { session_table_t *slt; pool_get_aligned (lookup_tables, slt, CLIB_CACHE_LINE_BYTES); - memset (slt, 0, sizeof (*slt)); + clib_memset (slt, 0, sizeof (*slt)); return slt; } diff --git a/src/vnet/session/session_test.c b/src/vnet/session/session_test.c index 058644d91d4..8fe1b0d36e0 100644 --- a/src/vnet/session/session_test.c +++ b/src/vnet/session/session_test.c @@ -110,7 +110,7 @@ session_create_lookpback (u32 table_id, u32 * sw_if_index, { u8 intf_mac[6]; - memset (intf_mac, 0, sizeof (intf_mac)); + clib_memset (intf_mac, 0, sizeof (intf_mac)); if (vnet_create_loopback_interface (sw_if_index, intf_mac, 0, 0)) { @@ -150,7 +150,7 @@ session_test_basic (vlib_main_t * vm, unformat_input_t * input) clib_error_t *error = 0; u32 server_index; - memset (options, 0, sizeof (options)); + clib_memset (options, 0, sizeof (options)); options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN; options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE; options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE; @@ -230,7 +230,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) server_sep.port = dummy_port; client_sep.is_ip4 = 1; client_sep.port = dummy_port; - memset (options, 0, sizeof (options)); + clib_memset (options, 0, sizeof (options)); options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN; vnet_app_attach_args_t attach_args = { @@ -559,7 +559,7 @@ session_test_rule_table (vlib_main_t * vm, unformat_input_t * input) } } - memset (srt, 0, sizeof (*srt)); + clib_memset (srt, 0, sizeof (*srt)); session_rules_table_init (srt); ip4_address_t lcl_ip = { @@ -839,7 +839,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input) server_sep.is_ip4 = 1; server_sep.port = dummy_port; - memset (options, 0, sizeof (options)); + clib_memset (options, 0, sizeof (options)); vnet_app_attach_args_t attach_args = { .api_client_index = ~0, @@ -1424,7 +1424,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input) app_ns = app_namespace_get_default (); app_ns->sw_if_index = sw_if_index; - memset (options, 0, sizeof (options)); + clib_memset (options, 0, sizeof (options)); options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN; options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_ACCEPT_REDIRECT; options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_IS_PROXY; diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index a401190e426..d74a218a5bf 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -336,7 +336,7 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_t * rmt, return -1; } - memset (lcl_addr, 0, sizeof (*lcl_addr)); + clib_memset (lcl_addr, 0, sizeof (*lcl_addr)); if (rmt->is_ip4) { diff --git a/src/vnet/snap/snap.c b/src/vnet/snap/snap.c index 8609c656572..9bee415390a 100644 --- a/src/vnet/snap/snap.c +++ b/src/vnet/snap/snap.c @@ -180,7 +180,7 @@ snap_init (vlib_main_t * vm) { snap_main_t *sm = &snap_main; - memset (sm, 0, sizeof (sm[0])); + clib_memset (sm, 0, sizeof (sm[0])); sm->vlib_main = vm; mhash_init (&sm->protocol_hash, sizeof (uword), diff --git a/src/vnet/span/span_api.c b/src/vnet/span/span_api.c index f05a1c5093e..9566941ab9e 100644 --- a/src/vnet/span/span_api.c +++ b/src/vnet/span/span_api.c @@ -89,7 +89,7 @@ vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp) clib_bitmap_foreach (i, b, ( { 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_SW_INTERFACE_SPAN_DETAILS); rmp->context = mp->context; diff --git a/src/vnet/srmpls/sr_mpls_api.c b/src/vnet/srmpls/sr_mpls_api.c index 2c36c0dd9f2..4cbc6a5cf63 100644 --- a/src/vnet/srmpls/sr_mpls_api.c +++ b/src/vnet/srmpls/sr_mpls_api.c @@ -112,7 +112,7 @@ static void vl_api_sr_mpls_steering_add_del_t_handler { vl_api_sr_mpls_steering_add_del_reply_t *rmp; ip46_address_t prefix; - memset (&prefix, 0, sizeof (ip46_address_t)); + clib_memset (&prefix, 0, sizeof (ip46_address_t)); if (mp->traffic_type == SR_STEER_IPV4) memcpy (&prefix.ip4, mp->prefix_addr, sizeof (prefix.ip4)); else @@ -146,7 +146,7 @@ static void vl_api_sr_mpls_policy_assign_endpoint_color_t_handler int rv = 0; ip46_address_t endpoint; - memset (&endpoint, 0, sizeof (ip46_address_t)); + clib_memset (&endpoint, 0, sizeof (ip46_address_t)); if (mp->endpoint_type == SR_STEER_IPV4) memcpy (&endpoint.ip4, mp->endpoint, sizeof (endpoint.ip4)); else diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/vnet/srmpls/sr_mpls_policy.c index f94a8e945ec..4fb80e12225 100755 --- a/src/vnet/srmpls/sr_mpls_policy.c +++ b/src/vnet/srmpls/sr_mpls_policy.c @@ -64,7 +64,7 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight) u32 ii; pool_get (sm->sid_lists, segment_list); - memset (segment_list, 0, sizeof (*segment_list)); + clib_memset (segment_list, 0, sizeof (*segment_list)); vec_add1 (sr_policy->segments_lists, segment_list - sm->sid_lists); @@ -172,7 +172,7 @@ sr_mpls_policy_add (mpls_label_t bsid, mpls_label_t * segments, } /* Add an SR policy object */ pool_get (sm->sr_policies, sr_policy); - memset (sr_policy, 0, sizeof (*sr_policy)); + clib_memset (sr_policy, 0, sizeof (*sr_policy)); /* the first policy needs to lock the MPLS table so it doesn't * disappear with policies in it */ @@ -840,7 +840,7 @@ cli_sr_mpls_policy_ec_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 endpoint_type = 0; char clear = 0, color_set = 0, bsid_set = 0; - memset (&endpoint, 0, sizeof (ip46_address_t)); + clib_memset (&endpoint, 0, sizeof (ip46_address_t)); int rv; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) diff --git a/src/vnet/srmpls/sr_mpls_steering.c b/src/vnet/srmpls/sr_mpls_steering.c index c5ddab73ce4..669644913a3 100755 --- a/src/vnet/srmpls/sr_mpls_steering.c +++ b/src/vnet/srmpls/sr_mpls_steering.c @@ -70,7 +70,7 @@ find_or_create_internal_label (ip46_address_t endpoint, u32 color) if (!color_table) { mhash_t color_t; - memset (&color_t, 0, sizeof (mhash_t)); + clib_memset (&color_t, 0, sizeof (mhash_t)); mhash_init (&color_t, sizeof (u32), sizeof (ip46_address_t)); mhash_set_mem (&sm->sr_policies_c2e2eclabel_hash, &color, (uword *) & color_t, NULL); @@ -391,7 +391,7 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id, mpls_sr_policy_t *sr_policy = 0; uword *p = 0; - memset (&key, 0, sizeof (sr_mpls_steering_key_t)); + clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t)); if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6) return -1; @@ -438,7 +438,7 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id, /* Create a new steering policy */ pool_get (sm->steer_policies, steer_pl); - memset (steer_pl, 0, sizeof (*steer_pl)); + clib_memset (steer_pl, 0, sizeof (*steer_pl)); clib_memcpy (&steer_pl->classify.prefix, prefix, sizeof (ip46_address_t)); clib_memcpy (&steer_pl->next_hop, next_hop, sizeof (ip46_address_t)); steer_pl->nh_type = nh_type; @@ -553,7 +553,7 @@ sr_mpls_steering_policy_del (ip46_address_t * prefix, u32 mask_width, fib_prefix_t pfx = { 0 }; uword *p = 0; - memset (&key, 0, sizeof (sr_mpls_steering_key_t)); + clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t)); /* Compute the steer policy key */ if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6) @@ -673,8 +673,8 @@ sr_mpls_steer_policy_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 sr_policy_set = 0; - memset (&prefix, 0, sizeof (ip46_address_t)); - memset (&nh, 0, sizeof (ip46_address_t)); + clib_memset (&prefix, 0, sizeof (ip46_address_t)); + clib_memset (&nh, 0, sizeof (ip46_address_t)); int rv; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) diff --git a/src/vnet/srp/interface.c b/src/vnet/srp/interface.c index bac2e75b1e9..b418ec28229 100644 --- a/src/vnet/srp/interface.c +++ b/src/vnet/srp/interface.c @@ -72,7 +72,7 @@ srp_build_rewrite (vnet_main_t * vnm, if (dst_address) clib_memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.dst_address)); else - memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */ + clib_memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */ h->ethernet.type = clib_host_to_net_u16 (type); @@ -128,7 +128,7 @@ static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redi else { pool_get (sm->interface_pool, si); - memset (si, 0, sizeof (si[0])); + clib_memset (si, 0, sizeof (si[0])); } for (s = 0; s < SRP_N_SIDE; s++) { @@ -330,7 +330,7 @@ create_simulated_srp_interfaces (vlib_main_t * vm, if (! unformat_user (input, unformat_ethernet_address, &address)) { - memset (address, 0, sizeof (address)); + clib_memset (address, 0, sizeof (address)); address[0] = 0xde; address[1] = 0xad; address[5] = instance; diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c index 25cf0c07554..7cbc71b39ae 100644 --- a/src/vnet/srp/node.c +++ b/src/vnet/srp/node.c @@ -580,7 +580,7 @@ static void init_ips_packet (srp_interface_t * si, srp_ring_type_t tx_ring, srp_ips_header_t * i) { - memset (i, 0, sizeof (i[0])); + clib_memset (i, 0, sizeof (i[0])); i->srp.ttl = 1; i->srp.is_inner_ring = tx_ring; diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c index c37923f7b01..46fb8293c64 100644 --- a/src/vnet/srv6/sr_api.c +++ b/src/vnet/srv6/sr_api.c @@ -71,7 +71,7 @@ static void vl_api_sr_localsid_add_del_t_handler ip46_address_t prefix; - memset (&prefix, 0, sizeof (ip46_address_t)); + clib_memset (&prefix, 0, sizeof (ip46_address_t)); if ((mp->nh_addr4[0] | mp->nh_addr4[1] | mp-> nh_addr4[2] | mp->nh_addr4[3]) != 0) memcpy (&prefix.ip4, mp->nh_addr4, sizeof (prefix.ip4)); @@ -210,7 +210,7 @@ static void send_sr_localsid_details vl_api_sr_localsids_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 = ntohs (VL_API_SR_LOCALSIDS_DETAILS); clib_memcpy (rmp->addr.addr, &t->localsid, sizeof (ip6_address_t)); rmp->end_psp = t->end_psp; @@ -261,9 +261,10 @@ static void send_sr_policies_details rmp = vl_msg_api_alloc (sizeof (*rmp) + vec_len (t->segments_lists) * sizeof (vl_api_srv6_sid_list_t)); - memset (rmp, 0, - (sizeof (*rmp) + - vec_len (t->segments_lists) * sizeof (vl_api_srv6_sid_list_t))); + clib_memset (rmp, 0, + (sizeof (*rmp) + + vec_len (t->segments_lists) * + sizeof (vl_api_srv6_sid_list_t))); rmp->_vl_msg_id = ntohs (VL_API_SR_POLICIES_DETAILS); clib_memcpy (rmp->bsid.addr, &t->bsid, sizeof (ip6_address_t)); @@ -313,7 +314,7 @@ static void send_sr_steering_pol_details ip6_sr_main_t *sm = &sr_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_SR_STEERING_POL_DETAILS); //Get the SR policy BSID diff --git a/src/vnet/srv6/sr_localsid.c b/src/vnet/srv6/sr_localsid.c index 58fdbfd551b..7aeb1b680b2 100755 --- a/src/vnet/srv6/sr_localsid.c +++ b/src/vnet/srv6/sr_localsid.c @@ -146,7 +146,7 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr, /* Create a new localsid registry */ pool_get (sm->localsids, ls); - memset (ls, 0, sizeof (*ls)); + clib_memset (ls, 0, sizeof (*ls)); clib_memcpy (&ls->localsid, localsid_addr, sizeof (ip6_address_t)); ls->end_psp = end_psp; @@ -276,7 +276,7 @@ sr_cli_localsid_command_fn (vlib_main_t * vm, unformat_input_t * input, int rv; - memset (&resulting_address, 0, sizeof (ip6_address_t)); + clib_memset (&resulting_address, 0, sizeof (ip6_address_t)); ip46_address_reset (&next_hop); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) @@ -1549,7 +1549,7 @@ sr_localsid_register_function (vlib_main_t * vm, u8 * fn_name, plugin - sm->plugin_functions); } - memset (plugin, 0, sizeof (*plugin)); + clib_memset (plugin, 0, sizeof (*plugin)); plugin->sr_localsid_function_number = (plugin - sm->plugin_functions); plugin->sr_localsid_function_number += SR_BEHAVIOR_LAST; diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c index 62ce224cd8e..c80b9c4505a 100755 --- a/src/vnet/srv6/sr_policy_rewrite.c +++ b/src/vnet/srv6/sr_policy_rewrite.c @@ -301,7 +301,7 @@ create_sl (ip6_sr_policy_t * sr_policy, ip6_address_t * sl, u32 weight, ip6_sr_sl_t *segment_list; pool_get (sm->sid_lists, segment_list); - memset (segment_list, 0, sizeof (*segment_list)); + clib_memset (segment_list, 0, sizeof (*segment_list)); vec_add1 (sr_policy->segments_lists, segment_list - sm->sid_lists); @@ -588,7 +588,7 @@ sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments, /* Add an SR policy object */ pool_get (sm->sr_policies, sr_policy); - memset (sr_policy, 0, sizeof (*sr_policy)); + clib_memset (sr_policy, 0, sizeof (*sr_policy)); clib_memcpy (&sr_policy->bsid, bsid, sizeof (ip6_address_t)); sr_policy->type = behavior; sr_policy->fib_table = (fib_table != (u32) ~ 0 ? fib_table : 0); //Is default FIB 0 ? diff --git a/src/vnet/srv6/sr_steering.c b/src/vnet/srv6/sr_steering.c index a888fea9fda..d44bbae576f 100755 --- a/src/vnet/srv6/sr_steering.c +++ b/src/vnet/srv6/sr_steering.c @@ -69,7 +69,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, ip6_sr_policy_t *sr_policy = 0; uword *p = 0; - memset (&key, 0, sizeof (sr_steering_key_t)); + clib_memset (&key, 0, sizeof (sr_steering_key_t)); /* Compute the steer policy key */ if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6) @@ -245,7 +245,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, /* Create a new steering policy */ pool_get (sm->steer_policies, steer_pl); - memset (steer_pl, 0, sizeof (*steer_pl)); + clib_memset (steer_pl, 0, sizeof (*steer_pl)); if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6) { @@ -379,7 +379,7 @@ sr_steer_policy_command_fn (vlib_main_t * vm, unformat_input_t * input, u8 sr_policy_set = 0; - memset (&prefix, 0, sizeof (ip46_address_t)); + clib_memset (&prefix, 0, sizeof (ip46_address_t)); int rv; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 5378de1c1da..e32b5c417ae 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -77,7 +77,7 @@ tcp_connection_bind (u32 session_index, transport_endpoint_t * lcl) void *iface_ip; pool_get (tm->listener_pool, listener); - memset (listener, 0, sizeof (*listener)); + clib_memset (listener, 0, sizeof (*listener)); listener->c_c_index = listener - tm->listener_pool; listener->c_lcl_port = lcl->port; @@ -121,7 +121,7 @@ tcp_connection_unbind (u32 listener_index) /* Poison the entry */ if (CLIB_DEBUG > 0) - memset (tc, 0xFA, sizeof (*tc)); + clib_memset (tc, 0xFA, sizeof (*tc)); pool_put_index (tm->listener_pool, listener_index); } @@ -153,7 +153,7 @@ tcp_half_open_connection_del (tcp_connection_t * tc) clib_spinlock_lock_if_init (&tm->half_open_lock); pool_put_index (tm->half_open_connections, tc->c_c_index); if (CLIB_DEBUG) - memset (tc, 0xFA, sizeof (*tc)); + clib_memset (tc, 0xFA, sizeof (*tc)); clib_spinlock_unlock_if_init (&tm->half_open_lock); } @@ -185,7 +185,7 @@ tcp_half_open_connection_new (void) tcp_connection_t *tc = 0; ASSERT (vlib_get_thread_index () == 0); pool_get (tm->half_open_connections, tc); - memset (tc, 0, sizeof (*tc)); + clib_memset (tc, 0, sizeof (*tc)); tc->c_c_index = tc - tm->half_open_connections; return tc; } @@ -225,7 +225,7 @@ tcp_connection_cleanup (tcp_connection_t * tc) /* Poison the entry */ if (CLIB_DEBUG > 0) - memset (tc, 0xFA, sizeof (*tc)); + clib_memset (tc, 0xFA, sizeof (*tc)); pool_put (tm->connections[thread_index], tc); } } @@ -252,7 +252,7 @@ tcp_connection_new (u8 thread_index) tcp_connection_t *tc; pool_get (tm->connections[thread_index], tc); - memset (tc, 0, sizeof (*tc)); + clib_memset (tc, 0, sizeof (*tc)); tc->c_c_index = tc - tm->connections[thread_index]; tc->c_thread_index = thread_index; return tc; @@ -435,7 +435,7 @@ tcp_connection_select_lb_bucket (tcp_connection_t * tc, const dpo_id_t * dpo, if (tc->c_is_ip4) { ip4_tcp_hdr_t hdr; - memset (&hdr, 0, sizeof (hdr)); + clib_memset (&hdr, 0, sizeof (hdr)); hdr.ip.protocol = IP_PROTOCOL_TCP; hdr.ip.address_pair.src.as_u32 = tc->c_lcl_ip.ip4.as_u32; hdr.ip.address_pair.dst.as_u32 = tc->c_rmt_ip.ip4.as_u32; @@ -446,7 +446,7 @@ tcp_connection_select_lb_bucket (tcp_connection_t * tc, const dpo_id_t * dpo, else { ip6_tcp_hdr_t hdr; - memset (&hdr, 0, sizeof (hdr)); + clib_memset (&hdr, 0, sizeof (hdr)); hdr.ip.protocol = IP_PROTOCOL_TCP; clib_memcpy (&hdr.ip.src_address, &tc->c_lcl_ip.ip6, sizeof (ip6_address_t)); @@ -1453,7 +1453,7 @@ tcp_configure_v4_source_address_range (vlib_main_t * vm, ip4_address_t * hi_addr, u32 fib_index, int is_del); - memset (&prefix, 0, sizeof (prefix)); + clib_memset (&prefix, 0, sizeof (prefix)); fib_index = fib_table_find (FIB_PROTOCOL_IP4, table_id); @@ -1538,7 +1538,7 @@ tcp_configure_v6_source_address_range (vlib_main_t * vm, fib_node_index_t fei; u32 sw_if_index; - memset (&prefix, 0, sizeof (prefix)); + clib_memset (&prefix, 0, sizeof (prefix)); fib_index = fib_table_find (FIB_PROTOCOL_IP6, table_id); @@ -1763,7 +1763,7 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose) if (!tc) return s; - memset (dummy_tc, 0, sizeof (*dummy_tc)); + clib_memset (dummy_tc, 0, sizeof (*dummy_tc)); tcp_connection_timers_init (dummy_tc); scoreboard_init (&dummy_tc->sack_sb); dummy_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK; diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 87bacc24354..4e3987eeaed 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -622,7 +622,7 @@ scoreboard_remove_hole (sack_scoreboard_t * sb, sack_scoreboard_hole_t * hole) /* Poison the entry */ if (CLIB_DEBUG > 0) - memset (hole, 0xfe, sizeof (*hole)); + clib_memset (hole, 0xfe, sizeof (*hole)); pool_put (sb->holes, hole); } @@ -635,7 +635,7 @@ scoreboard_insert_hole (sack_scoreboard_t * sb, u32 prev_index, u32 hole_index; pool_get (sb->holes, hole); - memset (hole, 0, sizeof (*hole)); + clib_memset (hole, 0, sizeof (*hole)); hole->start = start; hole->end = end; diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 7d7c32ad210..ed1c641d80f 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -599,7 +599,7 @@ tcp_make_syn (tcp_connection_t * tc, vlib_buffer_t * b) initial_wnd = tcp_initial_window_to_advertise (tc); /* Make and write options */ - memset (&snd_opts, 0, sizeof (snd_opts)); + clib_memset (&snd_opts, 0, sizeof (snd_opts)); tcp_opts_len = tcp_make_syn_options (&snd_opts, tc->rcv_wscale); tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t); @@ -622,7 +622,7 @@ tcp_make_synack (tcp_connection_t * tc, vlib_buffer_t * b) tcp_header_t *th; u16 initial_wnd; - memset (snd_opts, 0, sizeof (*snd_opts)); + clib_memset (snd_opts, 0, sizeof (*snd_opts)); tcp_reuse_buffer (vm, b); initial_wnd = tcp_initial_window_to_advertise (tc); diff --git a/src/vnet/tcp/tcp_syn_filter4.c b/src/vnet/tcp/tcp_syn_filter4.c index 9b2a8ac7c87..6ec39a7bbeb 100644 --- a/src/vnet/tcp/tcp_syn_filter4.c +++ b/src/vnet/tcp/tcp_syn_filter4.c @@ -101,7 +101,7 @@ syn_filter4_node_fn (vlib_main_t * vm, if (now > rt->next_reset) { - memset (rt->syn_counts, 0, vec_len (rt->syn_counts)); + clib_memset (rt->syn_counts, 0, vec_len (rt->syn_counts)); rt->next_reset = now + rt->reset_interval; } diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index f4814a3ce21..3eecfe9b4b5 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -96,7 +96,7 @@ tls_listener_ctx_alloc (void) tls_ctx_t *ctx; pool_get (tm->listener_ctx_pool, ctx); - memset (ctx, 0, sizeof (*ctx)); + clib_memset (ctx, 0, sizeof (*ctx)); return ctx - tm->listener_ctx_pool; } @@ -144,7 +144,7 @@ tls_ctx_half_open_alloc (void) ctx_index = ctx - tm->half_open_ctx_pool; clib_rwlock_reader_unlock (&tm->half_open_rwlock); } - memset (ctx, 0, sizeof (*ctx)); + clib_memset (ctx, 0, sizeof (*ctx)); return ctx_index; } @@ -598,7 +598,7 @@ tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep) } sep->transport_proto = TRANSPORT_PROTO_TCP; - memset (args, 0, sizeof (*args)); + clib_memset (args, 0, sizeof (*args)); args->app_index = tm->app_index; args->sep_ext = *sep; if (vnet_bind (args)) @@ -762,8 +762,8 @@ tls_init (vlib_main_t * vm) num_threads = 1 /* main thread */ + vtm->n_threads; - memset (a, 0, sizeof (*a)); - memset (options, 0, sizeof (options)); + clib_memset (a, 0, sizeof (*a)); + clib_memset (options, 0, sizeof (options)); a->session_cb_vft = &tls_app_cb_vft; a->api_client_index = APP_INVALID_INDEX; diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 96189364b34..85a22a982b3 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -45,7 +45,7 @@ udp_connection_alloc (u32 thread_index) pool_get_aligned (um->connections[thread_index], uc, CLIB_CACHE_LINE_BYTES); } - memset (uc, 0, sizeof (*uc)); + clib_memset (uc, 0, sizeof (*uc)); uc->c_c_index = uc - um->connections[thread_index]; uc->c_thread_index = thread_index; uc->c_proto = TRANSPORT_PROTO_UDP; @@ -58,7 +58,7 @@ udp_connection_free (udp_connection_t * uc) { pool_put (udp_main.connections[uc->c_thread_index], uc); if (CLIB_DEBUG) - memset (uc, 0xFA, sizeof (*uc)); + clib_memset (uc, 0xFA, sizeof (*uc)); } u32 @@ -76,7 +76,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl) return -1; pool_get (um->listener_pool, listener); - memset (listener, 0, sizeof (udp_connection_t)); + clib_memset (listener, 0, sizeof (udp_connection_t)); listener->c_lcl_port = lcl->port; listener->c_c_index = listener - um->listener_pool; diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c index 05840ec4bc9..63186761181 100644 --- a/src/vnet/udp/udp_api.c +++ b/src/vnet/udp/udp_api.c @@ -51,7 +51,7 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg, vl_api_udp_encap_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 = ntohs (VL_API_UDP_ENCAP_DETAILS); mp->context = context; diff --git a/src/vnet/udp/udp_local.c b/src/vnet/udp/udp_local.c index f0d95304f13..bb7305d8d03 100644 --- a/src/vnet/udp/udp_local.c +++ b/src/vnet/udp/udp_local.c @@ -583,7 +583,7 @@ unformat_udp_header (unformat_input_t * input, va_list * args) udp = p; } - memset (udp, 0, sizeof (udp[0])); + clib_memset (udp, 0, sizeof (udp[0])); if (unformat (input, "src-port %d dst-port %d", &src_port, &dst_port)) { udp->src_port = clib_host_to_net_u16 (src_port); diff --git a/src/vnet/unix/pcap.c b/src/vnet/unix/pcap.c index e91b8792c2a..3c9ce314d9c 100644 --- a/src/vnet/unix/pcap.c +++ b/src/vnet/unix/pcap.c @@ -113,7 +113,7 @@ pcap_write (pcap_main_t * pm) clib_spinlock_init (&pm->lock); /* Write file header. */ - memset (&fh, 0, sizeof (fh)); + clib_memset (&fh, 0, sizeof (fh)); fh.magic = 0xa1b2c3d4; fh.major_version = 2; fh.minor_version = 4; diff --git a/src/vnet/unix/tap_api.c b/src/vnet/unix/tap_api.c index 026a9632eb8..8437c6a270b 100644 --- a/src/vnet/unix/tap_api.c +++ b/src/vnet/unix/tap_api.c @@ -65,7 +65,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_sw_interface_event_t *mp; 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_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (sw_if_index); @@ -87,7 +87,7 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp) u8 *tag; vnet_tap_connect_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->intfc_name = mp->tap_name; if (!mp->use_random_mac) @@ -141,7 +141,7 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp) vlib_main_t *vm = vlib_get_main (); vnet_tap_connect_args_t _a, *ap = &_a; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->orig_sw_if_index = ntohl (mp->sw_if_index); ap->intfc_name = mp->tap_name; @@ -206,7 +206,7 @@ send_sw_interface_tap_details (vpe_api_main_t * am, { vl_api_sw_interface_tap_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 = ntohs (VL_API_SW_INTERFACE_TAP_DETAILS); mp->sw_if_index = ntohl (tap_if->sw_if_index); strncpy ((char *) mp->dev_name, diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c index 00f093eb067..d183c3a9ea8 100644 --- a/src/vnet/unix/tapcli.c +++ b/src/vnet/unix/tapcli.c @@ -874,7 +874,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap) if ((dev_net_tun_fd = open ("/dev/net/tun", O_RDWR)) < 0) return VNET_API_ERROR_SYSCALL_ERROR_1; - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name) - 1); ifr.ifr_flags = flags; if (ioctl (dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0) @@ -895,7 +895,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap) struct ifreq ifr; struct sockaddr_ll sll; - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name) - 1); if (ioctl (dev_tap_fd, SIOCGIFINDEX, &ifr) < 0) @@ -905,7 +905,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap) } /* Bind the provisioning socket to the interface. */ - memset (&sll, 0, sizeof (sll)); + clib_memset (&sll, 0, sizeof (sll)); sll.sll_family = AF_PACKET; sll.sll_ifindex = ifr.ifr_ifindex; sll.sll_protocol = htons (ETH_P_ALL); @@ -954,7 +954,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap) /* ip4: mask defaults to /24 */ u32 mask = clib_host_to_net_u32 (0xFFFFFF00); - memset (&sin, 0, sizeof (sin)); + clib_memset (&sin, 0, sizeof (sin)); sin.sin_family = AF_INET; /* sin.sin_port = 0; */ sin.sin_addr.s_addr = ap->ip4_address->as_u32; @@ -998,7 +998,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap) goto error; } - memset (&ifr2, 0, sizeof (ifr)); + clib_memset (&ifr2, 0, sizeof (ifr)); strncpy (ifr2.ifr_name, (char *) ap->intfc_name, sizeof (ifr2.ifr_name) - 1); if (ioctl (sockfd6, SIOCGIFINDEX, &ifr2) < 0) @@ -1316,7 +1316,7 @@ tap_modify_command_fn (vlib_main_t * vm, user_hwaddr = 1; - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->orig_sw_if_index = sw_if_index; ap->intfc_name = intfc_name; ap->sw_if_indexp = &new_sw_if_index; @@ -1418,7 +1418,7 @@ tap_connect_command_fn (vlib_main_t * vm, goto done; } - memset (ap, 0, sizeof (*ap)); + clib_memset (ap, 0, sizeof (*ap)); ap->intfc_name = intfc_name; ap->hwaddr_arg = hwaddr_arg; diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c index 4a9bd46c31c..5f2259269f3 100644 --- a/src/vnet/unix/tuntap.c +++ b/src/vnet/unix/tuntap.c @@ -445,7 +445,7 @@ tuntap_exit (vlib_main_t * vm) if (sfd < 0) clib_unix_warning ("provisioning socket"); - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1); /* get flags, modify to bring down interface... */ @@ -535,7 +535,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input) goto done; } - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1); ifr.ifr_flags = flags; if (ioctl (tm->dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0) @@ -563,7 +563,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input) struct ifreq ifr; struct sockaddr_ll sll; - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1); if (ioctl (tm->dev_tap_fd, SIOCGIFINDEX, &ifr) < 0) { @@ -572,7 +572,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input) } /* Bind the provisioning socket to the interface. */ - memset (&sll, 0, sizeof (sll)); + clib_memset (&sll, 0, sizeof (sll)); sll.sll_family = AF_PACKET; sll.sll_ifindex = ifr.ifr_ifindex; sll.sll_protocol = htons (ETH_P_ALL); @@ -719,7 +719,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im, return; /** See if we already know about this subif */ - memset (&subif_addr, 0, sizeof (subif_addr)); + clib_memset (&subif_addr, 0, sizeof (subif_addr)); subif_addr.sw_if_index = sw_if_index; clib_memcpy (&subif_addr.addr, address, sizeof (*address)); @@ -735,7 +735,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im, } /* Use subif pool index to select alias device. */ - memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr, 0, sizeof (ifr)); snprintf (ifr.ifr_name, sizeof (ifr.ifr_name), "%s:%d", tm->tun_name, (int) (ap - tm->subifs)); @@ -835,7 +835,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im, return; /* See if we already know about this subif */ - memset (&subif_addr, 0, sizeof (subif_addr)); + clib_memset (&subif_addr, 0, sizeof (subif_addr)); subif_addr.sw_if_index = sw_if_index; subif_addr.is_v6 = 1; clib_memcpy (&subif_addr.addr, address, sizeof (*address)); @@ -852,8 +852,8 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im, } /* Use subif pool index to select alias device. */ - memset (&ifr, 0, sizeof (ifr)); - memset (&ifr6, 0, sizeof (ifr6)); + clib_memset (&ifr, 0, sizeof (ifr)); + clib_memset (&ifr6, 0, sizeof (ifr6)); snprintf (ifr.ifr_name, sizeof (ifr.ifr_name), "%s:%d", tm->tun_name, (int) (ap - tm->subifs)); diff --git a/src/vnet/util/radix.c b/src/vnet/util/radix.c index ff0b0f7bf38..82b0343348d 100644 --- a/src/vnet/util/radix.c +++ b/src/vnet/util/radix.c @@ -74,7 +74,7 @@ rm_alloc (void) { struct radix_mask *rm = clib_mem_alloc(sizeof(struct radix_mask)); - memset(rm, 0, sizeof(*rm)); + clib_memset(rm, 0, sizeof(*rm)); return (rm); } @@ -88,7 +88,7 @@ rm_free (struct radix_mask *rm) #define R_Malloc(p, t, n) \ { \ p = (t) clib_mem_alloc((unsigned int)(n)); \ - memset(p, 0, n); \ + clib_memset(p, 0, n); \ } #define Free(p) clib_mem_free((p)) #define log(a,b, c...) @@ -518,7 +518,7 @@ rn_addmask( return mask_rnhead->rnh_nodes; } if (m0 < last_zeroed) - memset(addmask_key + m0, 0, last_zeroed - m0); + clib_memset(addmask_key + m0, 0, last_zeroed - m0); *addmask_key = last_zeroed = mlen; x = rn_search(addmask_key, rn_masktop); if (memcmp(addmask_key, x->rn_key, mlen) != 0) @@ -528,7 +528,7 @@ rn_addmask( R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x)); if ((saved_x = x) == NULL) return NULL; - memset(x, 0, max_keylen + 2 * sizeof (*x)); + clib_memset(x, 0, max_keylen + 2 * sizeof (*x)); cp = netmask = (void *)(x + 2); memmove(x + 2, addmask_key, mlen); x = rn_insert(cp, mask_rnhead, &maskduplicated, x); @@ -586,7 +586,7 @@ rn_new_radix_mask( log(LOG_ERR, "Mask for route not entered\n"); return NULL; } - memset(m, 0, sizeof(*m)); + clib_memset(m, 0, sizeof(*m)); m->rm_b = tt->rn_b; m->rm_flags = tt->rn_flags; if (tt->rn_flags & RNF_NORMAL) @@ -1063,7 +1063,7 @@ rn_inithead0(struct radix_node_head *rnh, int off) struct radix_node *tt; struct radix_node *ttt; - memset(rnh, 0, sizeof(*rnh)); + clib_memset(rnh, 0, sizeof(*rnh)); t = rn_newpair(rn_zeros, off, rnh->rnh_nodes); ttt = rnh->rnh_nodes + 2; t->rn_r = ttt; @@ -1090,7 +1090,7 @@ rn_module_init (vlib_main_t * vm) if (rn_zeros == NULL) return (clib_error_return (0, "RN Zeros...")); - memset(rn_zeros, 0, 3 * max_keylen); + clib_memset(rn_zeros, 0, 3 * max_keylen); rn_ones = cp = rn_zeros + max_keylen; addmask_key = cplim = rn_ones + max_keylen; while (cp < cplim) diff --git a/src/vnet/util/throttle.h b/src/vnet/util/throttle.h index 97ebb2597b3..45d437cf471 100644 --- a/src/vnet/util/throttle.h +++ b/src/vnet/util/throttle.h @@ -42,7 +42,7 @@ throttle_seed (throttle_t * t, u32 thread_index, f64 time_now) if (time_now - t->last_seed_change_time[thread_index] > t->time) { (void) random_u32 (&t->seeds[thread_index]); - memset (t->bitmaps[thread_index], 0, THROTTLE_BITS / BITS (u8)); + clib_memset (t->bitmaps[thread_index], 0, THROTTLE_BITS / BITS (u8)); t->last_seed_change_time[thread_index] = time_now; } diff --git a/src/vnet/vxlan-gbp/decap.c b/src/vnet/vxlan-gbp/decap.c index 12097986af5..1602e940f3f 100644 --- a/src/vnet/vxlan-gbp/decap.c +++ b/src/vnet/vxlan-gbp/decap.c @@ -179,9 +179,9 @@ vxlan_gbp_input (vlib_main_t * vm, u32 thread_index = vlib_get_thread_index (); if (is_ip4) - memset (&last4, 0xff, sizeof last4); + clib_memset (&last4, 0xff, sizeof last4); else - memset (&last6, 0xff, sizeof last6); + clib_memset (&last6, 0xff, sizeof last6); u32 next_index = node->cached_next_index; diff --git a/src/vnet/vxlan-gbp/vxlan_gbp.c b/src/vnet/vxlan-gbp/vxlan_gbp.c index d01a16799ef..45e4fdc390c 100644 --- a/src/vnet/vxlan-gbp/vxlan_gbp.c +++ b/src/vnet/vxlan-gbp/vxlan_gbp.c @@ -230,7 +230,7 @@ vxlan_gbp_rewrite (vxlan_gbp_tunnel_t * t, bool is_ip6) vxlan_gbp_header_t *vxlan_gbp; /* Fixed portion of the (outer) ip header */ - memset (&h, 0, sizeof (h)); + clib_memset (&h, 0, sizeof (h)); if (!is_ip6) { ip4_header_t *ip = &h.h4.ip4; @@ -407,7 +407,7 @@ int vnet_vxlan_gbp_tunnel_add_del return VNET_API_ERROR_INVALID_DECAP_NEXT; pool_get_aligned (vxm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); dev_instance = t - vxm->tunnels; /* copy from arg structure */ diff --git a/src/vnet/vxlan-gbp/vxlan_gbp_api.c b/src/vnet/vxlan-gbp/vxlan_gbp_api.c index cf3f7fe9670..b7e6935b2f8 100644 --- a/src/vnet/vxlan-gbp/vxlan_gbp_api.c +++ b/src/vnet/vxlan-gbp/vxlan_gbp_api.c @@ -131,7 +131,7 @@ static void send_vxlan_gbp_tunnel_details IP46_TYPE_IP4 : IP46_TYPE_IP6); 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_VXLAN_GBP_TUNNEL_DETAILS); ip_address_encode (&t->src, itype, &rmp->tunnel.src); diff --git a/src/vnet/vxlan-gpe/decap.c b/src/vnet/vxlan-gpe/decap.c index 975323df5da..9c429294d67 100644 --- a/src/vnet/vxlan-gpe/decap.c +++ b/src/vnet/vxlan-gpe/decap.c @@ -121,9 +121,9 @@ vxlan_gpe_input (vlib_main_t * vm, u32 stats_sw_if_index, stats_n_packets, stats_n_bytes; if (is_ip4) - memset (&last_key4, 0xff, sizeof (last_key4)); + clib_memset (&last_key4, 0xff, sizeof (last_key4)); 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/vnet/vxlan-gpe/vxlan_gpe.c b/src/vnet/vxlan-gpe/vxlan_gpe.c index ac3e1784009..c14cc734fb3 100644 --- a/src/vnet/vxlan-gpe/vxlan_gpe.c +++ b/src/vnet/vxlan-gpe/vxlan_gpe.c @@ -509,7 +509,7 @@ int vnet_vxlan_gpe_add_del_tunnel return VNET_API_ERROR_TUNNEL_EXIST; pool_get_aligned (ngm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); /* copy from arg structure */ /* *INDENT-OFF* */ @@ -914,7 +914,7 @@ vxlan_gpe_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/vnet/vxlan-gpe/vxlan_gpe_api.c b/src/vnet/vxlan-gpe/vxlan_gpe_api.c index e23b2fed033..22a28a73a77 100644 --- a/src/vnet/vxlan-gpe/vxlan_gpe_api.c +++ b/src/vnet/vxlan-gpe/vxlan_gpe_api.c @@ -112,7 +112,7 @@ static void rv = VNET_API_ERROR_SAME_SRC_DST; goto out; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = mp->is_add; a->is_ip6 = mp->is_ipv6; @@ -152,7 +152,7 @@ static void send_vxlan_gpe_tunnel_details u8 is_ipv6 = !(t->flags & VXLAN_GPE_TUNNEL_IS_IPV4); 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_VXLAN_GPE_TUNNEL_DETAILS); if (is_ipv6) { diff --git a/src/vnet/vxlan/decap.c b/src/vnet/vxlan/decap.c index b84a9b6eb56..efd718994c9 100644 --- a/src/vnet/vxlan/decap.c +++ b/src/vnet/vxlan/decap.c @@ -204,9 +204,9 @@ vxlan_input (vlib_main_t * vm, u32 thread_index = vlib_get_thread_index (); if (is_ip4) - memset (&last4, 0xff, sizeof last4); + clib_memset (&last4, 0xff, sizeof last4); else - memset (&last6, 0xff, sizeof last6); + clib_memset (&last6, 0xff, sizeof last6); u32 *from = vlib_frame_vector_args (from_frame); u32 n_left_from = from_frame->n_vectors; diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index 4276d6689ac..a26428673c5 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -241,7 +241,7 @@ vxlan_rewrite (vxlan_tunnel_t * t, bool is_ip6) vxlan_header_t *vxlan; /* Fixed portion of the (outer) ip header */ - memset (&h, 0, sizeof (h)); + clib_memset (&h, 0, sizeof (h)); if (!is_ip6) { ip4_header_t *ip = &h.h4.ip4; @@ -419,7 +419,7 @@ int vnet_vxlan_add_del_tunnel vxlan_tunnel_t *t; pool_get_aligned (vxm->tunnels, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); dev_instance = t - vxm->tunnels; /* copy from arg structure */ diff --git a/src/vnet/vxlan/vxlan_api.c b/src/vnet/vxlan/vxlan_api.c index 512cc896650..2cec93c7687 100644 --- a/src/vnet/vxlan/vxlan_api.c +++ b/src/vnet/vxlan/vxlan_api.c @@ -180,7 +180,7 @@ static void send_vxlan_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_VXLAN_TUNNEL_DETAILS); if (is_ipv6) { |