diff options
author | 2016-03-13 02:22:06 +0100 | |
---|---|---|
committer | 2016-04-22 17:29:47 +0200 | |
commit | f1213b82771ce929c076339c24a777cfd59690e6 (patch) | |
tree | 3c74305e8848047d8ccd1228ee511d57cbf1b1a6 /vnet | |
parent | 2b836cf4d1e4e59ca34229a9fdf49d79216da20e (diff) |
Add clib_memcpy macro based on DPDK rte_memcpy implementation
Change-Id: I22cb443c4bd0bf298abb6f06e8e4ca65a44a2854
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
94 files changed, 444 insertions, 455 deletions
diff --git a/vnet/test/lisp-cp/test_cp_serdes.c b/vnet/test/lisp-cp/test_cp_serdes.c index 9e89dd91..d77c294d 100644 --- a/vnet/test/lisp-cp/test_cp_serdes.c +++ b/vnet/test/lisp-cp/test_cp_serdes.c @@ -154,7 +154,7 @@ static clib_error_t * test_lisp_msg_parse_mapping_record () 0xaa, 0xbb, 0xcc, 0xdd, /* Loator */ }; b->current_length = buff_len; - memcpy(b->data, map_reply_records, sizeof(map_reply_records)); + clib_memcpy(b->data, map_reply_records, sizeof(map_reply_records)); lisp_msg_parse_mapping_record (b, &eid, &locs, &probed); _assert(vec_len (locs) == 1); diff --git a/vnet/test/lisp-cp/test_lisp_types.c b/vnet/test/lisp-cp/test_lisp_types.c index db12f18e..efd87222 100644 --- a/vnet/test/lisp-cp/test_lisp_types.c +++ b/vnet/test/lisp-cp/test_lisp_types.c @@ -94,7 +94,7 @@ static clib_error_t * test_format_unformat_gid_address (void) gid_address_ippref_len(gid_addr) = 64; ip_prefix_version(&gid_addr->ippref) = IP6; u8 ipv6[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; - memcpy(gid_addr->ippref.addr.ip.v6.as_u8, ipv6, sizeof(ipv6)); + clib_memcpy(gid_addr->ippref.addr.ip.v6.as_u8, ipv6, sizeof(ipv6)); s = format(0, "%U", format_gid_address, gid_addr); vec_add1(s, 0); diff --git a/vnet/vnet/cdp/cdp_node.c b/vnet/vnet/cdp/cdp_node.c index a826b127..7411ebeb 100644 --- a/vnet/vnet/cdp/cdp_node.c +++ b/vnet/vnet/cdp/cdp_node.c @@ -86,7 +86,7 @@ cdp_node_fn (vlib_main_t * vm, len = (b0->current_length < sizeof (t0->data)) ? b0->current_length : sizeof (t0->data); t0->len = len; - memcpy (t0->data, vlib_buffer_get_current (b0), len); + clib_memcpy (t0->data, vlib_buffer_get_current (b0), len); } /* push this pkt to the next graph node, always error-drop */ vlib_set_next_frame_buffer (vm, node, next0, bi0); diff --git a/vnet/vnet/cdp/cdp_periodic.c b/vnet/vnet/cdp/cdp_periodic.c index dc631b35..14c45435 100644 --- a/vnet/vnet/cdp/cdp_periodic.c +++ b/vnet/vnet/cdp/cdp_periodic.c @@ -34,7 +34,7 @@ static void add_device_name_tlv (vnet_hw_interface_t *hw, u8 **t0p) t->t = htons(CDP_TLV_device_name); t->l = htons(3 + sizeof (*t)); - memcpy (&t->v, "VPP", 3); + clib_memcpy (&t->v, "VPP", 3); *t0p += ntohs(t->l); } @@ -45,7 +45,7 @@ static void add_port_id_tlv (vnet_hw_interface_t *hw, u8 **t0p) t->t = htons(CDP_TLV_port_id); t->l = htons(vec_len(hw->name) + sizeof (*t)); - memcpy (&t->v, hw->name, vec_len (hw->name)); + clib_memcpy (&t->v, hw->name, vec_len (hw->name)); *t0p += ntohs(t->l); } @@ -55,7 +55,7 @@ static void add_version_tlv (vnet_hw_interface_t *hw, u8 **t0p) t->t = htons(CDP_TLV_version); t->l = htons(12 + sizeof (*t)); - memcpy (&t->v, "VPP Software", 12); + clib_memcpy (&t->v, "VPP Software", 12); *t0p += ntohs(t->l); } @@ -65,7 +65,7 @@ static void add_platform_tlv (vnet_hw_interface_t *hw, u8 **t0p) t->t = htons(CDP_TLV_platform); t->l = htons(2 + sizeof (*t)); - memcpy (&t->v, "SW", 2); + clib_memcpy (&t->v, "SW", 2); *t0p += ntohs(t->l); } @@ -78,7 +78,7 @@ static void add_capability_tlv (vnet_hw_interface_t *hw, u8 **t0p) t->l = htons(4 + sizeof (*t)); capabilities = CDP_ROUTER_DEVICE; capabilities = htonl (capabilities); - memcpy (&t->v, &capabilities, sizeof (capabilities)); + clib_memcpy (&t->v, &capabilities, sizeof (capabilities)); *t0p += ntohs(t->l); } @@ -122,7 +122,7 @@ send_ethernet_hello (cdp_main_t *cm, cdp_neighbor_t *n, int count) /* Add the interface's ethernet source address */ hw = vnet_get_sup_hw_interface (vnm, n->sw_if_index); - memcpy (h0->ethernet.src_address, hw->hw_address, + clib_memcpy (h0->ethernet.src_address, hw->hw_address, vec_len (hw->hw_address)); t0 = (u8 *) &h0->cdp.data; @@ -250,7 +250,7 @@ send_srp_hello (cdp_main_t *cm, cdp_neighbor_t *n, int count) add_tlvs (cm, hw, &t0); /* Add the interface's ethernet source address */ - memcpy (h0->ethernet.src_address, hw->hw_address, + clib_memcpy (h0->ethernet.src_address, hw->hw_address, vec_len (hw->hw_address)); /* add the cdp packet checksum */ diff --git a/vnet/vnet/classify/vnet_classify.c b/vnet/vnet/classify/vnet_classify.c index 2a777019..11d3714c 100644 --- a/vnet/vnet/classify/vnet_classify.c +++ b/vnet/vnet/classify/vnet_classify.c @@ -110,7 +110,7 @@ vnet_classify_new_table (vnet_classify_main_t *cm, memset(t, 0, sizeof (*t)); vec_validate_aligned (t->mask, match_n_vectors - 1, sizeof(u32x4)); - memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4)); + clib_memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4)); t->next_table_index = ~0; t->nbuckets = nbuckets; @@ -292,7 +292,7 @@ static inline void make_working_copy { #define _(size) \ case size: \ - memcpy (working_copy, v, \ + clib_memcpy (working_copy, v, \ sizeof (vnet_classify_entry_##size##_t) \ * (1<<b->log2_pages) \ * (t->entries_per_page)); \ @@ -348,7 +348,7 @@ split_and_rehash (vnet_classify_table_t * t, if (vnet_classify_entry_is_free (new_v)) { - memcpy (new_v, v, sizeof (vnet_classify_entry_t) + clib_memcpy (new_v, v, sizeof (vnet_classify_entry_t) + (t->match_n_vectors * sizeof (u32x4))); new_v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE); goto doublebreak; @@ -405,7 +405,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t, } v = vnet_classify_entry_alloc (t, 0 /* new_log2_pages */); - memcpy (v, add_v, sizeof (vnet_classify_entry_t) + + clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) + t->match_n_vectors * sizeof (u32x4)); v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE); @@ -436,7 +436,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t, if (!memcmp (v->key, add_v->key, t->match_n_vectors * sizeof (u32x4))) { - memcpy (v, add_v, sizeof (vnet_classify_entry_t) + + clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) + t->match_n_vectors * sizeof(u32x4)); v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE); @@ -452,7 +452,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t, if (vnet_classify_entry_is_free (v)) { - memcpy (v, add_v, sizeof (vnet_classify_entry_t) + + clib_memcpy (v, add_v, sizeof (vnet_classify_entry_t) + t->match_n_vectors * sizeof(u32x4)); v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE); CLIB_MEMORY_BARRIER(); @@ -513,7 +513,7 @@ int vnet_classify_add_del (vnet_classify_table_t * t, if (vnet_classify_entry_is_free (new_v)) { - memcpy (new_v, add_v, sizeof (vnet_classify_entry_t) + + clib_memcpy (new_v, add_v, sizeof (vnet_classify_entry_t) + t->match_n_vectors * sizeof(u32x4)); new_v->flags &= ~(VNET_CLASSIFY_ENTRY_FREE); goto expand_ok; @@ -1464,10 +1464,10 @@ uword unformat_ip6_match (unformat_input_t * input, va_list * args) ip = (ip6_header_t *) match; if (src) - memcpy (&ip->src_address, &src_val, sizeof (ip->src_address)); + clib_memcpy (&ip->src_address, &src_val, sizeof (ip->src_address)); if (dst) - memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address)); + clib_memcpy (&ip->dst_address, &dst_val, sizeof (ip->dst_address)); if (proto) ip->protocol = proto_val; @@ -1584,10 +1584,10 @@ uword unformat_l2_match (unformat_input_t * input, va_list * args) vec_validate_aligned (match, len-1, sizeof(u32x4)); if (dst) - memcpy (match, dst_val, 6); + clib_memcpy (match, dst_val, 6); if (src) - memcpy (match + 6, src_val, 6); + clib_memcpy (match + 6, src_val, 6); if (tag2) { @@ -1723,7 +1723,7 @@ int vnet_classify_add_del_session (vnet_classify_main_t * cm, e->flags = 0; /* Copy key data, honoring skip_n_vectors */ - memcpy (&e->key, match + t->skip_n_vectors * sizeof (u32x4), + clib_memcpy (&e->key, match + t->skip_n_vectors * sizeof (u32x4), t->match_n_vectors * sizeof (u32x4)); /* Clear don't-care bits; likely when dynamically creating sessions */ diff --git a/vnet/vnet/config.c b/vnet/vnet/config.c index 9f98778f..d2bcdf7d 100644 --- a/vnet/vnet/config.c +++ b/vnet/vnet/config.c @@ -149,7 +149,7 @@ find_config_with_features (vlib_main_t * vm, /* First element in heap points back to pool index. */ d = vec_elt_at_index (cm->config_string_heap, c->config_string_heap_index); d[0] = c->index; - memcpy (d + 1, config_string, vec_bytes (config_string)); + clib_memcpy (d + 1, config_string, vec_bytes (config_string)); hash_set_mem (cm->config_string_hash, config_string, c->index); c->reference_count = 0; /* will be incremented by caller. */ diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c index 542e5bcb..20c61295 100644 --- a/vnet/vnet/devices/af_packet/af_packet.c +++ b/vnet/vnet/devices/af_packet/af_packet.c @@ -225,7 +225,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set) /*use configured or generate random MAC address */ if (hw_addr_set) - memcpy(hw_addr, hw_addr_set, 6); + clib_memcpy(hw_addr, hw_addr_set, 6); else { f64 now = vlib_time_now(vm); @@ -233,7 +233,7 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set) rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (hw_addr+2, &rnd, sizeof(rnd)); + clib_memcpy (hw_addr+2, &rnd, sizeof(rnd)); hw_addr[0] = 2; hw_addr[1] = 0xfe; } diff --git a/vnet/vnet/devices/af_packet/device.c b/vnet/vnet/devices/af_packet/device.c index fa43d7cd..f0e91487 100644 --- a/vnet/vnet/devices/af_packet/device.c +++ b/vnet/vnet/devices/af_packet/device.c @@ -106,7 +106,7 @@ af_packet_interface_tx (vlib_main_t * vm, { b0 = vlib_get_buffer (vm, bi); len = b0->current_length; - memcpy((u8 *) tph + TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + offset, + clib_memcpy((u8 *) tph + TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + offset, vlib_buffer_get_current(b0), len); offset += len; } diff --git a/vnet/vnet/devices/af_packet/node.c b/vnet/vnet/devices/af_packet/node.c index ceb89efa..b622a221 100644 --- a/vnet/vnet/devices/af_packet/node.c +++ b/vnet/vnet/devices/af_packet/node.c @@ -180,7 +180,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, /* copy data */ u32 bytes_to_copy = data_len > n_buffer_bytes ? n_buffer_bytes : data_len; b0->current_data = 0; - memcpy (vlib_buffer_get_current (b0), (u8 *) tph + tph->tp_mac + offset, bytes_to_copy); + clib_memcpy (vlib_buffer_get_current (b0), (u8 *) tph + tph->tp_mac + offset, bytes_to_copy); /* fill buffer header */ b0->clone_count = 0; @@ -222,7 +222,7 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node, tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr)); tr->next_index = next0; tr->hw_if_index = apif->hw_if_index; - memcpy(&tr->tph, tph, sizeof(struct tpacket2_hdr)); + clib_memcpy(&tr->tph, tph, sizeof(struct tpacket2_hdr)); } /* enque and take next packet */ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 03c8d2e4..9b742f0e 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -135,7 +135,7 @@ static struct rte_mbuf * dpdk_replicate_packet_mb (vlib_buffer_t * b) rte_pktmbuf_data_len (new_mb) = pkt_mb->data_len; copy_bytes = pkt_mb->data_len + RTE_PKTMBUF_HEADROOM; ASSERT(copy_bytes <= pkt_mb->buf_len); - memcpy(new_mb->buf_addr, pkt_mb->buf_addr, copy_bytes); + clib_memcpy(new_mb->buf_addr, pkt_mb->buf_addr, copy_bytes); prev_mb_next = &new_mb->next; pkt_mb = pkt_mb->next; @@ -165,9 +165,9 @@ dpdk_tx_trace_buffer (dpdk_main_t * dm, t0->queue_index = queue_id; t0->device_index = xd->device_index; t0->buffer_index = buffer_index; - memcpy (&t0->mb, mb, sizeof (t0->mb)); - memcpy (&t0->buffer, buffer, sizeof (buffer[0]) - sizeof (buffer->pre_data)); - memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data, + clib_memcpy (&t0->mb, mb, sizeof (t0->mb)); + clib_memcpy (&t0->buffer, buffer, sizeof (buffer[0]) - sizeof (buffer->pre_data)); + clib_memcpy (t0->buffer.pre_data, buffer->data + buffer->current_data, sizeof (t0->buffer.pre_data)); } @@ -841,8 +841,8 @@ static void dpdk_clear_hw_interface_counters (u32 instance) */ dpdk_update_counters (xd, vlib_time_now (dm->vlib_main)); - memcpy (&xd->last_cleared_stats, &xd->stats, sizeof(xd->stats)); - memcpy (xd->last_cleared_xstats, xd->xstats, + clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof(xd->stats)); + clib_memcpy (xd->last_cleared_xstats, xd->xstats, vec_len(xd->last_cleared_xstats) * sizeof(xd->last_cleared_xstats[0])); } @@ -1256,6 +1256,6 @@ dpdk_get_hw_interface_stats (u32 hw_if_index, struct rte_eth_stats* dest) dpdk_update_counters (xd, vlib_time_now (dm->vlib_main)); - memcpy(dest, &xd->stats, sizeof(xd->stats)); + clib_memcpy(dest, &xd->stats, sizeof(xd->stats)); return (0); } diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index bfe22795..af12d529 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -24,7 +24,6 @@ #include <rte_dev.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_tailq.h> #include <rte_eal.h> diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h index 54d38030..102a7618 100644 --- a/vnet/vnet/devices/dpdk/dpdk_priv.h +++ b/vnet/vnet/devices/dpdk/dpdk_priv.h @@ -183,7 +183,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now) if (xd->admin_up != 0xff) { xd->time_last_stats_update = now ? now : xd->time_last_stats_update; - memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats)); + clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats)); rte_eth_stats_get (xd->device_index, &xd->stats); /* maybe bump interface rx no buffer counter */ diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index de141a55..8f24e7b6 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -312,7 +312,7 @@ dpdk_lib_init (dpdk_main_t * dm) xd->cpu_socket = (i8) rte_eth_dev_socket_id(i); rte_eth_dev_info_get(i, &dev_info); - memcpy(&xd->tx_conf, &dev_info.default_txconf, + clib_memcpy(&xd->tx_conf, &dev_info.default_txconf, sizeof(struct rte_eth_txconf)); if (dm->no_multi_seg) { @@ -325,7 +325,7 @@ dpdk_lib_init (dpdk_main_t * dm) port_conf_template.rxmode.jumbo_frame = 1; } - memcpy(&xd->port_conf, &port_conf_template, sizeof(struct rte_eth_conf)); + clib_memcpy(&xd->port_conf, &port_conf_template, sizeof(struct rte_eth_conf)); xd->tx_q_used = clib_min(dev_info.max_tx_queues, tm->n_vlib_mains); @@ -520,7 +520,7 @@ dpdk_lib_init (dpdk_main_t * dm) u32 rnd; rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (addr+2, &rnd, sizeof(rnd)); + clib_memcpy (addr+2, &rnd, sizeof(rnd)); addr[0] = 2; addr[1] = 0xfe; } @@ -689,7 +689,7 @@ dpdk_lib_init (dpdk_main_t * dm) rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (addr+2, &rnd, sizeof(rnd)); + clib_memcpy (addr+2, &rnd, sizeof(rnd)); addr[0] = 2; addr[1] = 0xfe; } @@ -1436,8 +1436,8 @@ dpdk_process (vlib_main_t * vm, bhi = vnet_get_hw_interface( vnm, dm->devices[i].vlib_hw_if_index); bei = pool_elt_at_index(em->interfaces, bhi->hw_instance); - memcpy(bhi->hw_address, addr, 6); - memcpy(bei->address, addr, 6); + clib_memcpy(bhi->hw_address, addr, 6); + clib_memcpy(bei->address, addr, 6); /* Init l3 packet size allowed on bonded interface */ bhi->max_l3_packet_bytes[VLIB_RX] = bhi->max_l3_packet_bytes[VLIB_TX] = diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index 4f5a84ae..3b4b82af 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -375,9 +375,9 @@ void dpdk_rx_trace (dpdk_main_t * dm, t0->device_index = xd->device_index; t0->buffer_index = bi0; - memcpy (&t0->mb, mb, sizeof (t0->mb)); - memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); - memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); + clib_memcpy (&t0->mb, mb, sizeof (t0->mb)); + clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); + clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); #ifdef RTE_LIBRTE_MBUF_EXT_RX_OLFLAGS /* diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c index 9cdf664c..61a206cd 100644 --- a/vnet/vnet/devices/dpdk/vhost_user.c +++ b/vnet/vnet/devices/dpdk/vhost_user.c @@ -342,14 +342,14 @@ dpdk_create_vhost_user_if_internal (u32 * hw_if_index, u32 if_id, u8 *hwaddr) * Generate random MAC address for the interface */ if (hwaddr) { - memcpy(addr, hwaddr, sizeof(addr)); + clib_memcpy(addr, hwaddr, sizeof(addr)); } else { f64 now = vlib_time_now(vm); u32 rnd; rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (addr+2, &rnd, sizeof(rnd)); + clib_memcpy (addr+2, &rnd, sizeof(rnd)); addr[0] = 2; addr[1] = 0xfe; } @@ -949,7 +949,7 @@ static clib_error_t * dpdk_vhost_user_socket_read (unix_file_t * uf) (cmsg->cmsg_type == SCM_RIGHTS) && (cmsg->cmsg_len - CMSG_LEN(0) <= VHOST_MEMORY_MAX_NREGIONS * sizeof(int))) { number_of_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int); - memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int)); + clib_memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int)); } /* version 1, no reply bit set*/ diff --git a/vnet/vnet/devices/ssvm/node.c b/vnet/vnet/devices/ssvm/node.c index 3a5709d0..84625696 100644 --- a/vnet/vnet/devices/ssvm/node.c +++ b/vnet/vnet/devices/ssvm/node.c @@ -173,7 +173,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em, b0->total_length_not_including_first_buffer = elt->total_length_not_including_first_buffer; - memcpy (b0->data + b0->current_data, elt->data, + clib_memcpy (b0->data + b0->current_data, elt->data, b0->current_length); if (PREDICT_FALSE(prev != 0)) @@ -274,7 +274,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em, n_available = (u32)pointer_to_uword(sh->opaque[CHUNK_POOL_NFREE]); elt_indices = (u32 *)(sh->opaque[CHUNK_POOL_FREELIST_INDEX]); - memcpy (&elt_indices[n_available], intfc->rx_queue, + clib_memcpy (&elt_indices[n_available], intfc->rx_queue, vec_len (intfc->rx_queue) * sizeof (u32)); n_available += vec_len (intfc->rx_queue); diff --git a/vnet/vnet/devices/ssvm/ssvm_eth.c b/vnet/vnet/devices/ssvm/ssvm_eth.c index 23ec0261..49f2d5f8 100644 --- a/vnet/vnet/devices/ssvm/ssvm_eth.c +++ b/vnet/vnet/devices/ssvm/ssvm_eth.c @@ -298,7 +298,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm, if (PREDICT_TRUE(n_allocated > 0)) { - memcpy (&em->chunk_cache[n_present_in_cache], + clib_memcpy (&em->chunk_cache[n_present_in_cache], &elt_indices[n_available - n_allocated], sizeof(u32) * n_allocated); } @@ -346,7 +346,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm, elt->owner = !i_am_master; elt->tag = 1; - memcpy (elt->data, b0->data + b0->current_data, b0->current_length); + clib_memcpy (elt->data, b0->data + b0->current_data, b0->current_length); if (PREDICT_FALSE (prev_elt != 0)) prev_elt->next_index = elt - elts; diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c index 13a8fe1b..9747b920 100644 --- a/vnet/vnet/devices/virtio/vhost-user.c +++ b/vnet/vnet/devices/virtio/vhost-user.c @@ -320,7 +320,7 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf) (cmsg->cmsg_type == SCM_RIGHTS) && (cmsg->cmsg_len - CMSG_LEN(0) <= VHOST_MEMORY_MAX_NREGIONS * sizeof(int))) { number_of_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int); - memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int)); + clib_memcpy(fds, CMSG_DATA(cmsg), number_of_fds * sizeof(int)); } /* version 1, no reply bit set*/ @@ -399,7 +399,7 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf) } unmap_all_mem_regions(vui); for(i=0; i < msg.memory.nregions; i++) { - memcpy(&(vui->regions[i]), &msg.memory.regions[i], + clib_memcpy(&(vui->regions[i]), &msg.memory.regions[i], sizeof(vhost_user_memory_region_t)); long page_sz = get_huge_page_size(fds[i]); @@ -838,7 +838,7 @@ void vhost_user_rx_trace (vlib_main_t * vm, t0->virtqueue = virtqueue; t0->device_index = vui - vum->vhost_user_interfaces; #if VHOST_USER_COPY_TX_HDR == 1 - rte_memcpy(&t0->hdr, b0->pre_data, sizeof(virtio_net_hdr_t)); + clib_memcpy(&t0->hdr, b0->pre_data, sizeof(virtio_net_hdr_t)); #endif b+=1; @@ -997,7 +997,7 @@ static u32 vhost_user_if_input ( vlib_main_t * vm, #if VHOST_USER_COPY_TX_HDR == 1 if (PREDICT_TRUE(offset)) - rte_memcpy(b->pre_data, buffer_addr, sizeof(virtio_net_hdr_t)); /* 12 byte hdr is not used on tx */ + clib_memcpy(b->pre_data, buffer_addr, sizeof(virtio_net_hdr_t)); /* 12 byte hdr is not used on tx */ #endif if (txvq->desc[desc_current].len > offset) { @@ -1294,7 +1294,7 @@ vhost_user_intfc_tx (vlib_main_t * vm, } u16 bytes_to_copy = bytes_left > (rxvq->desc[desc_current].len - offset) ? (rxvq->desc[desc_current].len - offset) : bytes_left; - rte_memcpy(buffer_addr, vlib_buffer_get_current (current_b0) + current_b0->current_length - bytes_left, bytes_to_copy); + clib_memcpy(buffer_addr, vlib_buffer_get_current (current_b0) + current_b0->current_length - bytes_left, bytes_to_copy); vhost_user_log_dirty_pages(vui, rxvq->desc[desc_current].addr + offset, bytes_to_copy); bytes_left -= bytes_to_copy; @@ -1555,14 +1555,14 @@ static void vhost_user_create_ethernet(vnet_main_t * vnm, vlib_main_t * vm, /* create hw and sw interface */ if (hwaddress) { - memcpy(hwaddr, hwaddress, 6); + clib_memcpy(hwaddr, hwaddress, 6); } else { f64 now = vlib_time_now(vm); u32 rnd; rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (hwaddr+2, &rnd, sizeof(rnd)); + clib_memcpy (hwaddr+2, &rnd, sizeof(rnd)); hwaddr[0] = 2; hwaddr[1] = 0xfe; } diff --git a/vnet/vnet/dhcp/client.c b/vnet/vnet/dhcp/client.c index 727b5165..5916cfdb 100644 --- a/vnet/vnet/dhcp/client.c +++ b/vnet/vnet/dhcp/client.c @@ -163,7 +163,7 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b, /* Replace the existing hostname if necessary */ vec_free (c->hostname); vec_validate (c->hostname, o->length - 1); - memcpy (c->hostname, o->data, o->length); + clib_memcpy (c->hostname, o->data, o->length); } break; @@ -297,7 +297,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, { f = vlib_get_frame_to_node (vm, hw->output_node_index); vnet_buffer(b)->sw_if_index[VLIB_TX] = c->sw_if_index; - memcpy (b->data, c->l2_rewrite, vec_len(c->l2_rewrite)); + clib_memcpy (b->data, c->l2_rewrite, vec_len(c->l2_rewrite)); ip = (void *) (((u8 *)vlib_buffer_get_current (b)) + vec_len (c->l2_rewrite)); } @@ -344,7 +344,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_dhcp_to_server); /* Send the interface MAC address */ - memcpy (dhcp->client_hardware_address, c->l2_rewrite + 6, 6); + clib_memcpy (dhcp->client_hardware_address, c->l2_rewrite + 6, 6); /* Lease renewal, set up client_ip_address */ if (is_broadcast == 0) @@ -385,7 +385,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, { o->option = 54; o->length = 4; - memcpy (o->data, &c->dhcp_server.as_u32, 4); + clib_memcpy (o->data, &c->dhcp_server.as_u32, 4); o = (dhcp_option_t *) (((uword) o) + (o->length + 2)); } @@ -394,7 +394,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, { o->option = 50; o->length = 4; - memcpy (o->data, &c->leased_address.as_u32, 4); + clib_memcpy (o->data, &c->leased_address.as_u32, 4); o = (dhcp_option_t *) (((uword) o) + (o->length + 2)); } @@ -403,7 +403,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, { o->option = 12; o->length = vec_len (c->hostname); - memcpy (o->data, c->hostname, vec_len (c->hostname)); + clib_memcpy (o->data, c->hostname, vec_len (c->hostname)); o = (dhcp_option_t *) (((uword) o) + (o->length + 2)); } @@ -417,7 +417,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c, */ o->option = 55; o->length = vec_len (c->option_55_data); - memcpy (o->data, c->option_55_data, vec_len(c->option_55_data)); + clib_memcpy (o->data, c->option_55_data, vec_len(c->option_55_data)); o = (dhcp_option_t *) (((uword) o) + (o->length + 2)); /* End of list */ diff --git a/vnet/vnet/dhcp/proxy_node.c b/vnet/vnet/dhcp/proxy_node.c index 2f860226..69edae7e 100644 --- a/vnet/vnet/dhcp/proxy_node.c +++ b/vnet/vnet/dhcp/proxy_node.c @@ -633,7 +633,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); - memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); + clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); 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); diff --git a/vnet/vnet/dhcpv6/proxy_node.c b/vnet/vnet/dhcpv6/proxy_node.c index e41fe9a1..01f5965c 100644 --- a/vnet/vnet/dhcpv6/proxy_node.c +++ b/vnet/vnet/dhcpv6/proxy_node.c @@ -202,7 +202,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm, h0 = vlib_buffer_get_current (b0); e_h0 = (ethernet_header_t *)b0->data; - memcpy(client_src_mac, e_h0->src_address, 6); + clib_memcpy(client_src_mac, e_h0->src_address, 6); /* Send to DHCPV6 server via the configured FIB */ vnet_buffer(b0)->sw_if_index[VLIB_TX] = dpm->server_fib_index; @@ -346,7 +346,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm, sizeof(cmac->opt)); cmac->opt.option = clib_host_to_net_u16(DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS); cmac->link_type = clib_host_to_net_u16(1); // ethernet - memcpy(cmac->data, client_src_mac, 6); + clib_memcpy(cmac->data, client_src_mac, 6); u1->length += sizeof(*cmac); } if (oui1 || fib_id1) { @@ -639,7 +639,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); - memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); + clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address)); 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/vnet/vnet/dpdk_replication.h b/vnet/vnet/dpdk_replication.h index 6259c449..bf9bf99f 100644 --- a/vnet/vnet/dpdk_replication.h +++ b/vnet/vnet/dpdk_replication.h @@ -56,7 +56,7 @@ vlib_dpdk_clone_buffer (vlib_main_t * vm, vlib_buffer_t * b) for (i = 0; i < new_buffers_needed; i++) { - memcpy (copy_src, copy_dst, src_buf->current_length); + clib_memcpy (copy_src, copy_dst, src_buf->current_length); dst_buf->current_data = src_buf->current_data; dst_buf->current_length = src_buf->current_length; dst_buf->flags = src_buf->flags; @@ -90,7 +90,7 @@ vlib_dpdk_clone_buffer (vlib_main_t * vm, vlib_buffer_t * b) rv = vlib_buffer_from_rte_mbuf(rte_mbufs[0]); vlib_buffer_init_for_free_list (rv, fl); - memcpy(rv->data + b->current_data, b->data + b->current_data, + clib_memcpy(rv->data + b->current_data, b->data + b->current_data, b->current_length); rv->current_data = b->current_data; rv->current_length = b->current_length; diff --git a/vnet/vnet/ethernet/arp.c b/vnet/vnet/ethernet/arp.c index a5b015c7..220d0d2a 100644 --- a/vnet/vnet/ethernet/arp.c +++ b/vnet/vnet/ethernet/arp.c @@ -278,7 +278,7 @@ ethernet_arp_sw_interface_up_down (vnet_main_t * vnm, ethernet_arp_ip4_over_ethernet_address_t delme; e = pool_elt_at_index (am->ip4_entry_pool, to_delete[i]); - memcpy (&delme.ethernet, e->ethernet_address, 6); + clib_memcpy (&delme.ethernet, e->ethernet_address, 6); delme.ip4.as_u32 = e->key.ip4_address.as_u32; vnet_arp_unset_ip4_over_ethernet (vnm, e->key.sw_if_index, @@ -347,7 +347,7 @@ vnet_arp_set_ip4_over_ethernet (vnet_main_t * vnm, args.fib_index = fib_index; args.is_static = is_static; args.is_remove = 0; - memcpy (&args.a, a, sizeof (*a)); + clib_memcpy (&args.a, a, sizeof (*a)); vl_api_rpc_call_main_thread (set_ip4_over_ethernet_rpc_callback, (u8 *) &args, sizeof (args)); @@ -452,7 +452,7 @@ vnet_arp_set_ip4_over_ethernet_internal (vnet_main_t * vnm, } /* Update time stamp and ethernet address. */ - memcpy (e->ethernet_address, a->ethernet, sizeof (e->ethernet_address)); + clib_memcpy (e->ethernet_address, a->ethernet, sizeof (e->ethernet_address)); e->cpu_time_last_updated = clib_cpu_time_now (); if (is_static) e->flags |= ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC; @@ -696,7 +696,7 @@ static void unset_random_arp_entry (void) e = pool_elt_at_index (am->ip4_entry_pool, index); - memcpy (&delme.ethernet, e->ethernet_address, 6); + clib_memcpy (&delme.ethernet, e->ethernet_address, 6); delme.ip4.as_u32 = e->key.ip4_address.as_u32; vnet_arp_unset_ip4_over_ethernet (vnm, e->key.sw_if_index, @@ -724,7 +724,7 @@ static void arp_unnumbered (vlib_buffer_t * p0, ethernet_arp_header_t * arp0; /* Save the dst mac address */ - memcpy(dst_mac_address, eth0->dst_address, sizeof (dst_mac_address)); + clib_memcpy(dst_mac_address, eth0->dst_address, sizeof (dst_mac_address)); /* Figure out which sw_if_index supplied the address */ unnum_src_sw_if_index = ifa0->sw_if_index; @@ -753,7 +753,7 @@ static void arp_unnumbered (vlib_buffer_t * p0, b0 = vlib_get_buffer (vm, buffers[i]); /* xerox (partially built) ARP pkt */ - memcpy (b0->data, p0->data, p0->current_length + p0->current_data); + clib_memcpy (b0->data, p0->data, p0->current_length + p0->current_data); b0->current_data = p0->current_data; b0->current_length = p0->current_length; vnet_buffer(b0)->sw_if_index[VLIB_RX] = @@ -776,7 +776,7 @@ static void arp_unnumbered (vlib_buffer_t * p0, vnet_buffer(b0)->sw_if_index[VLIB_TX] = hi->sw_if_index; /* Fix ARP pkt src address */ - memcpy (arp0->ip4_over_ethernet[0].ethernet, hi->hw_address, 6); + clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, hi->hw_address, 6); /* Build L2 encaps for this swif */ header_size = sizeof (ethernet_header_t); @@ -817,8 +817,8 @@ static void arp_unnumbered (vlib_buffer_t * p0, } /* Restore the original dst address, set src address */ - memcpy (eth0->dst_address, dst_mac_address, sizeof (eth0->dst_address)); - memcpy (eth0->src_address, hi->hw_address, sizeof (eth0->src_address)); + clib_memcpy (eth0->dst_address, dst_mac_address, sizeof (eth0->dst_address)); + clib_memcpy (eth0->src_address, hi->hw_address, sizeof (eth0->src_address)); /* Transmit replicas */ if (i > 0) @@ -986,14 +986,14 @@ arp_input (vlib_main_t * vm, arp0->ip4_over_ethernet[1] = arp0->ip4_over_ethernet[0]; - memcpy (arp0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, 6); + clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, 6); clib_mem_unaligned (&arp0->ip4_over_ethernet[0].ip4.data_u32, u32) = if_addr0->data_u32; /* Hardware must be ethernet-like. */ ASSERT (vec_len (hw_if0->hw_address) == 6); - memcpy (eth0->dst_address, eth0->src_address, 6); - memcpy (eth0->src_address, hw_if0->hw_address, 6); + clib_memcpy (eth0->dst_address, eth0->src_address, 6); + clib_memcpy (eth0->src_address, hw_if0->hw_address, 6); /* Figure out how much to rewind current data from adjacency. */ if (ifa0) @@ -1390,7 +1390,7 @@ vnet_arp_unset_ip4_over_ethernet (vnet_main_t * vnm, args.sw_if_index = sw_if_index; args.fib_index = fib_index; args.is_remove = 1; - memcpy (&args.a, a, sizeof (*a)); + clib_memcpy (&args.a, a, sizeof (*a)); vl_api_rpc_call_main_thread (set_ip4_over_ethernet_rpc_callback, (u8 *) &args, sizeof (args)); @@ -1600,7 +1600,7 @@ vnet_arp_glean_add(u32 fib_index, void * next_hop_arg) e->flags = ETHERNET_ARP_IP4_ENTRY_FLAG_GLEAN; memset(&args, 0, sizeof(args)); - memcpy(&add_adj, adj, sizeof(add_adj)); + clib_memcpy(&add_adj, adj, sizeof(add_adj)); add_adj.arp.next_hop.ip4.as_u32 = next_hop->as_u32; /* install neighbor /32 route */ args.table_index_or_table_id = fib_index; args.flags = IP4_ROUTE_FLAG_FIB_INDEX | IP4_ROUTE_FLAG_ADD| IP4_ROUTE_FLAG_NEIGHBOR; @@ -1828,7 +1828,7 @@ arp_term_l2bd (vlib_main_t * vm, { u8 *t0 = vlib_add_trace ( vm, node, p0, sizeof(ethernet_arp_input_trace_t)); - memcpy (t0, l3h0, sizeof(ethernet_arp_input_trace_t)); + clib_memcpy (t0, l3h0, sizeof(ethernet_arp_input_trace_t)); } if (PREDICT_FALSE ( @@ -1907,9 +1907,9 @@ arp_term_l2bd (vlib_main_t * vm, arp0->opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply); arp0->ip4_over_ethernet[1] = arp0->ip4_over_ethernet[0]; arp0->ip4_over_ethernet[0].ip4.as_u32 = ip0; - memcpy (arp0->ip4_over_ethernet[0].ethernet, macp0, 6); - memcpy (eth0->dst_address, eth0->src_address, 6); - memcpy (eth0->src_address, macp0, 6); + clib_memcpy (arp0->ip4_over_ethernet[0].ethernet, macp0, 6); + clib_memcpy (eth0->dst_address, eth0->src_address, 6); + clib_memcpy (eth0->src_address, macp0, 6); n_replies_sent += 1; // For BVI, need to use l2-fwd node to send ARP reply as diff --git a/vnet/vnet/ethernet/format.c b/vnet/vnet/ethernet/format.c index be456d56..f6fc6e21 100644 --- a/vnet/vnet/ethernet/format.c +++ b/vnet/vnet/ethernet/format.c @@ -294,7 +294,7 @@ unformat_ethernet_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (e[0]) + n_vlan * sizeof (m->vlan[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, m, n_bytes); + clib_memcpy (p, m, n_bytes); } return 1; diff --git a/vnet/vnet/ethernet/interface.c b/vnet/vnet/ethernet/interface.c index 7a4f0673..bb8c7536 100644 --- a/vnet/vnet/ethernet/interface.c +++ b/vnet/vnet/ethernet/interface.c @@ -89,9 +89,9 @@ static uword ethernet_set_rewrite (vnet_main_t * vnm, } ei = pool_elt_at_index (em->interfaces, hw->hw_instance); - memcpy (h->src_address, ei->address, sizeof (h->src_address)); + clib_memcpy (h->src_address, ei->address, sizeof (h->src_address)); if (dst_address) - memcpy (h->dst_address, dst_address, sizeof (h->dst_address)); + clib_memcpy (h->dst_address, dst_address, sizeof (h->dst_address)); else memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */ @@ -188,7 +188,7 @@ ethernet_register_interface (vnet_main_t * vnm, /* Standard default ethernet MTU. */ hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 9000; - memcpy (ei->address, address, sizeof (ei->address)); + clib_memcpy (ei->address, address, sizeof (ei->address)); vec_free (hi->hw_address); vec_add (hi->hw_address, address, sizeof (ei->address)); @@ -277,7 +277,7 @@ simulated_ethernet_interface_tx (vlib_main_t * vm, n_copy = clib_min (n_left_from, n_left_to_next); - memcpy (to_next, from, n_copy * sizeof (from[0])); + clib_memcpy (to_next, from, n_copy * sizeof (from[0])); n_left_to_next -= n_copy; n_left_from -= n_copy; for (i = 0; i < n_copy; i++) @@ -341,7 +341,7 @@ int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 *mac_address) * address is programmed on the loopback interface. */ if (memcmp (address, mac_address, sizeof (address))) - memcpy (address, mac_address, sizeof (address)); + clib_memcpy (address, mac_address, sizeof (address)); else { address[0] = 0xde; diff --git a/vnet/vnet/ethernet/mac_swap.c b/vnet/vnet/ethernet/mac_swap.c index 6bb7f5b0..f3949390 100644 --- a/vnet/vnet/ethernet/mac_swap.c +++ b/vnet/vnet/ethernet/mac_swap.c @@ -235,16 +235,16 @@ mac_swap_node_fn (vlib_main_t * vm, if (b0->flags & VLIB_BUFFER_IS_TRACED) { swap_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); - memcpy (t->src, h0->src_address, 6); - memcpy (t->dst, h0->dst_address, 6); + clib_memcpy (t->src, h0->src_address, 6); + clib_memcpy (t->dst, h0->dst_address, 6); t->sw_if_index = sw_if_index0; t->next_index = next0; } if (b1->flags & VLIB_BUFFER_IS_TRACED) { swap_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); - memcpy (t->src, h1->src_address, 6); - memcpy (t->dst, h1->dst_address, 6); + clib_memcpy (t->src, h1->src_address, 6); + clib_memcpy (t->dst, h1->dst_address, 6); t->sw_if_index = sw_if_index1; t->next_index = next1; } @@ -317,8 +317,8 @@ mac_swap_node_fn (vlib_main_t * vm, if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE) && (b0->flags & VLIB_BUFFER_IS_TRACED))) { swap_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); - memcpy (t->src, h0->src_address, 6); - memcpy (t->dst, h0->dst_address, 6); + clib_memcpy (t->src, h0->src_address, 6); + clib_memcpy (t->dst, h0->dst_address, 6); t->sw_if_index = sw_if_index0; t->next_index = next0; } diff --git a/vnet/vnet/flow/flow_report.c b/vnet/vnet/flow/flow_report.c index 9c0cbb6d..0cb2585d 100644 --- a/vnet/vnet/flow/flow_report.c +++ b/vnet/vnet/flow/flow_report.c @@ -61,7 +61,7 @@ int send_template_packet (flow_report_main_t *frm, ASSERT (vec_len (fr->rewrite) < VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES); - memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite)); + clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite)); b0->current_data = 0; b0->current_length = vec_len (fr->rewrite); b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; diff --git a/vnet/vnet/flow/flow_report_sample.c b/vnet/vnet/flow/flow_report_sample.c index eb2fbfce..e0240553 100644 --- a/vnet/vnet/flow/flow_report_sample.c +++ b/vnet/vnet/flow/flow_report_sample.c @@ -191,7 +191,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm, goto flush; b0 = vlib_get_buffer (vm, bi0); - memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite)); + clib_memcpy (b0->data, fr->rewrite, vec_len (fr->rewrite)); b0->current_data = 0; b0->current_length = vec_len (fr->rewrite); b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; @@ -226,7 +226,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm, #define _(field,mask,item,length) \ if (clib_bitmap_get (fr->fields_to_send, field_index)) \ { \ - memcpy (b0->data + next_offset, &field, \ + clib_memcpy (b0->data + next_offset, &field, \ length); \ next_offset += length; \ } \ @@ -237,7 +237,7 @@ static vlib_frame_t * send_flows (flow_report_main_t * frm, /* Add packetTotalCount manually */ { u64 packets = clib_host_to_net_u64 (v->hits); - memcpy (b0->data + next_offset, &packets, sizeof (packets)); + clib_memcpy (b0->data + next_offset, &packets, sizeof (packets)); next_offset += sizeof (packets); } records_this_buffer++; diff --git a/vnet/vnet/gre/gre.c b/vnet/vnet/gre/gre.c index c09816a2..aad7645b 100644 --- a/vnet/vnet/gre/gre.c +++ b/vnet/vnet/gre/gre.c @@ -160,7 +160,7 @@ unformat_gre_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/gre/interface.c b/vnet/vnet/gre/interface.c index 0eb395bb..69c1583e 100644 --- a/vnet/vnet/gre/interface.c +++ b/vnet/vnet/gre/interface.c @@ -70,8 +70,8 @@ gre_register_interface (vnet_main_t * vnm, /* Standard default gre MTU. */ hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 9000; - memcpy (&t->tunnel_src, tunnel_src, sizeof (t->tunnel_src)); - memcpy (&t->tunnel_dst, tunnel_dst, sizeof (t->tunnel_dst)); + clib_memcpy (&t->tunnel_src, tunnel_src, sizeof (t->tunnel_src)); + clib_memcpy (&t->tunnel_dst, tunnel_dst, sizeof (t->tunnel_dst)); hash_set (gm->tunnel_by_key, key, t - gm->tunnels); diff --git a/vnet/vnet/hdlc/hdlc.c b/vnet/vnet/hdlc/hdlc.c index bdbe8946..9997ddc5 100644 --- a/vnet/vnet/hdlc/hdlc.c +++ b/vnet/vnet/hdlc/hdlc.c @@ -161,7 +161,7 @@ unformat_hdlc_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/interface_output.c b/vnet/vnet/interface_output.c index 033e9fc4..f19b9152 100644 --- a/vnet/vnet/interface_output.c +++ b/vnet/vnet/interface_output.c @@ -98,14 +98,14 @@ vnet_interface_output_trace (vlib_main_t * vm, { t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0])); t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX]; - memcpy (t0->data, vlib_buffer_get_current (b0), + clib_memcpy (t0->data, vlib_buffer_get_current (b0), sizeof (t0->data)); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { t1 = vlib_add_trace (vm, node, b1, sizeof (t1[0])); t1->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_TX]; - memcpy (t1->data, vlib_buffer_get_current (b1), + clib_memcpy (t1->data, vlib_buffer_get_current (b1), sizeof (t1->data)); } from += 2; @@ -126,7 +126,7 @@ vnet_interface_output_trace (vlib_main_t * vm, { t0 = vlib_add_trace (vm, node, b0, sizeof (t0[0])); t0->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX]; - memcpy (t0->data, vlib_buffer_get_current (b0), + clib_memcpy (t0->data, vlib_buffer_get_current (b0), sizeof (t0->data)); } from += 1; diff --git a/vnet/vnet/ip/icmp6.c b/vnet/vnet/ip/icmp6.c index e6022adf..313ab98d 100644 --- a/vnet/vnet/ip/icmp6.c +++ b/vnet/vnet/ip/icmp6.c @@ -335,9 +335,9 @@ ip6_icmp_echo_request (vlib_main_t * vm, * is not in the IP6 FIB */ vlib_buffer_reset (p0); eth0 = vlib_buffer_get_current (p0); - memcpy (tmp_mac, eth0->dst_address, 6); - memcpy (eth0->dst_address, eth0->src_address, 6); - memcpy (eth0->src_address, tmp_mac, 6); + clib_memcpy (tmp_mac, eth0->dst_address, 6); + clib_memcpy (eth0->dst_address, eth0->src_address, 6); + clib_memcpy (eth0->src_address, tmp_mac, 6); vnet_buffer(p0)->sw_if_index[VLIB_TX] = vnet_buffer (p0)->sw_if_index[VLIB_RX]; next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT; @@ -359,9 +359,9 @@ ip6_icmp_echo_request (vlib_main_t * vm, * is not in the IP6 FIB */ vlib_buffer_reset (p1); eth1 = vlib_buffer_get_current (p1); - memcpy (tmp_mac, eth1->dst_address, 6); - memcpy (eth1->dst_address, eth1->src_address, 6); - memcpy (eth1->src_address, tmp_mac, 6); + clib_memcpy (tmp_mac, eth1->dst_address, 6); + clib_memcpy (eth1->dst_address, eth1->src_address, 6); + clib_memcpy (eth1->src_address, tmp_mac, 6); vnet_buffer(p1)->sw_if_index[VLIB_TX] = vnet_buffer (p1)->sw_if_index[VLIB_RX]; next1 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT; @@ -435,9 +435,9 @@ ip6_icmp_echo_request (vlib_main_t * vm, * is not in the IP6 FIB */ vlib_buffer_reset (p0); eth0 = vlib_buffer_get_current (p0); - memcpy (tmp_mac, eth0->dst_address, 6); - memcpy (eth0->dst_address, eth0->src_address, 6); - memcpy (eth0->src_address, tmp_mac, 6); + clib_memcpy (tmp_mac, eth0->dst_address, 6); + clib_memcpy (eth0->dst_address, eth0->src_address, 6); + clib_memcpy (eth0->src_address, tmp_mac, 6); vnet_buffer(p0)->sw_if_index[VLIB_TX] = vnet_buffer (p0)->sw_if_index[VLIB_RX]; next0 = ICMP6_ECHO_REQUEST_NEXT_OUTPUT; diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c index ef3624a8..720450f0 100644 --- a/vnet/vnet/ip/ip4_forward.c +++ b/vnet/vnet/ip/ip4_forward.c @@ -181,7 +181,7 @@ ip4_fib_set_adj_index (ip4_main_t * im, fib->new_hash_values); p = hash_get (hash, dst_address_u32); - memcpy (p, fib->new_hash_values, vec_bytes (fib->new_hash_values)); + clib_memcpy (p, fib->new_hash_values, vec_bytes (fib->new_hash_values)); } } @@ -545,7 +545,7 @@ void ip4_maybe_remap_adjacencies (ip4_main_t * im, else { /* Remap to new adjacency. */ - memcpy (fib->old_hash_values, p->value, vec_bytes (fib->old_hash_values)); + clib_memcpy (fib->old_hash_values, p->value, vec_bytes (fib->old_hash_values)); /* Set new adjacency value. */ fib->new_hash_values[0] = p->value[0] = m - 1; @@ -1450,7 +1450,7 @@ ip4_forward_next_trace (vlib_main_t * vm, t0->flow_hash = vnet_buffer (b0)->ip.flow_hash; t0->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - memcpy (t0->packet_data, + clib_memcpy (t0->packet_data, vlib_buffer_get_current (b0), sizeof (t0->packet_data)); } @@ -1461,7 +1461,7 @@ ip4_forward_next_trace (vlib_main_t * vm, t1->flow_hash = vnet_buffer (b1)->ip.flow_hash; t1->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b1)->sw_if_index[VLIB_RX]); - memcpy (t1->packet_data, + clib_memcpy (t1->packet_data, vlib_buffer_get_current (b1), sizeof (t1->packet_data)); } @@ -1486,7 +1486,7 @@ ip4_forward_next_trace (vlib_main_t * vm, t0->flow_hash = vnet_buffer (b0)->ip.flow_hash; t0->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - memcpy (t0->packet_data, + clib_memcpy (t0->packet_data, vlib_buffer_get_current (b0), sizeof (t0->packet_data)); } @@ -2197,7 +2197,7 @@ ip4_arp (vlib_main_t * vm, hw_if0 = vnet_get_sup_hw_interface (vnm, sw_if_index0); /* Src ethernet address in ARP header. */ - memcpy (h0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, + clib_memcpy (h0->ip4_over_ethernet[0].ethernet, hw_if0->hw_address, sizeof (h0->ip4_over_ethernet[0].ethernet)); ip4_src_address_for_packet (im, p0, &h0->ip4_over_ethernet[0].ip4, sw_if_index0); @@ -2310,7 +2310,7 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index) hi = vnet_get_sup_hw_interface (vnm, sw_if_index); - memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address, sizeof (h->ip4_over_ethernet[0].ethernet)); + clib_memcpy (h->ip4_over_ethernet[0].ethernet, hi->hw_address, sizeof (h->ip4_over_ethernet[0].ethernet)); h->ip4_over_ethernet[0].ip4 = src[0]; h->ip4_over_ethernet[1].ip4 = dst[0]; diff --git a/vnet/vnet/ip/ip4_packet.h b/vnet/vnet/ip/ip4_packet.h index ba00eedb..78db01a1 100644 --- a/vnet/vnet/ip/ip4_packet.h +++ b/vnet/vnet/ip/ip4_packet.h @@ -64,7 +64,7 @@ always_inline void ip4_addr_fib_init (ip4_address_fib_t * addr_fib, ip4_address_t * address, u32 fib_index) { - memcpy (&addr_fib->ip4_addr, address, sizeof (addr_fib->ip4_addr)); + clib_memcpy (&addr_fib->ip4_addr, address, sizeof (addr_fib->ip4_addr)); addr_fib->fib_index = fib_index; } diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c index 4a161e72..c8b9df01 100644 --- a/vnet/vnet/ip/ip6_forward.c +++ b/vnet/vnet/ip/ip6_forward.c @@ -480,7 +480,7 @@ ip6_get_route (ip6_main_t * im, BVT(clib_bihash_kv) kv, value; ASSERT (address_length < ARRAY_LEN (im->fib_masks)); - memcpy (&masked_address, address, sizeof (masked_address)); + clib_memcpy (&masked_address, address, sizeof (masked_address)); ip6_address_mask (&masked_address, &im->fib_masks[address_length]); kv.key[0] = masked_address.as_u64[0]; @@ -1253,7 +1253,7 @@ ip6_forward_next_trace (vlib_main_t * vm, t0->flow_hash = vnet_buffer (b0)->ip.flow_hash; t0->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - memcpy (t0->packet_data, + clib_memcpy (t0->packet_data, vlib_buffer_get_current (b0), sizeof (t0->packet_data)); } @@ -1264,7 +1264,7 @@ ip6_forward_next_trace (vlib_main_t * vm, t1->flow_hash = vnet_buffer (b1)->ip.flow_hash; t1->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b1)->sw_if_index[VLIB_RX]); - memcpy (t1->packet_data, + clib_memcpy (t1->packet_data, vlib_buffer_get_current (b1), sizeof (t1->packet_data)); } @@ -1289,7 +1289,7 @@ ip6_forward_next_trace (vlib_main_t * vm, t0->flow_hash = vnet_buffer (b0)->ip.flow_hash; t0->fib_index = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer(b0)->sw_if_index[VLIB_RX]); - memcpy (t0->packet_data, + clib_memcpy (t0->packet_data, vlib_buffer_get_current (b0), sizeof (t0->packet_data)); } @@ -1913,7 +1913,7 @@ ip6_discover_neighbor (vlib_main_t * vm, h0->neighbor.target_address = ip0->dst_address; - memcpy (h0->link_layer_option.ethernet_address, + clib_memcpy (h0->link_layer_option.ethernet_address, hw_if0->hw_address, vec_len (hw_if0->hw_address)); /* $$$$ appears we need this; why is the checksum non-zero? */ @@ -2018,7 +2018,7 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index) h->ip.src_address = src[0]; h->neighbor.target_address = dst[0]; - memcpy (h->link_layer_option.ethernet_address, hi->hw_address, vec_len (hi->hw_address)); + clib_memcpy (h->link_layer_option.ethernet_address, hi->hw_address, vec_len (hi->hw_address)); h->neighbor.icmp.checksum = ip6_tcp_udp_icmp_compute_checksum (vm, 0, &h->ip, &bogus_length); diff --git a/vnet/vnet/ip/ip6_hop_by_hop.c b/vnet/vnet/ip/ip6_hop_by_hop.c index 62f22e47..2282e8ca 100644 --- a/vnet/vnet/ip/ip6_hop_by_hop.c +++ b/vnet/vnet/ip/ip6_hop_by_hop.c @@ -472,8 +472,7 @@ ip6_hop_by_hop_node_fn (vlib_main_t * vm, trace_len = trace_len < ARRAY_LEN(t->option_data) ? trace_len : ARRAY_LEN(t->option_data); t->trace_len = trace_len; - t->timestamp_msbs = time_u64.as_u32[1]; - memcpy (t->option_data, hbh0, trace_len); + clib_memcpy (t->option_data, hbh0, trace_len); } processed++; @@ -683,7 +682,7 @@ ip6_add_hop_by_hop_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *)(ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy (hbh0, rewrite, rewrite_length); /* Patch the protocol chain, insert the h-b-h (type 0) header */ hbh0->protocol = ip0->protocol; ip0->protocol = 0; diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 957e35b5..acb1d8dc 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -300,8 +300,8 @@ static void set_unset_ip6_neighbor_rpc args.sw_if_index = sw_if_index; args.is_add = is_add; - memcpy (&args.addr, a, sizeof (*a)); - memcpy (args.link_layer_address, link_layer_addreess, 6); + clib_memcpy (&args.addr, a, sizeof (*a)); + clib_memcpy (args.link_layer_address, link_layer_addreess, 6); vl_api_rpc_call_main_thread (ip6_neighbor_set_unset_rpc_callback, (u8 *) &args, sizeof (args)); @@ -376,7 +376,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm, } /* Update time stamp and ethernet address. */ - memcpy (n->link_layer_address, link_layer_address, n_bytes_link_layer_address); + clib_memcpy (n->link_layer_address, link_layer_address, n_bytes_link_layer_address); n->cpu_time_last_updated = clib_cpu_time_now (); /* Customer(s) waiting for this address to be resolved? */ @@ -722,7 +722,7 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm, eth_if0 = ethernet_get_interface (ðernet_main, sw_if0->hw_if_index); if (eth_if0 && o0) { - memcpy (o0->ethernet_address, eth_if0->address, 6); + clib_memcpy (o0->ethernet_address, eth_if0->address, 6); o0->header.type = ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address; } @@ -741,8 +741,8 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm, * interface MAC to SMAC */ vlib_buffer_reset (p0); eth0 = vlib_buffer_get_current(p0); - memcpy(eth0->dst_address, eth0->src_address, 6); - memcpy(eth0->src_address, eth_if0->address, 6); + clib_memcpy(eth0->dst_address, eth0->src_address, 6); + clib_memcpy(eth0->src_address, eth_if0->address, 6); /* Setup input and output sw_if_index for packet */ ASSERT(vnet_buffer(p0)->sw_if_index[VLIB_RX] == sw_if_index0); @@ -1013,7 +1013,7 @@ icmp6_router_solicitation(vlib_main_t * vm, h.header.n_data_u64s = 1; /* copy ll address */ - memcpy(&h.ethernet_address[0], eth_if0->address, 6); + clib_memcpy(&h.ethernet_address[0], eth_if0->address, 6); vlib_buffer_add_data (vm, p0->free_list_index, @@ -1081,7 +1081,7 @@ icmp6_router_solicitation(vlib_main_t * vm, } h.unused = 0; - memcpy(&h.dst_address, &pr_info->prefix, sizeof(ip6_address_t)); + clib_memcpy(&h.dst_address, &pr_info->prefix, sizeof(ip6_address_t)); payload_length += sizeof( icmp6_neighbor_discovery_prefix_information_option_t); @@ -1131,8 +1131,8 @@ icmp6_router_solicitation(vlib_main_t * vm, * interface MAC to SMAC */ vlib_buffer_reset (p0); eth0 = vlib_buffer_get_current(p0); - memcpy(eth0->dst_address, eth0->src_address, 6); - memcpy(eth0->src_address, eth_if0->address, 6); + clib_memcpy(eth0->dst_address, eth0->src_address, 6); + clib_memcpy(eth0->src_address, eth_if0->address, 6); next0 = is_dropped ? next0 : ICMP6_ROUTER_SOLICITATION_NEXT_REPLY_TX; vnet_buffer(p0)->sw_if_index[VLIB_TX] = sw_if_index0; @@ -1568,7 +1568,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, /* fill in radv_info for this interface that will be needed later */ a->adv_link_mtu = hw_if0->max_l3_packet_bytes[VLIB_RX]; - memcpy (a->link_layer_address, eth_if0->address, 6); + clib_memcpy (a->link_layer_address, eth_if0->address, 6); /* fill in default link-local address (this may be overridden) */ ip6_link_local_address_from_ethernet_address (&a->link_local_address, eth_if0->address); @@ -1666,7 +1666,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, mcast_group_info->type = 4; mcast_group_info->mcast_source_address_pool = 0; mcast_group_info->num_sources = 0; - memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); + clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); } ip6_set_reserved_multicast_address (&addr, @@ -1688,7 +1688,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, mcast_group_info->type = 4; mcast_group_info->mcast_source_address_pool = 0; mcast_group_info->num_sources = 0; - memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); + clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); } ip6_set_reserved_multicast_address (&addr, @@ -1710,7 +1710,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm, mcast_group_info->type = 4; mcast_group_info->mcast_source_address_pool = 0; mcast_group_info->num_sources = 0; - memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); + clib_memcpy(&mcast_group_info->mcast_address, &addr, sizeof(ip6_address_t)); } } } @@ -1824,7 +1824,7 @@ ip6_neighbor_send_mldpv2_report(u32 sw_if_index) rr.type = m->type; rr.aux_data_len_u32s = 0; rr.num_sources = clib_host_to_net_u16 (m->num_sources); - memcpy(&rr.mcast_addr, &m->mcast_address, sizeof(ip6_address_t)); + clib_memcpy(&rr.mcast_addr, &m->mcast_address, sizeof(ip6_address_t)); num_addr_records++; @@ -2270,7 +2270,7 @@ ip6_neighbor_ra_prefix(vlib_main_t * vm, u32 sw_if_index, memset(prefix, 0x0, sizeof(ip6_radv_prefix_t)); prefix->prefix_len = prefix_len; - memcpy(&prefix->prefix, prefix_addr, sizeof(ip6_address_t)); + clib_memcpy(&prefix->prefix, prefix_addr, sizeof(ip6_address_t)); /* initialize default values */ prefix->adv_on_link_flag = 1; /* L bit set */ @@ -2775,7 +2775,7 @@ enable_ip6_interface(vlib_main_t * vm, md5_add (&m, &link_local_address, 16); md5_finish (&m, digest); - memcpy(&link_local_address, digest, 16); + clib_memcpy(&link_local_address, digest, 16); radv_info->randomizer = link_local_address.as_u64[0]; @@ -3028,7 +3028,7 @@ ip6_neighbor_add_del_interface_address (ip6_main_t * im, mcast_group_info->type = 4; mcast_group_info->mcast_source_address_pool = 0; mcast_group_info->num_sources = 0; - memcpy(&mcast_group_info->mcast_address, &a, sizeof(ip6_address_t)); + clib_memcpy(&mcast_group_info->mcast_address, &a, sizeof(ip6_address_t)); } } } diff --git a/vnet/vnet/ip/ip_frag.c b/vnet/vnet/ip/ip_frag.c index 3436090a..5437c265 100644 --- a/vnet/vnet/ip/ip_frag.c +++ b/vnet/vnet/ip/ip_frag.c @@ -114,9 +114,9 @@ ip4_frag_do_fragment(vlib_main_t *vm, u32 pi, u32 **buffer, ip_frag_error_t *err fip4 = (ip4_header_t *)(vlib_buffer_get_current(b) + offset); //Copy offset and ip4 header - memcpy(b->data, packet, offset + sizeof(*ip4)); + clib_memcpy(b->data, packet, offset + sizeof(*ip4)); //Copy data - memcpy(((u8*)(fip4)) + sizeof(*fip4), + clib_memcpy(((u8*)(fip4)) + sizeof(*fip4), packet + offset + sizeof(*fip4) + ptr, len); } b->current_length = offset + len + sizeof(*fip4); @@ -321,8 +321,8 @@ ip6_frag_do_fragment(vlib_main_t *vm, u32 pi, u32 **buffer, ip_frag_error_t *err b = vlib_get_buffer(vm, bi); vnet_buffer(b)->sw_if_index[VLIB_RX] = vnet_buffer(p)->sw_if_index[VLIB_RX]; vnet_buffer(b)->sw_if_index[VLIB_TX] = vnet_buffer(p)->sw_if_index[VLIB_TX]; - memcpy(vlib_buffer_get_current(b), vlib_buffer_get_current(p), headers_len); - memcpy(vlib_buffer_get_current(b) + headers_len, payload + ptr, len); + clib_memcpy(vlib_buffer_get_current(b), vlib_buffer_get_current(p), headers_len); + clib_memcpy(vlib_buffer_get_current(b) + headers_len, payload + ptr, len); frag_hdr = vlib_buffer_get_current(b) + headers_len - sizeof(*frag_hdr); } else { bi = pi; diff --git a/vnet/vnet/ip/lookup.c b/vnet/vnet/ip/lookup.c index 010e9e93..9e3cdc0c 100644 --- a/vnet/vnet/ip/lookup.c +++ b/vnet/vnet/ip/lookup.c @@ -244,8 +244,8 @@ ip_update_adjacency (ip_lookup_main_t * lm, adj->lookup_next_index = IP_LOOKUP_NEXT_ARP; CLIB_MEMORY_BARRIER(); - memcpy (&adj->rewrite_header, ©_adj->rewrite_header, - VLIB_BUFFER_PRE_DATA_SIZE); + clib_memcpy (&adj->rewrite_header, ©_adj->rewrite_header, + VLIB_BUFFER_PRE_DATA_SIZE); adj->lookup_next_index = copy_adj->lookup_next_index; ip_share_adjacency(lm, adj_index); ip_call_add_del_adjacency_callbacks (lm, adj_index, /* is_del */ 0); @@ -343,7 +343,7 @@ static u32 ip_multipath_normalize_next_hops (ip_lookup_main_t * lm, } else { - memcpy (nhs, raw_next_hops, n_nhs * sizeof (raw_next_hops[0])); + clib_memcpy (nhs, raw_next_hops, n_nhs * sizeof (raw_next_hops[0])); qsort (nhs, n_nhs, sizeof (nhs[0]), (void *) next_hop_sort_by_weight); } @@ -471,7 +471,7 @@ ip_multipath_adjacency_get (ip_lookup_main_t * lm, madj->normalized_next_hops.heap_offset = heap_alloc (lm->next_hop_heap, vec_len (nhs), madj->normalized_next_hops.heap_handle); - memcpy (lm->next_hop_heap + madj->normalized_next_hops.heap_offset, + clib_memcpy (lm->next_hop_heap + madj->normalized_next_hops.heap_offset, nhs, vec_bytes (nhs)); hash_set (lm->multipath_adjacency_by_next_hops, @@ -482,7 +482,7 @@ ip_multipath_adjacency_get (ip_lookup_main_t * lm, madj->unnormalized_next_hops.heap_offset = heap_alloc (lm->next_hop_heap, vec_len (raw_next_hops), madj->unnormalized_next_hops.heap_handle); - memcpy (lm->next_hop_heap + madj->unnormalized_next_hops.heap_offset, + clib_memcpy (lm->next_hop_heap + madj->unnormalized_next_hops.heap_offset, raw_next_hops, vec_bytes (raw_next_hops)); ip_call_add_del_adjacency_callbacks (lm, adj_index, /* is_del */ 0); diff --git a/vnet/vnet/ip/udp.h b/vnet/vnet/ip/udp.h index 2b82139d..26056bd6 100644 --- a/vnet/vnet/ip/udp.h +++ b/vnet/vnet/ip/udp.h @@ -124,11 +124,7 @@ ip4_udp_encap_one (vlib_main_t * vm, vlib_buffer_t * b0, u8 * ec0, word ec_len) ip0 = vlib_buffer_get_current(b0); /* Apply the encap string. */ -#if DPDK > 0 - rte_memcpy(ip0, ec0, ec_len); -#else - memcpy(ip0, ec0, ec_len); -#endif + clib_memcpy(ip0, ec0, ec_len); /* fix the <bleep>ing outer-IP checksum */ sum0 = ip0->checksum; @@ -167,13 +163,8 @@ ip4_udp_encap_two (vlib_main_t * vm, vlib_buffer_t * b0, vlib_buffer_t * b1, ip1 = vlib_buffer_get_current (b1); /* Apply the encap string */ -#if DPDK > 0 - rte_memcpy (ip0, ec0, ec_len); - rte_memcpy (ip1, ec1, ec_len); -#else - memcpy (ip0, ec0, ec_len); - memcpy (ip1, ec1, ec_len); -#endif + clib_memcpy (ip0, ec0, ec_len); + clib_memcpy (ip1, ec1, ec_len); /* fix the <bleep>ing outer-IP checksum */ sum0 = ip0->checksum; diff --git a/vnet/vnet/ipsec/esp_encrypt.c b/vnet/vnet/ipsec/esp_encrypt.c index 68add4c3..7194399f 100644 --- a/vnet/vnet/ipsec/esp_encrypt.c +++ b/vnet/vnet/ipsec/esp_encrypt.c @@ -303,7 +303,7 @@ esp_encrypt_node_fn (vlib_main_t * vm, u8 iv[16]; RAND_bytes(iv, sizeof(iv)); - memcpy((u8 *) vlib_buffer_get_current (o_b0) + ip_hdr_size + + clib_memcpy((u8 *) vlib_buffer_get_current (o_b0) + ip_hdr_size + sizeof(esp_header_t), iv, 16 ); esp_encrypt_aes_cbc(sa0->crypto_alg, diff --git a/vnet/vnet/ipsec/ikev2.c b/vnet/vnet/ipsec/ikev2.c index 541ba0b9..17b297b8 100644 --- a/vnet/vnet/ipsec/ikev2.c +++ b/vnet/vnet/ipsec/ikev2.c @@ -154,7 +154,7 @@ ikev2_select_proposal(ikev2_sa_proposal_t *proposals, ikev2_protocol_id_t prot_i { bitmap |= 1 << transform->type; vec_add2(rv->transforms, new_t, 1); - memcpy(new_t, transform, sizeof(*new_t)); + clib_memcpy(new_t, transform, sizeof(*new_t)); new_t->attrs = vec_dup(transform->attrs); } } @@ -383,37 +383,37 @@ ikev2_calc_keys(ikev2_sa_t *sa) /* SK_d */ sa->sk_d = vec_new(u8, tr_prf->key_trunc); - memcpy(sa->sk_d, keymat + pos, tr_prf->key_trunc); + clib_memcpy(sa->sk_d, keymat + pos, tr_prf->key_trunc); pos += tr_prf->key_trunc; /* SK_ai */ sa->sk_ai = vec_new(u8, tr_integ->key_len); - memcpy(sa->sk_ai, keymat + pos, tr_integ->key_len); + clib_memcpy(sa->sk_ai, keymat + pos, tr_integ->key_len); pos += tr_integ->key_len; /* SK_ar */ sa->sk_ar = vec_new(u8, tr_integ->key_len); - memcpy(sa->sk_ar, keymat + pos, tr_integ->key_len); + clib_memcpy(sa->sk_ar, keymat + pos, tr_integ->key_len); pos += tr_integ->key_len; /* SK_ei */ sa->sk_ei = vec_new(u8, tr_encr->key_len); - memcpy(sa->sk_ei, keymat + pos, tr_encr->key_len); + clib_memcpy(sa->sk_ei, keymat + pos, tr_encr->key_len); pos += tr_encr->key_len; /* SK_er */ sa->sk_er = vec_new(u8, tr_encr->key_len); - memcpy(sa->sk_er, keymat + pos, tr_encr->key_len); + clib_memcpy(sa->sk_er, keymat + pos, tr_encr->key_len); pos += tr_encr->key_len; /* SK_pi */ sa->sk_pi = vec_new(u8, tr_prf->key_len); - memcpy(sa->sk_pi, keymat + pos, tr_prf->key_len); + clib_memcpy(sa->sk_pi, keymat + pos, tr_prf->key_len); pos += tr_prf->key_len; /* SK_pr */ sa->sk_pr = vec_new(u8, tr_prf->key_len); - memcpy(sa->sk_pr, keymat + pos, tr_prf->key_len); + clib_memcpy(sa->sk_pr, keymat + pos, tr_prf->key_len); pos += tr_prf->key_len; vec_free(keymat); @@ -440,22 +440,22 @@ ikev2_calc_child_keys(ikev2_sa_t *sa, ikev2_child_sa_t * child) /* SK_ei */ child->sk_ei = vec_new(u8, ctr_encr->key_len); - memcpy(child->sk_ei, keymat + pos, ctr_encr->key_len); + clib_memcpy(child->sk_ei, keymat + pos, ctr_encr->key_len); pos += ctr_encr->key_len; /* SK_ai */ child->sk_ai = vec_new(u8, ctr_integ->key_len); - memcpy(child->sk_ai, keymat + pos, ctr_integ->key_len); + clib_memcpy(child->sk_ai, keymat + pos, ctr_integ->key_len); pos += ctr_integ->key_len; /* SK_er */ child->sk_er = vec_new(u8, ctr_encr->key_len); - memcpy(child->sk_er, keymat + pos, ctr_encr->key_len); + clib_memcpy(child->sk_er, keymat + pos, ctr_encr->key_len); pos += ctr_encr->key_len; /* SK_ar */ child->sk_ar = vec_new(u8, ctr_integ->key_len); - memcpy(child->sk_ar, keymat + pos, ctr_integ->key_len); + clib_memcpy(child->sk_ar, keymat + pos, ctr_integ->key_len); pos += ctr_integ->key_len; ASSERT(pos == len); @@ -887,7 +887,7 @@ ikev2_process_create_child_sa_req(vlib_main_t * vm, ikev2_sa_t *sa, ike_header_t } else if (payload == IKEV2_PAYLOAD_NONCE) { - memcpy(i_nonce, ikep->payload, plen - sizeof(*ikep)); + clib_memcpy(i_nonce, ikep->payload, plen - sizeof(*ikep)); } else if (payload == IKEV2_PAYLOAD_TSI) { @@ -1453,7 +1453,7 @@ ikev2_generate_resp(ikev2_sa_t *sa, ike_header_t * ike) tlen += vec_len(chain->data); ike->nextpayload = chain->first_payload_type; ike->length = clib_host_to_net_u32(tlen); - memcpy(ike->payload, chain->data, vec_len(chain->data)); + clib_memcpy(ike->payload, chain->data, vec_len(chain->data)); /* store whole IKE payload - needed for PSK auth */ vec_free(sa->last_sa_init_res_packet_data); @@ -1484,7 +1484,7 @@ ikev2_generate_resp(ikev2_sa_t *sa, ike_header_t * ike) integ = ikev2_calc_integr(tr_integ, sa->sk_ar, (u8 *) ike, tlen - tr_integ->key_trunc); - memcpy(ike->payload + tlen - tr_integ->key_trunc - sizeof(*ike), + clib_memcpy(ike->payload + tlen - tr_integ->key_trunc - sizeof(*ike), integ, tr_integ->key_trunc); /* store whole IKE payload - needed for retransmit */ @@ -1539,7 +1539,7 @@ ikev2_retransmit_sa_init (ike_header_t * ike, ike->flags = tmp->flags; ike->msgid = tmp->msgid; ike->length = tmp->length; - memcpy(ike->payload, tmp->payload, + clib_memcpy(ike->payload, tmp->payload, clib_net_to_host_u32(tmp->length) - sizeof(*ike)); clib_warning("IKE_SA_INIT retransmit from %U to %U", format_ip4_address, &raddr, @@ -1590,7 +1590,7 @@ ikev2_retransmit_resp (ikev2_sa_t * sa, ike_header_t * ike) ike->flags = tmp->flags; ike->msgid = tmp->msgid; ike->length = tmp->length; - memcpy(ike->payload, tmp->payload, + clib_memcpy(ike->payload, tmp->payload, clib_net_to_host_u32(tmp->length) - sizeof(*ike)); clib_warning("IKE msgid %u retransmit from %U to %U", msg_id, @@ -1711,7 +1711,7 @@ ikev2_node_fn (vlib_main_t * vm, { /* add SA to the pool */ pool_get (km->sas, sa0); - memcpy(sa0, &sa, sizeof(*sa0)); + clib_memcpy(sa0, &sa, sizeof(*sa0)); hash_set (km->sa_by_rspi, sa0->rspi, sa0 - km->sas); } else diff --git a/vnet/vnet/ipsec/ikev2_cli.c b/vnet/vnet/ipsec/ikev2_cli.c index 1e6009f0..e42f16d8 100644 --- a/vnet/vnet/ipsec/ikev2_cli.c +++ b/vnet/vnet/ipsec/ikev2_cli.c @@ -217,7 +217,7 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, unformat_ip4_address, &ip4)) { data = vec_new(u8, 4); - memcpy(data, ip4.as_u8, 4); + clib_memcpy(data, ip4.as_u8, 4); r = ikev2_set_profile_id(vm, name, (u8) id_type, data, /*local*/ 1); goto done; } @@ -242,7 +242,7 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, unformat_ip4_address, &ip4)) { data = vec_new(u8, 4); - memcpy(data, ip4.as_u8, 4); + clib_memcpy(data, ip4.as_u8, 4); r = ikev2_set_profile_id(vm, name, (u8) id_type, data, /*remote*/ 0); goto done; } diff --git a/vnet/vnet/ipsec/ikev2_payload.c b/vnet/vnet/ipsec/ikev2_payload.c index a1ee5192..4ad86991 100644 --- a/vnet/vnet/ipsec/ikev2_payload.c +++ b/vnet/vnet/ipsec/ikev2_payload.c @@ -171,7 +171,7 @@ ikev2_payload_add_sa(ikev2_payload_chain_t * c, ikev2_sa_proposal_t * proposals) tr->transform_len = clib_host_to_net_u16(sizeof(*tr) + vec_len(t->attrs)); if (vec_len(t->attrs) > 0) - memcpy(tr->attributes, t->attrs, vec_len(t->attrs)); + clib_memcpy(tr->attributes, t->attrs, vec_len(t->attrs)); DBG_PLD("transform type %U transform_id %u last_or_more %u attr_size %u%s%U", format_ikev2_transform_type, tr->transform_type, @@ -238,7 +238,7 @@ ikev2_payload_add_delete(ikev2_payload_chain_t *c, ikev2_delete_t * d) { u8 * data = vec_new(u8, 4); u32 spi = clib_host_to_net_u32(d2->spi); - memcpy(data, &spi, 4); + clib_memcpy(data, &spi, 4); ikev2_payload_add_data(c, data); vec_free(data); } @@ -422,7 +422,7 @@ ikev2_parse_notify_payload(ike_payload_header_t * ikep) if (n->spi_size == 4) { - memcpy(&spi, n->payload, n->spi_size); + clib_memcpy(&spi, n->payload, n->spi_size); r->spi = clib_net_to_host_u32(spi); DBG_PLD("spi %lx", r->spi); } diff --git a/vnet/vnet/ipsec/ipsec.c b/vnet/vnet/ipsec/ipsec.c index c6a83557..47beafc3 100644 --- a/vnet/vnet/ipsec/ipsec.c +++ b/vnet/vnet/ipsec/ipsec.c @@ -191,7 +191,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) u32 policy_index; pool_get (spd->policies, vp); - memcpy (vp, policy, sizeof (*vp)); + clib_memcpy (vp, policy, sizeof (*vp)); policy_index = vp - spd->policies; if (policy->is_outbound) @@ -199,14 +199,14 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) if (policy->is_ipv6) { vec_add1 (spd->ipv6_outbound_policies, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function (spd->ipv6_outbound_policies, ipsec_spd_entry_sort); } else { vec_add1 (spd->ipv4_outbound_policies, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function (spd->ipv4_outbound_policies, ipsec_spd_entry_sort); } @@ -219,7 +219,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) { vec_add1 (spd->ipv6_inbound_protect_policy_indices, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function ( spd->ipv6_inbound_protect_policy_indices, ipsec_spd_entry_sort); @@ -228,7 +228,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) { vec_add1 (spd->ipv6_inbound_policy_discard_and_bypass_indices, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function ( spd->ipv6_inbound_policy_discard_and_bypass_indices, ipsec_spd_entry_sort); @@ -240,7 +240,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) { vec_add1 (spd->ipv4_inbound_protect_policy_indices, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function ( spd->ipv4_inbound_protect_policy_indices, ipsec_spd_entry_sort); @@ -249,7 +249,7 @@ ipsec_add_del_policy(vlib_main_t * vm, ipsec_policy_t * policy, int is_add) { vec_add1 (spd->ipv4_inbound_policy_discard_and_bypass_indices, policy_index); - memcpy(vp, policy, sizeof(ipsec_policy_t)); + clib_memcpy(vp, policy, sizeof(ipsec_policy_t)); vec_sort_with_function ( spd->ipv4_inbound_policy_discard_and_bypass_indices, ipsec_spd_entry_sort); @@ -432,7 +432,7 @@ ipsec_add_del_sa(vlib_main_t * vm, ipsec_sa_t * new_sa, int is_add) else /* create new SA */ { pool_get (im->sad, sa); - memcpy (sa, new_sa, sizeof (*sa)); + clib_memcpy (sa, new_sa, sizeof (*sa)); sa_index = sa - im->sad; hash_set (im->sa_index_by_sa_id, sa->id, sa_index); } @@ -457,14 +457,14 @@ ipsec_set_sa_key(vlib_main_t * vm, ipsec_sa_t * sa_update) /* new crypto key */ if (0 < sa_update->crypto_key_len) { - memcpy(sa->crypto_key, sa_update->crypto_key, sa_update->crypto_key_len); + clib_memcpy(sa->crypto_key, sa_update->crypto_key, sa_update->crypto_key_len); sa->crypto_key_len = sa_update->crypto_key_len; } /* new integ key */ if (0 < sa_update->integ_key_len) { - memcpy(sa->integ_key, sa_update->integ_key, sa_update->integ_key_len); + clib_memcpy(sa->integ_key, sa_update->integ_key, sa_update->integ_key_len); sa->integ_key_len = sa_update->integ_key_len; } diff --git a/vnet/vnet/ipsec/ipsec_if.c b/vnet/vnet/ipsec/ipsec_if.c index f4c53584..30631b60 100644 --- a/vnet/vnet/ipsec/ipsec_if.c +++ b/vnet/vnet/ipsec/ipsec_if.c @@ -155,28 +155,28 @@ ipsec_set_interface_key(vnet_main_t * vnm, u32 hw_if_index, sa = pool_elt_at_index(im->sad, t->output_sa_index); sa->crypto_alg = alg; sa->crypto_key_len = vec_len(key); - memcpy(sa->crypto_key, key, vec_len(key)); + clib_memcpy(sa->crypto_key, key, vec_len(key)); } else if (type == IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG) { sa = pool_elt_at_index(im->sad, t->output_sa_index); sa->integ_alg = alg; sa->integ_key_len = vec_len(key); - memcpy(sa->integ_key, key, vec_len(key)); + clib_memcpy(sa->integ_key, key, vec_len(key)); } else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO) { sa = pool_elt_at_index(im->sad, t->input_sa_index); sa->crypto_alg = alg; sa->crypto_key_len = vec_len(key); - memcpy(sa->crypto_key, key, vec_len(key)); + clib_memcpy(sa->crypto_key, key, vec_len(key)); } else if (type == IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG) { sa = pool_elt_at_index(im->sad, t->input_sa_index); sa->integ_alg = alg; sa->integ_key_len = vec_len(key); - memcpy(sa->integ_key, key, vec_len(key)); + clib_memcpy(sa->integ_key, key, vec_len(key)); } else return VNET_API_ERROR_INVALID_VALUE; diff --git a/vnet/vnet/l2/l2_efp_filter.c b/vnet/vnet/l2/l2_efp_filter.c index a8bceca1..b865c375 100644 --- a/vnet/vnet/l2/l2_efp_filter.c +++ b/vnet/vnet/l2/l2_efp_filter.c @@ -347,18 +347,18 @@ l2_efp_filter_node_fn (vlib_main_t * vm, l2_efp_filter_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); - memcpy(t->raw, &h0->type, sizeof(t->raw)); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->raw, &h0->type, sizeof(t->raw)); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { ethernet_header_t * h1 = vlib_buffer_get_current (b1); l2_efp_filter_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); - memcpy(t->raw, &h1->type, sizeof(t->raw)); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->raw, &h1->type, sizeof(t->raw)); } } @@ -462,9 +462,9 @@ l2_efp_filter_node_fn (vlib_main_t * vm, l2_efp_filter_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); - memcpy(t->raw, &h0->type, sizeof(t->raw)); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->raw, &h0->type, sizeof(t->raw)); } /* verify speculative enqueue, maybe switch current next frame */ diff --git a/vnet/vnet/l2/l2_flood.c b/vnet/vnet/l2/l2_flood.c index e0c4bb7a..ca8c171c 100644 --- a/vnet/vnet/l2/l2_flood.c +++ b/vnet/vnet/l2/l2_flood.c @@ -350,8 +350,8 @@ l2flood_node_fn (vlib_main_t * vm, ethernet_header_t * h0 = vlib_buffer_get_current (b0); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED)) { @@ -359,8 +359,8 @@ l2flood_node_fn (vlib_main_t * vm, ethernet_header_t * h1 = vlib_buffer_get_current (b1); t->sw_if_index = sw_if_index1; t->bd_index = vnet_buffer(b1)->l2.bd_index; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -406,8 +406,8 @@ l2flood_node_fn (vlib_main_t * vm, ethernet_header_t * h0 = vlib_buffer_get_current (b0); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } /* verify speculative enqueue, maybe switch current next frame */ diff --git a/vnet/vnet/l2/l2_fwd.c b/vnet/vnet/l2/l2_fwd.c index 089d4008..88a6b69c 100644 --- a/vnet/vnet/l2/l2_fwd.c +++ b/vnet/vnet/l2/l2_fwd.c @@ -250,8 +250,8 @@ l2fwd_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { @@ -259,8 +259,8 @@ l2fwd_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; t->bd_index = vnet_buffer(b1)->l2.bd_index; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -320,8 +320,8 @@ l2fwd_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } /* process 1 pkt */ diff --git a/vnet/vnet/l2/l2_input.c b/vnet/vnet/l2/l2_input.c index 3d3d51f5..ee8f788f 100644 --- a/vnet/vnet/l2/l2_input.c +++ b/vnet/vnet/l2/l2_input.c @@ -338,16 +338,16 @@ l2input_node_fn (vlib_main_t * vm, l2input_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { ethernet_header_t * h1 = vlib_buffer_get_current (b1); l2input_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -398,8 +398,8 @@ l2input_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX]; t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } em->counters[node_counter_base_index + L2INPUT_ERROR_L2INPUT] += 1; diff --git a/vnet/vnet/l2/l2_input_vtr.c b/vnet/vnet/l2/l2_input_vtr.c index d07a0287..bbef33a9 100644 --- a/vnet/vnet/l2/l2_input_vtr.c +++ b/vnet/vnet/l2/l2_input_vtr.c @@ -189,18 +189,18 @@ l2_invtr_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); ethernet_header_t * h0 = vlib_buffer_get_current (b0); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); - memcpy(t->raw, &h0->type, sizeof(t->raw)); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->raw, &h0->type, sizeof(t->raw)); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { l2_invtr_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); ethernet_header_t * h1 = vlib_buffer_get_current (b1); t->sw_if_index = sw_if_index0; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); - memcpy(t->raw, &h1->type, sizeof(t->raw)); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->raw, &h1->type, sizeof(t->raw)); } } @@ -257,9 +257,9 @@ l2_invtr_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); ethernet_header_t * h0 = vlib_buffer_get_current (b0); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); - memcpy(t->raw, &h0->type, sizeof(t->raw)); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->raw, &h0->type, sizeof(t->raw)); } /* verify speculative enqueue, maybe switch current next frame */ diff --git a/vnet/vnet/l2/l2_learn.c b/vnet/vnet/l2/l2_learn.c index 29315bed..a891cb3c 100644 --- a/vnet/vnet/l2/l2_learn.c +++ b/vnet/vnet/l2/l2_learn.c @@ -291,8 +291,8 @@ l2learn_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { @@ -300,8 +300,8 @@ l2learn_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; t->bd_index = vnet_buffer(b1)->l2.bd_index; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -366,8 +366,8 @@ l2learn_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->bd_index = vnet_buffer(b0)->l2.bd_index; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } /* process 1 pkt */ diff --git a/vnet/vnet/l2/l2_output.c b/vnet/vnet/l2/l2_output.c index bea640c8..a550d075 100644 --- a/vnet/vnet/l2/l2_output.c +++ b/vnet/vnet/l2/l2_output.c @@ -192,16 +192,16 @@ l2output_node_fn (vlib_main_t * vm, l2output_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { l2output_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -329,8 +329,8 @@ l2output_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; h0 = vlib_buffer_get_current (b0); - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } em->counters[node_counter_base_index + L2OUTPUT_ERROR_L2OUTPUT] += 1; diff --git a/vnet/vnet/l2/l2_output_acl.c b/vnet/vnet/l2/l2_output_acl.c index 2f6c1dce..f75345f1 100644 --- a/vnet/vnet/l2/l2_output_acl.c +++ b/vnet/vnet/l2/l2_output_acl.c @@ -165,8 +165,8 @@ l2_outacl_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; t->next_index = next0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } if (b1->flags & VLIB_BUFFER_IS_TRACED) { @@ -174,8 +174,8 @@ l2_outacl_node_fn (vlib_main_t * vm, vlib_add_trace (vm, node, b1, sizeof (*t)); t->sw_if_index = sw_if_index1; t->next_index = next1; - memcpy(t->src, h1->src_address, 6); - memcpy(t->dst, h1->dst_address, 6); + clib_memcpy(t->src, h1->src_address, 6); + clib_memcpy(t->dst, h1->dst_address, 6); } } @@ -217,8 +217,8 @@ l2_outacl_node_fn (vlib_main_t * vm, l2_outacl_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sw_if_index = sw_if_index0; - memcpy(t->src, h0->src_address, 6); - memcpy(t->dst, h0->dst_address, 6); + clib_memcpy(t->src, h0->src_address, 6); + clib_memcpy(t->dst, h0->dst_address, 6); } em->counters[node_counter_base_index + L2_OUTACL_ERROR_L2_OUTACL] += 1; diff --git a/vnet/vnet/l2/l2_rw.c b/vnet/vnet/l2/l2_rw.c index c325ecec..8c62b888 100644 --- a/vnet/vnet/l2/l2_rw.c +++ b/vnet/vnet/l2/l2_rw.c @@ -331,8 +331,8 @@ int l2_rw_mod_entry(u32 *index, vec_alloc_aligned(e->value, e->rewrite_n_vectors, sizeof(u32x4)); memset(e->value, 0, e->rewrite_n_vectors * sizeof(u32x4)); - memcpy(((u8 *)e->value) + skip, value, len); - memcpy(((u8 *)e->mask) + skip, mask, len); + clib_memcpy(((u8 *)e->value) + skip, value, len); + clib_memcpy(((u8 *)e->mask) + skip, mask, len); int i; for (i = 0; i < e->rewrite_n_vectors; i++) { diff --git a/vnet/vnet/l2tp/l2tp.c b/vnet/vnet/l2tp/l2tp.c index 36567f96..d359a50e 100644 --- a/vnet/vnet/l2tp/l2tp.c +++ b/vnet/vnet/l2tp/l2tp.c @@ -334,8 +334,8 @@ int create_l2tpv3_ipv6_tunnel (l2t_main_t * lm, pool_get (lm->sessions, s); memset (s, 0, sizeof (*s)); - memcpy (&s->our_address, our_address, sizeof (s->our_address)); - memcpy (&s->client_address, client_address, sizeof (s->client_address)); + clib_memcpy (&s->our_address, our_address, sizeof (s->our_address)); + clib_memcpy (&s->client_address, client_address, sizeof (s->client_address)); s->local_cookie[0] = clib_host_to_net_u64 (local_cookie); s->remote_cookie = clib_host_to_net_u64 (remote_cookie); s->local_session_id = local_session_id; @@ -350,13 +350,13 @@ int create_l2tpv3_ipv6_tunnel (l2t_main_t * lm, switch (lm->lookup_type) { case L2T_LOOKUP_SRC_ADDRESS: src_address_copy = clib_mem_alloc (sizeof (*src_address_copy)); - memcpy (src_address_copy, client_address, sizeof (*src_address_copy)); + clib_memcpy (src_address_copy, client_address, sizeof (*src_address_copy)); hash_set_mem (lm->session_by_src_address, src_address_copy, s - lm->sessions); break; case L2T_LOOKUP_DST_ADDRESS: dst_address_copy = clib_mem_alloc (sizeof (*dst_address_copy)); - memcpy (dst_address_copy, our_address, sizeof (*dst_address_copy)); + clib_memcpy (dst_address_copy, our_address, sizeof (*dst_address_copy)); hash_set_mem (lm->session_by_dst_address, dst_address_copy, s - lm->sessions); break; diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c index f60405e7..3448fb3e 100644 --- a/vnet/vnet/lisp-cp/control.c +++ b/vnet/vnet/lisp-cp/control.c @@ -894,7 +894,7 @@ get_local_iface_ip_for_dst (lisp_cp_main_t *lcm, ip_address_t * dst, } else if (l6) { - memcpy (&ip_addr_v6(sloc), l6, sizeof(*l6)); + clib_memcpy (&ip_addr_v6(sloc), l6, sizeof(*l6)); ip_addr_version(sloc) = IP6; } else @@ -1069,9 +1069,9 @@ get_src_and_dst (void *hdr, ip_address_t * src, ip_address_t *dst) else { ip6 = hdr; - memcpy (&ip_addr_v6(src), &ip6->src_address, sizeof(ip6->src_address)); + clib_memcpy (&ip_addr_v6(src), &ip6->src_address, sizeof(ip6->src_address)); ip_addr_version(src) = IP6; - memcpy (&ip_addr_v6(dst), &ip6->dst_address, sizeof(ip6->dst_address)); + clib_memcpy (&ip_addr_v6(dst), &ip6->dst_address, sizeof(ip6->dst_address)); ip_addr_version(dst) = IP6; } } @@ -1132,7 +1132,7 @@ lisp_cp_lookup (vlib_main_t * vm, vlib_node_runtime_t * node, lisp_cp_lookup_trace_t *tr = vlib_add_trace (vm, node, p0, sizeof(*tr)); gid_address_copy (&tr->dst_eid, &dst); - memcpy (&tr->map_resolver_ip, + clib_memcpy (&tr->map_resolver_ip, vec_elt_at_index(lcm->map_resolvers, 0), sizeof(ip_address_t)); } diff --git a/vnet/vnet/lisp-cp/gid_dictionary.c b/vnet/vnet/lisp-cp/gid_dictionary.c index dd10856c..4da52034 100644 --- a/vnet/vnet/lisp-cp/gid_dictionary.c +++ b/vnet/vnet/lisp-cp/gid_dictionary.c @@ -132,7 +132,7 @@ add_del_ip4_key (gid_dictionary_t *db, u32 vni, ip_prefix_t * pref, u32 val, ip4_address_t key; u8 plen = ip_prefix_len (pref); - memcpy (&key, &ip_prefix_v4(pref), sizeof(key)); + clib_memcpy (&key, &ip_prefix_v4(pref), sizeof(key)); key.as_u32 &= db->ip4_fib_masks[plen].as_u32; if (is_add) { @@ -197,7 +197,7 @@ add_del_ip6_key (gid_dictionary_t *db, u32 vni, ip_prefix_t *pref, u32 val, ip6_address_t key; u8 plen = ip_prefix_len (pref); - memcpy (&key, &ip_prefix_v6(pref), sizeof(key)); + clib_memcpy (&key, &ip_prefix_v6(pref), sizeof(key)); ip6_address_mask (&key, &db->ip6_fib_masks[plen]); if (is_add) { diff --git a/vnet/vnet/lisp-cp/lisp_types.c b/vnet/vnet/lisp-cp/lisp_types.c index c65745dd..6c9cb7d2 100644 --- a/vnet/vnet/lisp-cp/lisp_types.c +++ b/vnet/vnet/lisp-cp/lisp_types.c @@ -218,7 +218,7 @@ ip4_address_put (u8 * b, ip4_address_t * a) { *(u16 *)b = clib_host_to_net_u16(ip_version_to_iana_afi(IP4)); u8 *p = b + sizeof (u16); - memcpy (p, a, sizeof(*a)); + clib_memcpy (p, a, sizeof(*a)); return ip4_address_size_to_put(); } @@ -227,7 +227,7 @@ ip6_address_put (u8 * b, ip6_address_t * a) { *(u16 *)b = clib_host_to_net_u16(ip_version_to_iana_afi(IP6)); u8 *p = b + sizeof (u16); - memcpy (p, a, sizeof(*a)); + clib_memcpy (p, a, sizeof(*a)); return ip6_address_size_to_put(); } @@ -237,7 +237,7 @@ ip_address_put (u8 * b, ip_address_t * a) u32 len = ip_address_size (a); *(u16 *) b = clib_host_to_net_u16(ip_address_iana_afi (a)); u8 * p = b + sizeof (u16); - memcpy (p, &ip_addr_addr (a), len); + clib_memcpy (p, &ip_addr_addr (a), len); return (len + sizeof (u16)); } @@ -246,7 +246,7 @@ ip_address_parse(void * offset, u16 iana_afi, ip_address_t *dst) { ip_addr_version(dst) = ip_iana_afi_to_version (iana_afi); u8 size = ip_version_to_size (ip_addr_version(dst)); - memcpy (&ip_addr_addr(dst), offset + sizeof(u16), size); + clib_memcpy (&ip_addr_addr(dst), offset + sizeof(u16), size); return(sizeof(u16) + size); } @@ -304,7 +304,7 @@ ip_prefix_length (void *a) void ip_prefix_copy (void * dst , void * src) { - memcpy (dst, src, sizeof (ip_prefix_t)); + clib_memcpy (dst, src, sizeof (ip_prefix_t)); } int @@ -463,7 +463,7 @@ void locator_copy (locator_t * dst, locator_t * src) { /* TODO if gid become more complex, this will need to be changed! */ - memcpy (dst, src, sizeof(*dst)); + clib_memcpy (dst, src, sizeof(*dst)); } u32 diff --git a/vnet/vnet/lisp-cp/packets.c b/vnet/vnet/lisp-cp/packets.c index e3e006b3..aa246a9d 100644 --- a/vnet/vnet/lisp-cp/packets.c +++ b/vnet/vnet/lisp-cp/packets.c @@ -182,8 +182,8 @@ pkt_push_ipv6 (vlib_main_t * vm, vlib_buffer_t *b, ip6_address_t *src, // ip6h->ip6_vfc = (IP6VERSION << 4); // ip6h->ip6_nxt = proto; // ip6h->ip6_plen = clib_host_to_net_u16(len); -// memcpy(ip6h->ip6_src.s6_addr, src->s6_addr, sizeof(struct in6_addr)); -// memcpy(ip6h->ip6_dst.s6_addr, dst->s6_addr, sizeof(struct in6_addr)); +// clib_memcpy(ip6h->ip6_src.s6_addr, src->s6_addr, sizeof(struct in6_addr)); +// clib_memcpy(ip6h->ip6_dst.s6_addr, dst->s6_addr, sizeof(struct in6_addr)); // return(ip6h); } diff --git a/vnet/vnet/llc/llc.c b/vnet/vnet/llc/llc.c index f3b464f1..b6827d0f 100644 --- a/vnet/vnet/llc/llc.c +++ b/vnet/vnet/llc/llc.c @@ -147,7 +147,7 @@ unformat_llc_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/map/ip4_map.c b/vnet/vnet/map/ip4_map.c index adbc72e9..85b72e10 100644 --- a/vnet/vnet/map/ip4_map.c +++ b/vnet/vnet/map/ip4_map.c @@ -566,11 +566,11 @@ ip4_map_reass (vlib_main_t *vm, from = vlib_frame_vector_args(frame); u32 len = vec_len(fragments_to_loopback); if(len <= VLIB_FRAME_SIZE) { - memcpy(from, fragments_to_loopback, sizeof(u32)*len); + clib_memcpy(from, fragments_to_loopback, sizeof(u32)*len); n_left_from = len; vec_reset_length(fragments_to_loopback); } else { - memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE); + clib_memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len(fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/vnet/vnet/map/ip4_map_t.c b/vnet/vnet/map/ip4_map_t.c index 7a720681..78cfae79 100644 --- a/vnet/vnet/map/ip4_map_t.c +++ b/vnet/vnet/map/ip4_map_t.c @@ -263,7 +263,7 @@ _ip4_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error) vlib_buffer_advance(p, - 2*(sizeof(*ip6) - sizeof(*ip4)) - sizeof(*inner_frag)); ip6 = vlib_buffer_get_current(p); - memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8); + clib_memcpy(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); @@ -276,7 +276,7 @@ _ip4_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error) } else { vlib_buffer_advance(p, - 2*(sizeof(*ip6) - sizeof(*ip4))); ip6 = vlib_buffer_get_current(p); - memcpy(u8_ptr_add(ip6, sizeof(*ip6) - sizeof(*ip4)), ip4, 20 + 8); + clib_memcpy(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)); inner_ip6 = (ip6_header_t *) u8_ptr_add(inner_ip4, sizeof(*ip4) - sizeof(*ip6)); diff --git a/vnet/vnet/map/ip6_map.c b/vnet/vnet/map/ip6_map.c index 208f45f5..694d2494 100644 --- a/vnet/vnet/map/ip6_map.c +++ b/vnet/vnet/map/ip6_map.c @@ -453,7 +453,7 @@ ip6_map_ip6_reass_prepare(vlib_main_t *vm, vlib_node_runtime_t *node, map_ip6_re if (ip6_frag_hdr_offset(frag0)) { //Not first fragment, add the IPv4 header - memcpy(ip40, &r->ip4_header, 20); + clib_memcpy(ip40, &r->ip4_header, 20); } #ifdef MAP_IP6_REASS_COUNT_BYTES @@ -462,7 +462,7 @@ ip6_map_ip6_reass_prepare(vlib_main_t *vm, vlib_node_runtime_t *node, map_ip6_re if (ip6_frag_hdr_more(frag0)) { //Not last fragment, we copy end of next - memcpy(u8_ptr_add(ip60, p0->current_length), r->fragments[i].next_data, 20); + clib_memcpy(u8_ptr_add(ip60, p0->current_length), r->fragments[i].next_data, 20); p0->current_length += 20; ip60->payload_length = u16_net_add(ip60->payload_length, 20); } @@ -760,11 +760,11 @@ ip6_map_ip4_reass (vlib_main_t *vm, from = vlib_frame_vector_args(frame); u32 len = vec_len(fragments_to_loopback); if(len <= VLIB_FRAME_SIZE) { - memcpy(from, fragments_to_loopback, sizeof(u32)*len); + clib_memcpy(from, fragments_to_loopback, sizeof(u32)*len); n_left_from = len; vec_reset_length(fragments_to_loopback); } else { - memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE); + clib_memcpy(from, fragments_to_loopback + (len - VLIB_FRAME_SIZE), sizeof(u32)*VLIB_FRAME_SIZE); n_left_from = VLIB_FRAME_SIZE; _vec_len(fragments_to_loopback) = len - VLIB_FRAME_SIZE; } diff --git a/vnet/vnet/map/ip6_map_t.c b/vnet/vnet/map/ip6_map_t.c index b2c102ac..39e8e0ab 100644 --- a/vnet/vnet/map/ip6_map_t.c +++ b/vnet/vnet/map/ip6_map_t.c @@ -337,7 +337,7 @@ _ip6_map_t_icmp (map_domain_t *d, vlib_buffer_t *p, u8 *error) //Move up icmp header ip4 = (ip4_header_t *) u8_ptr_add(inner_l4, - 2 * sizeof(*ip4) - 8); - memcpy(u8_ptr_add(inner_l4, - sizeof(*ip4) - 8), icmp, 8); + clib_memcpy(u8_ptr_add(inner_l4, - sizeof(*ip4) - 8), icmp, 8); icmp = (icmp46_header_t *) u8_ptr_add(inner_l4, - sizeof(*ip4) - 8); } else { //Only one header to translate diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c index deeab4d1..f91a8718 100644 --- a/vnet/vnet/map/map.c +++ b/vnet/vnet/map/map.c @@ -1420,7 +1420,7 @@ map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi, if (!prev_f) return -1; - memcpy(prev_f->next_data, data_start, copied_len); + clib_memcpy(prev_f->next_data, data_start, copied_len); prev_f->next_data_len = copied_len; prev_f->next_data_offset = data_offset; } else { @@ -1428,7 +1428,7 @@ map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi, return -1; if (r->ip4_header.ip_version_and_header_length == 0) - memcpy(&r->ip4_header, data_start, sizeof(ip4_header_t)); + clib_memcpy(&r->ip4_header, data_start, sizeof(ip4_header_t)); } if(data_len > 20) { diff --git a/vnet/vnet/mpls-gre/interface.c b/vnet/vnet/mpls-gre/interface.c index 259211a9..408ca750 100644 --- a/vnet/vnet/mpls-gre/interface.c +++ b/vnet/vnet/mpls-gre/interface.c @@ -129,8 +129,8 @@ mpls_gre_interface_tx (vlib_main_t * vm, dst0 = vlib_buffer_get_current (b0); dst1 = vlib_buffer_get_current (b1); - memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); - memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data)); + clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); + clib_memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data)); /* Fix TX fib indices */ vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->outer_fib_index; @@ -197,7 +197,7 @@ mpls_gre_interface_tx (vlib_main_t * vm, dst0 = vlib_buffer_get_current (b0); - memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); + clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); /* Fix the TX fib index */ vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->outer_fib_index; @@ -378,8 +378,8 @@ mpls_eth_interface_tx (vlib_main_t * vm, dst0 = vlib_buffer_get_current (b0); dst1 = vlib_buffer_get_current (b1); - memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); - memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data)); + clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); + clib_memcpy (dst1, t1->rewrite_data, vec_len(t1->rewrite_data)); /* Fix TX fib indices */ vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->tx_sw_if_index; @@ -399,7 +399,7 @@ mpls_eth_interface_tx (vlib_main_t * vm, tr->mpls_encap_index = t0->encap_index; tr->length = b0->current_length; hi0 = vnet_get_sup_hw_interface (vnm, t0->tx_sw_if_index); - memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst)); + clib_memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst)); } if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED)) { @@ -411,7 +411,7 @@ mpls_eth_interface_tx (vlib_main_t * vm, tr->mpls_encap_index = t1->encap_index; tr->length = b0->current_length; hi1 = vnet_get_sup_hw_interface (vnm, t1->tx_sw_if_index); - memcpy (tr->dst, hi1->hw_address, sizeof (tr->dst)); + clib_memcpy (tr->dst, hi1->hw_address, sizeof (tr->dst)); } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, @@ -447,7 +447,7 @@ mpls_eth_interface_tx (vlib_main_t * vm, dst0 = vlib_buffer_get_current (b0); - memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); + clib_memcpy (dst0, t0->rewrite_data, vec_len(t0->rewrite_data)); /* Fix the TX interface */ vnet_buffer(b0)->sw_if_index [VLIB_TX] = t0->tx_sw_if_index; @@ -465,7 +465,7 @@ mpls_eth_interface_tx (vlib_main_t * vm, tr->mpls_encap_index = t0->encap_index; tr->length = b0->current_length; hi0 = vnet_get_sup_hw_interface (vnm, t0->tx_sw_if_index); - memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst)); + clib_memcpy (tr->dst, hi0->hw_address, sizeof (tr->dst)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, @@ -1394,7 +1394,7 @@ int vnet_mpls_ethernet_add_del_tunnel (u8 *dst, tp->hw_if_index = hw_if_index; reinstall_it: - memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst)); + clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst)); tp->intfc_address.as_u32 = intfc->as_u32; tp->mask_width = mask_width; tp->inner_fib_index = inner_fib_index; @@ -1436,7 +1436,7 @@ int vnet_mpls_ethernet_add_del_tunnel (u8 *dst, * we just built to the mpls header stack */ vec_insert (rewrite_data, adj.rewrite_header.data_bytes, 0); - memcpy(rewrite_data, + clib_memcpy(rewrite_data, vnet_rewrite_get_data_internal(&adj.rewrite_header, sizeof (adj.rewrite_data)), adj.rewrite_header.data_bytes); @@ -1619,7 +1619,7 @@ int vnet_mpls_policy_tunnel_add_rewrite (mpls_main_t * mm, vec_validate (rewrite_data, adj.rewrite_header.data_bytes -1); - memcpy(rewrite_data, + clib_memcpy(rewrite_data, vnet_rewrite_get_data_internal(&adj.rewrite_header, sizeof (adj.rewrite_data)), adj.rewrite_header.data_bytes); @@ -1762,7 +1762,7 @@ int vnet_mpls_ethernet_add_del_policy_tunnel (u8 *dst, tp->hw_if_index = hw_if_index; reinstall_it: - memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst)); + clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst)); tp->intfc_address.as_u32 = intfc->as_u32; tp->mask_width = mask_width; tp->inner_fib_index = inner_fib_index; diff --git a/vnet/vnet/mpls-gre/mpls.c b/vnet/vnet/mpls-gre/mpls.c index 1e1a0970..067f799c 100644 --- a/vnet/vnet/mpls-gre/mpls.c +++ b/vnet/vnet/mpls-gre/mpls.c @@ -127,10 +127,10 @@ unformat_mpls_gre_header (unformat_input_t * input, va_list * args) u32 h_n_bytes = sizeof (h[0]); vec_add2 (*result, p, g_n_bytes); - memcpy (p, g, g_n_bytes); + clib_memcpy (p, g, g_n_bytes); vec_add2 (*result, p, h_n_bytes); - memcpy (p, h, h_n_bytes); + clib_memcpy (p, h, h_n_bytes); } return 1; diff --git a/vnet/vnet/mpls-gre/policy_encap.c b/vnet/vnet/mpls-gre/policy_encap.c index 850cdc19..b4439193 100644 --- a/vnet/vnet/mpls-gre/policy_encap.c +++ b/vnet/vnet/mpls-gre/policy_encap.c @@ -109,7 +109,7 @@ mpls_policy_encap (vlib_main_t * vm, vlib_buffer_advance (b0, -(word)vec_len(e0->rewrite)); h0 = vlib_buffer_get_current (b0); - memcpy (h0, e0->rewrite, vec_len(e0->rewrite)); + clib_memcpy (h0, e0->rewrite, vec_len(e0->rewrite)); next0 = e0->output_next_index; diff --git a/vnet/vnet/nsh-gre/encap.c b/vnet/vnet/nsh-gre/encap.c index 875e8311..8521aeae 100644 --- a/vnet/vnet/nsh-gre/encap.c +++ b/vnet/vnet/nsh-gre/encap.c @@ -152,11 +152,11 @@ nsh_gre_encap (vlib_main_t * vm, /* If there are TLVs to copy, do so */ if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24)) - memcpy (©_dst0[3], t0->rewrite + 24 , + clib_memcpy (©_dst0[3], t0->rewrite + 24 , _vec_len (t0->rewrite)-24); if (PREDICT_FALSE (_vec_len(t1->rewrite) > 24)) - memcpy (©_dst1[3], t1->rewrite + 24 , + clib_memcpy (©_dst1[3], t1->rewrite + 24 , _vec_len (t1->rewrite)-24); /* fix the <bleep>ing outer-IP checksums */ @@ -246,7 +246,7 @@ nsh_gre_encap (vlib_main_t * vm, /* If there are TLVs to copy, do so */ if (PREDICT_FALSE (_vec_len(t0->rewrite) > 24)) - memcpy (©_dst0[3], t0->rewrite + 24 , + clib_memcpy (©_dst0[3], t0->rewrite + 24 , _vec_len (t0->rewrite)-24); /* fix the <bleep>ing outer-IP checksum */ diff --git a/vnet/vnet/nsh-gre/nsh_gre.c b/vnet/vnet/nsh-gre/nsh_gre.c index f85e71a2..7f773e64 100644 --- a/vnet/vnet/nsh-gre/nsh_gre.c +++ b/vnet/vnet/nsh-gre/nsh_gre.c @@ -214,7 +214,7 @@ static int nsh_gre_rewrite (nsh_gre_tunnel_t * t) /* Copy any TLVs */ if (vec_len(t->tlvs)) - memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs)); + clib_memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs)); t->rewrite = rw; return (0); diff --git a/vnet/vnet/nsh-vxlan-gpe/encap.c b/vnet/vnet/nsh-vxlan-gpe/encap.c index b5ff5851..af520b2f 100644 --- a/vnet/vnet/nsh-vxlan-gpe/encap.c +++ b/vnet/vnet/nsh-vxlan-gpe/encap.c @@ -179,11 +179,11 @@ nsh_vxlan_gpe_encap (vlib_main_t * vm, /* If there are TLVs to copy, do so */ if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64)) - memcpy (©_dst0[3], t0->rewrite + 64 , + clib_memcpy (©_dst0[3], t0->rewrite + 64 , _vec_len (t0->rewrite)-64); if (PREDICT_FALSE (_vec_len(t1->rewrite) > 64)) - memcpy (©_dst0[3], t1->rewrite + 64 , + clib_memcpy (©_dst0[3], t1->rewrite + 64 , _vec_len (t1->rewrite)-64); /* fix the <bleep>ing outer-IP checksum */ @@ -331,7 +331,7 @@ nsh_vxlan_gpe_encap (vlib_main_t * vm, /* If there are TLVs to copy, do so */ if (PREDICT_FALSE (_vec_len(t0->rewrite) > 64)) - memcpy (©_dst0[3], t0->rewrite + 64 , + clib_memcpy (©_dst0[3], t0->rewrite + 64 , _vec_len (t0->rewrite)-64); /* fix the <bleep>ing outer-IP checksum */ diff --git a/vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.c b/vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.c index 308824e6..0d246841 100644 --- a/vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.c +++ b/vnet/vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.c @@ -218,7 +218,7 @@ static int nsh_vxlan_gpe_rewrite (nsh_vxlan_gpe_tunnel_t * t) /* Copy any TLVs */ if (vec_len(t->tlvs)) - memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs)); + clib_memcpy (nsh0->tlvs, t->tlvs, 4*vec_len(t->tlvs)); t->rewrite = rw; return (0); @@ -271,7 +271,7 @@ int vnet_nsh_vxlan_gpe_add_del_tunnel } key_copy = clib_mem_alloc (sizeof (*key_copy)); - memcpy (key_copy, &key, sizeof (*key_copy)); + clib_memcpy (key_copy, &key, sizeof (*key_copy)); hash_set_mem (ngm->nsh_vxlan_gpe_tunnel_by_key, key_copy, t - ngm->tunnels); diff --git a/vnet/vnet/osi/osi.c b/vnet/vnet/osi/osi.c index 81b9f668..5398fce3 100644 --- a/vnet/vnet/osi/osi.c +++ b/vnet/vnet/osi/osi.c @@ -141,7 +141,7 @@ unformat_osi_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/pg/input.c b/vnet/vnet/pg/input.c index 38402c2e..e3bd9f26 100644 --- a/vnet/vnet/pg/input.c +++ b/vnet/vnet/pg/input.c @@ -1182,7 +1182,7 @@ init_replay_buffers_inline (vlib_main_t * vm, b0->current_length = n0; - memcpy (b0->data, d0 + data_offset, n0); + clib_memcpy (b0->data, d0 + data_offset, n0); i = i + 1 == l ? 0 : i + 1; } } @@ -1242,8 +1242,8 @@ init_buffers_inline (vlib_main_t * vm, if (set_data) { - memcpy (b0->data, data, n_data); - memcpy (b1->data, data, n_data); + clib_memcpy (b0->data, data, n_data); + clib_memcpy (b1->data, data, n_data); } else { @@ -1267,7 +1267,7 @@ init_buffers_inline (vlib_main_t * vm, vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32)~0; if (set_data) - memcpy (b0->data, data, n_data); + clib_memcpy (b0->data, data, n_data); else ASSERT (validate_buffer_data2 (b0, s, data_offset, n_data)); } @@ -1578,11 +1578,11 @@ pg_input_trace (pg_main_t * pg, t0->packet_length = vlib_buffer_length_in_chain (vm, b0); t1->packet_length = vlib_buffer_length_in_chain (vm, b1); - memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); - memcpy (&t1->buffer, b1, sizeof (b1[0]) - sizeof (b1->pre_data)); + clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); + clib_memcpy (&t1->buffer, b1, sizeof (b1[0]) - sizeof (b1->pre_data)); - memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); - memcpy (t1->buffer.pre_data, b1->data, sizeof (t1->buffer.pre_data)); + clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); + clib_memcpy (t1->buffer.pre_data, b1->data, sizeof (t1->buffer.pre_data)); } while (n_left >= 1) @@ -1602,8 +1602,8 @@ pg_input_trace (pg_main_t * pg, t0->stream_index = stream_index; t0->packet_length = vlib_buffer_length_in_chain (vm, b0); - memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); - memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); + clib_memcpy (&t0->buffer, b0, sizeof (b0[0]) - sizeof (b0->pre_data)); + clib_memcpy (t0->buffer.pre_data, b0->data, sizeof (t0->buffer.pre_data)); } } diff --git a/vnet/vnet/pg/stream.c b/vnet/vnet/pg/stream.c index 1dd56243..71469145 100644 --- a/vnet/vnet/pg/stream.c +++ b/vnet/vnet/pg/stream.c @@ -258,8 +258,8 @@ void pg_edit_group_get_fixed_packet_data (pg_stream_t * s, vec_foreach (e, g->edits) do_edit (s, g, e, /* want_commit */ 0); - memcpy (packet_data, g->fixed_packet_data, vec_len (g->fixed_packet_data)); - memcpy (packet_data_mask, g->fixed_packet_data_mask, vec_len (g->fixed_packet_data_mask)); + clib_memcpy (packet_data, g->fixed_packet_data, vec_len (g->fixed_packet_data)); + clib_memcpy (packet_data_mask, g->fixed_packet_data_mask, vec_len (g->fixed_packet_data_mask)); } static void perform_fixed_edits (pg_stream_t * s) diff --git a/vnet/vnet/policer/policer.c b/vnet/vnet/policer/policer.c index a43dc751..2dbd02b3 100644 --- a/vnet/vnet/policer/policer.c +++ b/vnet/vnet/policer/policer.c @@ -287,8 +287,8 @@ configure_policer_command_fn (vlib_main_t * vm, ASSERT (cp - pm->configs == pp - pm->policer_templates); - memcpy (cp, &c, sizeof (*cp)); - memcpy (pp, &test_policer, sizeof (*pp)); + clib_memcpy (cp, &c, sizeof (*cp)); + clib_memcpy (pp, &test_policer, sizeof (*pp)); hash_set_mem (pm->policer_config_by_name, name, cp - pm->configs); } diff --git a/vnet/vnet/ppp/ppp.c b/vnet/vnet/ppp/ppp.c index 1537c9a5..e124e116 100644 --- a/vnet/vnet/ppp/ppp.c +++ b/vnet/vnet/ppp/ppp.c @@ -161,7 +161,7 @@ unformat_ppp_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/replication.c b/vnet/vnet/replication.c index 68426849..9e614ada 100644 --- a/vnet/vnet/replication.c +++ b/vnet/vnet/replication.c @@ -57,7 +57,7 @@ replication_prep (vlib_main_t * vm, ctx->recycle_node_index = recycle_node_index; // Save vnet state - memcpy (ctx->vnet_buffer, vnet_buffer(b0), sizeof(vnet_buffer_opaque_t)); + clib_memcpy (ctx->vnet_buffer, vnet_buffer(b0), sizeof(vnet_buffer_opaque_t)); // Save packet contents ctx->l2_packet = l2_packet; @@ -98,7 +98,7 @@ replication_recycle (vlib_main_t * vm, ctx = pool_elt_at_index (rm->contexts[cpu_number], b0->clone_count); // Restore vnet buffer state - memcpy (vnet_buffer(b0), ctx->vnet_buffer, sizeof(vnet_buffer_opaque_t)); + clib_memcpy (vnet_buffer(b0), ctx->vnet_buffer, sizeof(vnet_buffer_opaque_t)); // Restore the packet start (current_data) and length vlib_buffer_advance(b0, ctx->current_data - b0->current_data); diff --git a/vnet/vnet/rewrite.c b/vnet/vnet/rewrite.c index 6c33a2eb..a538eef3 100644 --- a/vnet/vnet/rewrite.c +++ b/vnet/vnet/rewrite.c @@ -249,7 +249,7 @@ void serialize_vnet_rewrite (serialize_main_t * m, va_list * va) serialize_integer (m, rw->data_bytes, sizeof (rw->data_bytes)); serialize_integer (m, rw->max_l3_packet_bytes, sizeof (rw->max_l3_packet_bytes)); p = serialize_get (m, rw->data_bytes); - memcpy (p, vnet_rewrite_get_data_internal (rw, max_data_bytes), rw->data_bytes); + clib_memcpy (p, vnet_rewrite_get_data_internal (rw, max_data_bytes), rw->data_bytes); } void unserialize_vnet_rewrite (serialize_main_t * m, va_list * va) @@ -266,5 +266,5 @@ void unserialize_vnet_rewrite (serialize_main_t * m, va_list * va) unserialize_integer (m, &rw->data_bytes, sizeof (rw->data_bytes)); unserialize_integer (m, &rw->max_l3_packet_bytes, sizeof (rw->max_l3_packet_bytes)); p = unserialize_get (m, rw->data_bytes); - memcpy (vnet_rewrite_get_data_internal (rw, max_data_bytes), p, rw->data_bytes); + clib_memcpy (vnet_rewrite_get_data_internal (rw, max_data_bytes), p, rw->data_bytes); } diff --git a/vnet/vnet/rewrite.h b/vnet/vnet/rewrite.h index 2e5b7f43..7ae33ba6 100644 --- a/vnet/vnet/rewrite.h +++ b/vnet/vnet/rewrite.h @@ -97,7 +97,7 @@ vnet_rewrite_set_data_internal (vnet_rewrite_header_t * rw, ASSERT ((data_bytes >= 0) && (data_bytes < max_size)); rw->data_bytes = data_bytes; - memcpy (rw->data + max_size - data_bytes, data, data_bytes); + clib_memcpy (rw->data + max_size - data_bytes, data, data_bytes); memset (rw->data, 0xfe, max_size - data_bytes); } @@ -152,7 +152,7 @@ _vnet_rewrite_one_header (vnet_rewrite_header_t * h0, eh_copy_t * s, * d; s = (eh_copy_t *)(h0->data + max_size - sizeof (eh_copy_t)); d = (eh_copy_t *)(((u8 *)packet0) - sizeof (eh_copy_t)); - __builtin_memcpy (d, s, sizeof (eh_copy_t)); + clib_memcpy (d, s, sizeof (eh_copy_t)); return; } @@ -205,10 +205,10 @@ _vnet_rewrite_two_headers (vnet_rewrite_header_t * h0, eh_copy_t * s0, * d0, * s1, * d1; s0 = (eh_copy_t *)(h0->data + max_size - sizeof (eh_copy_t)); d0 = (eh_copy_t *)(((u8 *)packet0) - sizeof (eh_copy_t)); - __builtin_memcpy (d0, s0, sizeof (eh_copy_t)); + clib_memcpy (d0, s0, sizeof (eh_copy_t)); s1 = (eh_copy_t *)(h1->data + max_size - sizeof (eh_copy_t)); d1 = (eh_copy_t *)(((u8 *)packet1) - sizeof (eh_copy_t)); - __builtin_memcpy (d1, s1, sizeof (eh_copy_t)); + clib_memcpy (d1, s1, sizeof (eh_copy_t)); return; } diff --git a/vnet/vnet/snap/snap.c b/vnet/vnet/snap/snap.c index df15f861..fb5b031c 100644 --- a/vnet/vnet/snap/snap.c +++ b/vnet/vnet/snap/snap.c @@ -164,7 +164,7 @@ unformat_snap_header (unformat_input_t * input, va_list * args) u32 n_bytes = sizeof (h[0]); vec_add2 (*result, p, n_bytes); - memcpy (p, h, n_bytes); + clib_memcpy (p, h, n_bytes); } return 1; diff --git a/vnet/vnet/sr/sr.c b/vnet/vnet/sr/sr.c index cb74a163..699df992 100644 --- a/vnet/vnet/sr/sr.c +++ b/vnet/vnet/sr/sr.c @@ -51,7 +51,7 @@ static void sr_fix_hmac (ip6_sr_main_t * sm, ip6_header_t * ip, /* pkt ip6 src address */ vec_add2 (keybuf, copy_target, sizeof (ip6_address_t)); - memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t)); + clib_memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t)); /* first segment */ vec_add2 (keybuf, copy_target, 1); @@ -75,7 +75,7 @@ static void sr_fix_hmac (ip6_sr_main_t * sm, ip6_header_t * ip, for (i = 0; i <= first_segment; i++) { vec_add2 (keybuf, copy_target, sizeof (ip6_address_t)); - memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t)); + clib_memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t)); addrp++; } @@ -380,7 +380,7 @@ sr_rewrite (vlib_main_t * vm, ip0 = vlib_buffer_get_current (b0); sr0 = (ip6_sr_header_t *) (ip0+1); /* $$$ tune */ - memcpy (sr0, t0->rewrite, vec_len (t0->rewrite)); + clib_memcpy (sr0, t0->rewrite, vec_len (t0->rewrite)); /* Fix the next header chain */ sr0->protocol = ip0->protocol; ip0->protocol = 43; /* routing extension header */ @@ -428,7 +428,7 @@ sr_rewrite (vlib_main_t * vm, vlib_buffer_advance (b1, - (word) vec_len(t1->rewrite)); ip1 = vlib_buffer_get_current (b1); sr1 = (ip6_sr_header_t *) (ip1+1); - memcpy (sr1, t1->rewrite, vec_len (t1->rewrite)); + clib_memcpy (sr1, t1->rewrite, vec_len (t1->rewrite)); sr1->protocol = ip1->protocol; ip1->protocol = 43; new_l1 = clib_net_to_host_u16(ip1->payload_length) + @@ -459,26 +459,26 @@ sr_rewrite (vlib_main_t * vm, sr_rewrite_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->tunnel_index = t0 - sm->tunnels; - memcpy (tr->src.as_u8, ip0->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = new_l0; tr->next_index = next0; - memcpy (tr->sr, sr0, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr0, sizeof (tr->sr)); } if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED)) { sr_rewrite_trace_t *tr = vlib_add_trace (vm, node, b1, sizeof (*tr)); tr->tunnel_index = t1 - sm->tunnels; - memcpy (tr->src.as_u8, ip1->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip1->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = new_l1; tr->next_index = next1; - memcpy (tr->sr, sr1, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr1, sizeof (tr->sr)); } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, @@ -554,7 +554,7 @@ sr_rewrite (vlib_main_t * vm, ip0 = vlib_buffer_get_current (b0); sr0 = (ip6_sr_header_t *) (ip0+1); /* $$$ tune */ - memcpy (sr0, t0->rewrite, vec_len (t0->rewrite)); + clib_memcpy (sr0, t0->rewrite, vec_len (t0->rewrite)); /* Fix the next header chain */ sr0->protocol = ip0->protocol; ip0->protocol = 43; /* routing extension header */ @@ -587,13 +587,13 @@ sr_rewrite (vlib_main_t * vm, sr_rewrite_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->tunnel_index = t0 - sm->tunnels; - memcpy (tr->src.as_u8, ip0->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = new_l0; tr->next_index = next0; - memcpy (tr->sr, sr0, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr0, sizeof (tr->sr)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, @@ -752,8 +752,8 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) /* remember the FIB index */ tx_fib_index = p[0]; - memcpy (key.src.as_u8, a->src_address->as_u8, sizeof (key.src)); - memcpy (key.dst.as_u8, a->dst_address->as_u8, sizeof (key.dst)); + clib_memcpy (key.src.as_u8, a->src_address->as_u8, sizeof (key.src)); + clib_memcpy (key.dst.as_u8, a->dst_address->as_u8, sizeof (key.dst)); p = hash_get_mem (sm->tunnel_index_by_key, &key); @@ -790,7 +790,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) pool_get (sm->tunnels, t); memset (t, 0, sizeof (*t)); - memcpy (&t->key, &key, sizeof (t->key)); + clib_memcpy (&t->key, &key, sizeof (t->key)); t->dst_mask_width = a->dst_mask_width; t->rx_fib_index = rx_fib_index; t->tx_fib_index = tx_fib_index; @@ -848,7 +848,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) vec_foreach (this_address, a->segments) { - memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t)); + clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t)); addrp--; } @@ -857,12 +857,12 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) vec_foreach (this_address, a->tags) { - memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t)); + clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t)); addrp++; } key_copy = vec_new (ip6_sr_tunnel_key_t, 1); - memcpy (key_copy, &key, sizeof (ip6_sr_tunnel_key_t)); + clib_memcpy (key_copy, &key, sizeof (ip6_sr_tunnel_key_t)); hash_set_mem (sm->tunnel_index_by_key, key_copy, t - sm->tunnels); memset(&adj, 0, sizeof (adj)); @@ -890,7 +890,7 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) vec_add1 (add_adj, ap[0]); - memcpy (aa.dst_address.as_u8, a->dst_address, sizeof (aa.dst_address.as_u8)); + clib_memcpy (aa.dst_address.as_u8, a->dst_address, sizeof (aa.dst_address.as_u8)); aa.dst_address_length = a->dst_mask_width; aa.flags = (a->is_del ? IP6_ROUTE_FLAG_DEL : IP6_ROUTE_FLAG_ADD); @@ -947,13 +947,13 @@ sr_add_del_tunnel_command_fn (vlib_main_t * vm, &next_address)) { vec_add2 (segments, this_seg, 1); - memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg)); + clib_memcpy (this_seg->as_u8, next_address.as_u8, sizeof (*this_seg)); } else if (unformat (input, "tag %U", unformat_ip6_address, &tag)) { vec_add2 (tags, this_tag, 1); - memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag)); + clib_memcpy (this_tag->as_u8, tag.as_u8, sizeof (*this_tag)); } else if (unformat (input, "clean")) flags |= IP6_SR_HEADER_FLAG_CLEANUP; @@ -1300,11 +1300,11 @@ sr_fix_dst_addr (vlib_main_t * vm, if (next0 != SR_FIX_DST_ADDR_NEXT_DROP) { t->adj_index = vnet_buffer(b0)->ip.adj_index[VLIB_TX]; - memcpy (t->src.as_u8, ip0->src_address.as_u8, + clib_memcpy (t->src.as_u8, ip0->src_address.as_u8, sizeof (t->src.as_u8)); - memcpy (t->dst.as_u8, ip0->dst_address.as_u8, + clib_memcpy (t->dst.as_u8, ip0->dst_address.as_u8, sizeof (t->dst.as_u8)); - memcpy (t->sr, sr0, sizeof (t->sr)); + clib_memcpy (t->sr, sr0, sizeof (t->sr)); } } @@ -1488,7 +1488,7 @@ static int sr_validate_hmac (ip6_sr_main_t * sm, ip6_header_t * ip, /* pkt ip6 src address */ vec_add2 (keybuf, copy_target, sizeof (ip6_address_t)); - memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t)); + clib_memcpy (copy_target, ip->src_address.as_u8, sizeof (ip6_address_t)); /* last segment */ vec_add2 (keybuf, copy_target, 1); @@ -1512,7 +1512,7 @@ static int sr_validate_hmac (ip6_sr_main_t * sm, ip6_header_t * ip, for (i = 0; i <= first_segment; i++) { vec_add2 (keybuf, copy_target, sizeof (ip6_address_t)); - memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t)); + clib_memcpy (copy_target, addrp->as_u8, sizeof (ip6_address_t)); addrp++; } @@ -1699,15 +1699,15 @@ sr_local (vlib_main_t * vm, { sr_local_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - memcpy (tr->src.as_u8, ip0->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = vlib_buffer_length_in_chain (vm, b0); tr->next_index = next0; tr->sr_valid = sr0 != 0; if (tr->sr_valid) - memcpy (tr->sr, sr0, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr0, sizeof (tr->sr)); } b1 = vlib_get_buffer (vm, bi1); @@ -1804,15 +1804,15 @@ sr_local (vlib_main_t * vm, { sr_local_trace_t *tr = vlib_add_trace (vm, node, b1, sizeof (*tr)); - memcpy (tr->src.as_u8, ip1->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip1->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip1->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip1->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = vlib_buffer_length_in_chain (vm, b1); tr->next_index = next1; tr->sr_valid = sr1 != 0; if (tr->sr_valid) - memcpy (tr->sr, sr1, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr1, sizeof (tr->sr)); } vlib_validate_buffer_enqueue_x2 (vm, node, next_index, @@ -1930,15 +1930,15 @@ sr_local (vlib_main_t * vm, { sr_local_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); - memcpy (tr->src.as_u8, ip0->src_address.as_u8, + clib_memcpy (tr->src.as_u8, ip0->src_address.as_u8, sizeof (tr->src.as_u8)); - memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, + clib_memcpy (tr->dst.as_u8, ip0->dst_address.as_u8, sizeof (tr->dst.as_u8)); tr->length = vlib_buffer_length_in_chain (vm, b0); tr->next_index = next0; tr->sr_valid = sr0 != 0; if (tr->sr_valid) - memcpy (tr->sr, sr0, sizeof (tr->sr)); + clib_memcpy (tr->sr, sr0, sizeof (tr->sr)); } vlib_validate_buffer_enqueue_x1 (vm, node, next_index, diff --git a/vnet/vnet/srp/interface.c b/vnet/vnet/srp/interface.c index 4c14b747..46c091d4 100644 --- a/vnet/vnet/srp/interface.c +++ b/vnet/vnet/srp/interface.c @@ -69,9 +69,9 @@ static uword srp_set_rewrite (vnet_main_t * vnm, return 0; } - memcpy (h->ethernet.src_address, hw->hw_address, sizeof (h->ethernet.src_address)); + clib_memcpy (h->ethernet.src_address, hw->hw_address, sizeof (h->ethernet.src_address)); if (dst_address) - memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.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 */ @@ -190,7 +190,7 @@ static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redi } /* Inherit MAC address from outer ring. */ - memcpy (si->my_address, hws[SRP_RING_OUTER]->hw_address, + clib_memcpy (si->my_address, hws[SRP_RING_OUTER]->hw_address, vec_len (hws[SRP_RING_OUTER]->hw_address)); /* Default time to wait to restore signal. */ @@ -373,7 +373,7 @@ simulated_srp_interface_tx (vlib_main_t * vm, n_copy = clib_min (n_left_from, n_left_to_next); - memcpy (to_next, from, n_copy * sizeof (from[0])); + clib_memcpy (to_next, from, n_copy * sizeof (from[0])); n_left_to_next -= n_copy; n_left_from -= n_copy; for (i = 0; i < n_copy; i++) diff --git a/vnet/vnet/srp/node.c b/vnet/vnet/srp/node.c index 0ffd4018..897be254 100644 --- a/vnet/vnet/srp/node.c +++ b/vnet/vnet/srp/node.c @@ -307,7 +307,7 @@ srp_topology_packet (vlib_main_t * vm, u32 sw_if_index, u8 ** contents) return SRP_ERROR_TOPOLOGY_BAD_LENGTH; /* Fill in our source MAC address. */ - memcpy (t->ethernet.src_address, hi->hw_address, vec_len (hi->hw_address)); + clib_memcpy (t->ethernet.src_address, hi->hw_address, vec_len (hi->hw_address)); /* Make space for our MAC binding. */ vec_resize (*contents, sizeof (srp_topology_mac_binding_t)); @@ -319,7 +319,7 @@ srp_topology_packet (vlib_main_t * vm, u32 sw_if_index, u8 ** contents) mb->flags = ((t->srp.is_inner_ring ? SRP_TOPOLOGY_MAC_BINDING_FLAG_IS_INNER_RING : 0) | (/* is wrapped FIXME */ 0)); - memcpy (mb->address, hi->hw_address, vec_len (hi->hw_address)); + clib_memcpy (mb->address, hi->hw_address, vec_len (hi->hw_address)); t->control.checksum = ~ip_csum_fold (ip_incremental_checksum (0, &t->control, @@ -586,7 +586,7 @@ static void init_ips_packet (srp_interface_t * si, i->srp.mode = SRP_MODE_control_locally_buffered_for_host; srp_header_compute_parity (&i->srp); - memcpy (&i->ethernet.src_address, &si->my_address, sizeof (si->my_address)); + clib_memcpy (&i->ethernet.src_address, &si->my_address, sizeof (si->my_address)); i->ethernet.type = clib_host_to_net_u16 (ETHERNET_TYPE_SRP_CONTROL); /* Checksum will be filled in later. */ @@ -594,7 +594,7 @@ static void init_ips_packet (srp_interface_t * si, i->control.type = SRP_CONTROL_PACKET_TYPE_ips; i->control.ttl = 255; - memcpy (&i->originator_address, &si->my_address, sizeof (si->my_address)); + clib_memcpy (&i->originator_address, &si->my_address, sizeof (si->my_address)); } static void tx_ips_packet (srp_interface_t * si, @@ -655,7 +655,7 @@ static void serialize_srp_interface_state_msg (serialize_main_t * m, va_list * v if (ir->rx_neighbor_address_valid) { p = serialize_get (m, sizeof (ir->rx_neighbor_address)); - memcpy (p, ir->rx_neighbor_address, sizeof (ir->rx_neighbor_address)); + clib_memcpy (p, ir->rx_neighbor_address, sizeof (ir->rx_neighbor_address)); } serialize_likely_small_unsigned_integer (m, ir->waiting_to_restore); if (ir->waiting_to_restore) @@ -681,7 +681,7 @@ static void unserialize_srp_interface_state_msg (serialize_main_t * m, va_list * if (ir->rx_neighbor_address_valid) { p = unserialize_get (m, sizeof (ir->rx_neighbor_address)); - memcpy (ir->rx_neighbor_address, p, sizeof (ir->rx_neighbor_address)); + clib_memcpy (ir->rx_neighbor_address, p, sizeof (ir->rx_neighbor_address)); } ir->waiting_to_restore = unserialize_likely_small_unsigned_integer (m); if (ir->waiting_to_restore) @@ -736,7 +736,7 @@ void srp_ips_rx_packet (u32 sw_if_index, srp_ips_header_t * h) ASSERT (0); } ir->rx_neighbor_address_valid = 1; - memcpy (ir->rx_neighbor_address, h->originator_address, sizeof (ir->rx_neighbor_address)); + clib_memcpy (ir->rx_neighbor_address, h->originator_address, sizeof (ir->rx_neighbor_address)); } switch (si->current_ips_state) diff --git a/vnet/vnet/unix/pcap.h b/vnet/vnet/unix/pcap.h index 6e8e6919..e7bb218d 100644 --- a/vnet/vnet/unix/pcap.h +++ b/vnet/vnet/unix/pcap.h @@ -169,7 +169,7 @@ pcap_add_buffer (pcap_main_t * pm, d = pcap_add_packet (pm, time_now, n_bytes_in_trace, n_left); while (1) { - memcpy (d, b->data + b->current_data, b->current_length); + clib_memcpy (d, b->data + b->current_data, b->current_length); n_left -= b->current_length; if (n_left <= 0) break; diff --git a/vnet/vnet/unix/tapcli.c b/vnet/vnet/unix/tapcli.c index 7776b9ee..d17d09dc 100644 --- a/vnet/vnet/unix/tapcli.c +++ b/vnet/vnet/unix/tapcli.c @@ -520,7 +520,7 @@ static u32 tapcli_flag_change (vnet_main_t * vnm, ti = vec_elt_at_index (tm->tapcli_interfaces, hw->dev_instance); - memcpy (&ifr, &ti->ifr, sizeof (ifr)); + clib_memcpy (&ifr, &ti->ifr, sizeof (ifr)); /* get flags, modify to bring up interface... */ if (ioctl (ti->provision_fd, SIOCGIFFLAGS, &ifr) < 0) @@ -757,7 +757,7 @@ int vnet_tap_connect (vlib_main_t * vm, u8 * intfc_name, u8 *hwaddr_arg, ti = tapcli_get_new_tapif(); if (hwaddr_arg != 0) - memcpy(hwaddr, hwaddr_arg, 6); + clib_memcpy(hwaddr, hwaddr_arg, 6); error = ethernet_register_interface (tm->vnet_main, @@ -782,7 +782,7 @@ int vnet_tap_connect (vlib_main_t * vm, u8 * intfc_name, u8 *hwaddr_arg, ti->unix_file_index = unix_file_add (&unix_main, &template); ti->unix_fd = dev_net_tun_fd; ti->provision_fd = dev_tap_fd; - memcpy (&ti->ifr, &ifr, sizeof (ifr)); + clib_memcpy (&ti->ifr, &ifr, sizeof (ifr)); } { @@ -1117,7 +1117,7 @@ tap_connect_command_fn (vlib_main_t * vm, rnd = (u32) (now * 1e6); rnd = random_u32 (&rnd); - memcpy (hwaddr+2, &rnd, sizeof(rnd)); + clib_memcpy (hwaddr+2, &rnd, sizeof(rnd)); hwaddr[0] = 2; hwaddr[1] = 0xfe; user_hwaddr = 1; @@ -1142,7 +1142,7 @@ tap_connect_command_fn (vlib_main_t * vm, ti->unix_file_index = unix_file_add (&unix_main, &template); ti->unix_fd = dev_net_tun_fd; ti->provision_fd = dev_tap_fd; - memcpy (&ti->ifr, &ifr, sizeof (ifr)); + clib_memcpy (&ti->ifr, &ifr, sizeof (ifr)); } { diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c index 7ea0b703..28b2584b 100644 --- a/vnet/vnet/unix/tuntap.c +++ b/vnet/vnet/unix/tuntap.c @@ -139,7 +139,7 @@ tuntap_tx (vlib_main_t * vm, if (tm->is_ether && (!tm->have_normal_interface)) { vlib_buffer_reset(b); - memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6); + clib_memcpy (vlib_buffer_get_current (b), tm->ether_dst_mac, 6); } /* Re-set iovecs if present. */ @@ -583,7 +583,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input) goto done; } else - memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6); + clib_memcpy (tm->ether_dst_mac, ifr.ifr_hwaddr.sa_data, 6); } if (have_normal_interface) @@ -664,7 +664,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im, /* See if we already know about this subif */ memset (&subif_addr, 0, sizeof (subif_addr)); subif_addr.sw_if_index = sw_if_index; - memcpy (&subif_addr.addr, address, sizeof (*address)); + clib_memcpy (&subif_addr.addr, address, sizeof (*address)); p = mhash_get (&tm->subif_mhash, &subif_addr); @@ -690,7 +690,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im, /* Set ipv4 address, netmask. */ sin->sin_family = AF_INET; - memcpy (&sin->sin_addr.s_addr, address, 4); + clib_memcpy (&sin->sin_addr.s_addr, address, 4); if (ioctl (tm->dev_tap_fd, SIOCSIFADDR, &ifr) < 0) clib_unix_warning ("ioctl SIOCSIFADDR"); @@ -756,7 +756,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im, memset (&subif_addr, 0, sizeof (subif_addr)); subif_addr.sw_if_index = sw_if_index; subif_addr.is_v6 = 1; - memcpy (&subif_addr.addr, address, sizeof (*address)); + clib_memcpy (&subif_addr.addr, address, sizeof (*address)); p = mhash_get (&tm->subif_mhash, &subif_addr); @@ -786,7 +786,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im, ifr6.ifr6_ifindex = ifr.ifr_ifindex; ifr6.ifr6_prefixlen = address_length; - memcpy (&ifr6.ifr6_addr, address, 16); + clib_memcpy (&ifr6.ifr6_addr, address, 16); if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0) clib_unix_warning ("set address"); @@ -804,7 +804,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im, ifr6.ifr6_ifindex = ifr.ifr_ifindex; ifr6.ifr6_prefixlen = address_length; - memcpy (&ifr6.ifr6_addr, address, 16); + clib_memcpy (&ifr6.ifr6_addr, address, 16); if (ioctl (sockfd, SIOCDIFADDR, &ifr6) < 0) clib_unix_warning ("del address"); diff --git a/vnet/vnet/vcgn/cnat_cli_handler.c b/vnet/vnet/vcgn/cnat_cli_handler.c index e0fb91bc..46c84935 100644 --- a/vnet/vnet/vcgn/cnat_cli_handler.c +++ b/vnet/vnet/vcgn/cnat_cli_handler.c @@ -341,12 +341,12 @@ void cnat_nat44_handle_show_config(vlib_main_t *vm) memset(status_str, 0x00, sizeof(status_str)); switch(my_vrfmap->status) { - case S_WAO: memcpy(status_str, "S_WAO", 5); break; - case S_WA: memcpy(status_str, "S_WA", 4); break; - case S_WO: memcpy(status_str, "S_WO", 4); break; - case S_RUN: memcpy(status_str, "ONLINE", 6); break; - case S_DEL: memcpy(status_str, "S_DEL", 5); break; - default: memcpy(status_str, "Invalid state", 13); + case S_WAO: clib_memcpy(status_str, "S_WAO", 5); break; + case S_WA: clib_memcpy(status_str, "S_WA", 4); break; + case S_WO: clib_memcpy(status_str, "S_WO", 4); break; + case S_RUN: clib_memcpy(status_str, "ONLINE", 6); break; + case S_DEL: clib_memcpy(status_str, "S_DEL", 5); break; + default: clib_memcpy(status_str, "Invalid state", 13); } vlib_cli_output(vm, diff --git a/vnet/vnet/vcgn/cnat_debug_msg_handler.c b/vnet/vnet/vcgn/cnat_debug_msg_handler.c index 9c84ac1e..519f4b64 100644 --- a/vnet/vnet/vcgn/cnat_debug_msg_handler.c +++ b/vnet/vnet/vcgn/cnat_debug_msg_handler.c @@ -1646,7 +1646,7 @@ void spp_api_cnat_generic_command_request_t_handler case CNAT_DEBUG_GENERIC_COMMAND_READ_MEM: start_locn = spp_net_to_host_byte_order_32(&mp->params[1]); num_bytes = spp_net_to_host_byte_order_32(&mp->params[2]); - memcpy(&(resp_ptr->raw_data[0]), (u8 *) start_locn, num_bytes); + clib_memcpy(&(resp_ptr->raw_data[0]), (u8 *) start_locn, num_bytes); resp_ptr->num_bytes = spp_host_to_net_byte_order_32(num_bytes); #ifdef SHOW_DEBUG @@ -1672,7 +1672,7 @@ void spp_api_cnat_generic_command_request_t_handler return; } - memcpy((u8 *) start_locn, &(mp->params[3]), num_bytes); + clib_memcpy((u8 *) start_locn, &(mp->params[3]), num_bytes); resp_ptr->num_bytes = 0; break; diff --git a/vnet/vnet/vcgn/cnat_logging.c b/vnet/vnet/vcgn/cnat_logging.c index 45cfbe8d..d404c590 100644 --- a/vnet/vnet/vcgn/cnat_logging.c +++ b/vnet/vnet/vcgn/cnat_logging.c @@ -780,7 +780,7 @@ void cnat_nfv9_create_logging_context ( nfv9_logging_info->nfv9_template_header = (cnat_nfv9_template_t *) nfv9_logging_info->next_data_ptr; - memcpy(nfv9_logging_info->nfv9_template_header, + clib_memcpy(nfv9_logging_info->nfv9_template_header, &cnat_nfv9_template_info, sizeof(cnat_nfv9_template_info)); @@ -928,7 +928,7 @@ static void cnat_nfv9_insert_add_record( nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT44_ADD_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_ADD_RECORD], &nfv9_logging_add_record, CNAT_NFV9_ADD_RECORD_LENGTH); nfv9_logging_info->record_length[NAT44_ADD_RECORD] @@ -1009,7 +1009,7 @@ static void cnat_nfv9_ds_lite_insert_add_record( ((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0))); nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[DS_LITE_ADD_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_ADD_RECORD], &nfv9_logging_add_record, CNAT_NFV9_DS_LITE_ADD_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_ADD_RECORD] @@ -1084,7 +1084,7 @@ static void cnat_nfv9_ds_lite_insert_del_record( ((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0))); nfv9_logging_del_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[DS_LITE_DEL_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_DEL_RECORD], &nfv9_logging_del_record, CNAT_NFV9_DS_LITE_DEL_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_DEL_RECORD] += @@ -1135,7 +1135,7 @@ static void cnat_nfv9_insert_bulk_add_record( nfv9_logging_bulk_add_record.outside_ip_port_end = clib_host_to_net_u16(bulk_alloc_start_port + bulk_size -1); - memcpy(nfv9_logging_info->record[NAT44_BULK_ADD_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_BULK_ADD_RECORD], &nfv9_logging_bulk_add_record, CNAT_NFV9_BULK_ADD_RECORD_LENGTH); nfv9_logging_info->record_length[NAT44_BULK_ADD_RECORD] @@ -1210,7 +1210,7 @@ static void cnat_nfv9_ds_lite_insert_bulk_add_record( nfv9_logging_bulk_add_record.outside_ip_port_end = clib_host_to_net_u16(bulk_alloc_start_port + bulk_size -1); - memcpy(nfv9_logging_info->record[DS_LITE_BULK_ADD_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_BULK_ADD_RECORD], &nfv9_logging_bulk_add_record, CNAT_NFV9_DS_LITE_BULK_ADD_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_BULK_ADD_RECORD] @@ -1272,7 +1272,7 @@ static void cnat_nfv9_ds_lite_insert_bulk_del_record( nfv9_logging_bulk_del_record.outside_ip_port_start = clib_host_to_net_u16(bulk_alloc_start_port); - memcpy(nfv9_logging_info->record[DS_LITE_BULK_DEL_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_BULK_DEL_RECORD], &nfv9_logging_bulk_del_record, CNAT_NFV9_DS_LITE_BULK_DEL_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_BULK_DEL_RECORD] += @@ -1323,7 +1323,7 @@ static void cnat_nfv9_insert_del_record( nfv9_logging_del_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT44_DEL_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_DEL_RECORD], &nfv9_logging_del_record, CNAT_NFV9_DEL_RECORD_LENGTH); nfv9_logging_info->record_length[NAT44_DEL_RECORD] @@ -1367,7 +1367,7 @@ static void cnat_nfv9_insert_bulk_del_record( nfv9_logging_bulk_del_record.outside_ip_port_start = clib_host_to_net_u16(bulk_alloc_start_port); - memcpy(nfv9_logging_info->record[NAT44_BULK_DEL_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_BULK_DEL_RECORD], &nfv9_logging_bulk_del_record, CNAT_NFV9_BULK_DEL_RECORD_LENGTH); nfv9_logging_info->record_length[NAT44_BULK_DEL_RECORD] @@ -1605,7 +1605,7 @@ void cnat_nfv9_bib_mapping_create (nat64_bib_entry_t *db, nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT64_ADD_BIB_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT64_ADD_BIB_RECORD], &nfv9_logging_add_record, CNAT_NFV9_NAT64_ADD_BIB_RECORD_LENGTH); nfv9_logging_info->record_length[NAT64_ADD_BIB_RECORD] += @@ -1752,7 +1752,7 @@ void cnat_nfv9_session_mapping_create (nat64_bib_entry_t *bdb, nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT64_ADD_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT64_ADD_SESSION_RECORD], &nfv9_logging_add_record, CNAT_NFV9_NAT64_ADD_SESSION_RECORD_LENGTH); nfv9_logging_info->record_length[NAT64_ADD_SESSION_RECORD] += @@ -1850,7 +1850,7 @@ void cnat_nfv9_bib_mapping_delete (nat64_bib_entry_t *db, nfv9_logging_del_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT64_DEL_BIB_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT64_DEL_BIB_RECORD], &nfv9_logging_del_record, CNAT_NFV9_NAT64_DEL_BIB_RECORD_LENGTH); nfv9_logging_info->record_length[NAT64_DEL_BIB_RECORD] += @@ -1982,7 +1982,7 @@ void cnat_nfv9_session_mapping_delete (nat64_bib_entry_t *bdb, ((my_proto_mask == CNAT_ICMP) ? IPV6_PROTO_ICMPV6 : 0))); nfv9_logging_del_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT64_DEL_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT64_DEL_SESSION_RECORD], &nfv9_logging_del_record, CNAT_NFV9_NAT64_DEL_SESSION_RECORD_LENGTH); nfv9_logging_info->record_length[NAT64_DEL_SESSION_RECORD] += @@ -2106,7 +2106,7 @@ void cnat_nfv9_nat44_log_session_create(cnat_main_db_entry_t *db, ((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : GRE_PROT))); nfv9_logging_add_session_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT44_ADD_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_ADD_SESSION_RECORD], &nfv9_logging_add_session_record, CNAT_NFV9_NAT44_ADD_SESSION_RECORD_LENGTH); @@ -2224,7 +2224,7 @@ void cnat_nfv9_nat44_log_session_delete(cnat_main_db_entry_t *db, nfv9_logging_del_session_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[NAT44_DEL_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[NAT44_DEL_SESSION_RECORD], &nfv9_logging_del_session_record, CNAT_NFV9_NAT44_DEL_SESSION_RECORD_LENGTH); @@ -2494,7 +2494,7 @@ void cnat_nfv9_ds_lite_log_session_create( ((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0))); nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[DS_LITE_ADD_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_ADD_SESSION_RECORD], &nfv9_logging_add_record, CNAT_NFV9_DS_LITE_ADD_SESSION_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_ADD_SESSION_RECORD] @@ -2624,7 +2624,7 @@ void cnat_nfv9_ds_lite_log_session_delete( ((my_proto_mask == CNAT_ICMP) ? ICMP_PROT : 0))); nfv9_logging_add_record.protocol = my_protocol; - memcpy(nfv9_logging_info->record[DS_LITE_DEL_SESSION_RECORD], + clib_memcpy(nfv9_logging_info->record[DS_LITE_DEL_SESSION_RECORD], &nfv9_logging_add_record, CNAT_NFV9_DS_LITE_DEL_SESSION_RECORD_LENGTH); nfv9_logging_info->record_length[DS_LITE_DEL_SESSION_RECORD] @@ -2734,10 +2734,10 @@ static void cnat_nfv9_insert_ingress_vrfid_name_record( nfv9_ingress_vrfid_name_record.ingress_vrf_id = clib_host_to_net_u32(vrfid_name_map[index].vrf_id); - memcpy(nfv9_ingress_vrfid_name_record.ingress_vrf_name, + clib_memcpy(nfv9_ingress_vrfid_name_record.ingress_vrf_name, vrfid_name_map[index].vrf_name, NFV9_VRF_NAME_LEN); - memcpy(nfv9_logging_info->record[INGRESS_VRF_ID_NAME_RECORD], + clib_memcpy(nfv9_logging_info->record[INGRESS_VRF_ID_NAME_RECORD], &nfv9_ingress_vrfid_name_record, CNAT_NFV9_INGRESS_VRFID_NAME_RECORD_LENGTH); diff --git a/vnet/vnet/vcgn/cnat_syslog.c b/vnet/vnet/vcgn/cnat_syslog.c index 9c69d4a2..65fde4ca 100644 --- a/vnet/vnet/vcgn/cnat_syslog.c +++ b/vnet/vnet/vcgn/cnat_syslog.c @@ -804,7 +804,7 @@ static int syslog_get_timestamp(unsigned char *ts) ts += u16_to_ascii_decimal_unaligned(ts, (tm1.tm_year + 1900)); *ts++ = SYSLOG_DELIMITER; /* Month */ - memcpy(ts, months[tm1.tm_mon], 4); + clib_memcpy(ts, months[tm1.tm_mon], 4); ts += 4; /* DELIMITER taken care */ /* day */ ts += u16_to_ascii_decimal_unaligned(ts, tm1.tm_mday); @@ -870,7 +870,7 @@ inline static int syslog_fill_header(const cnat_syslog_logging_info_t *log_info, temp += syslog_get_timestamp(temp); *temp++ = SYSLOG_DELIMITER; count = strlen(log_info->header_hostname); - memcpy(temp, log_info->header_hostname, count); + clib_memcpy(temp, log_info->header_hostname, count); temp += count; *temp++ = SYSLOG_DELIMITER; *temp++ = SYSLOG_FIELD_ABSENT; /* App name - nil value */ @@ -879,7 +879,7 @@ inline static int syslog_fill_header(const cnat_syslog_logging_info_t *log_info, *temp++ = SYSLOG_DELIMITER; /* Now the msg id */ count = strlen(syslog_service_string[s_type]); - memcpy(temp, syslog_service_string[s_type], count); + clib_memcpy(temp, syslog_service_string[s_type], count); temp += count; *temp++ = SYSLOG_DELIMITER; *temp++ = SYSLOG_FIELD_ABSENT; /* No structured elements */ @@ -1078,7 +1078,7 @@ void cnat_syslog_insert_nat44_record( *record++ = '['; /* Open the record */ /* Copy the record type */ - memcpy(record, sys_log_event[e_type].event_name, + clib_memcpy(record, sys_log_event[e_type].event_name, sys_log_event[e_type].name_length); record += sys_log_event[e_type].name_length; *record++ = SYSLOG_DELIMITER; @@ -1110,7 +1110,7 @@ void cnat_syslog_insert_nat44_record( *record++ = SYSLOG_DELIMITER; /* copy configured VRF NAME */ - memcpy(record, log_info->vrf_name, log_info->vrf_name_len); + clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len); record += log_info->vrf_name_len; *record++ = SYSLOG_DELIMITER; @@ -1197,7 +1197,7 @@ void cnat_syslog_insert_record( *record++ = '['; /* Open the record */ /* Copy the record type */ - memcpy(record, sys_log_event[e_type].event_name, + clib_memcpy(record, sys_log_event[e_type].event_name, sys_log_event[e_type].name_length); record += sys_log_event[e_type].name_length; *record++ = SYSLOG_DELIMITER; @@ -1234,7 +1234,7 @@ void cnat_syslog_insert_record( *record++ = SYSLOG_DELIMITER; /* copy configured VRF NAME */ - memcpy(record, log_info->vrf_name, log_info->vrf_name_len); + clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len); record += log_info->vrf_name_len; *record++ = SYSLOG_DELIMITER; @@ -1521,7 +1521,7 @@ void cnat_syslog_dslite_insert_port_exceeded( *record++ = '['; /* Open the record */ /* Copy the record type */ - memcpy(record, sys_log_event[port_block_runout].event_name, + clib_memcpy(record, sys_log_event[port_block_runout].event_name, sys_log_event[port_block_runout].name_length); record += sys_log_event[port_block_runout].name_length; *record++ = SYSLOG_DELIMITER; @@ -1543,7 +1543,7 @@ void cnat_syslog_dslite_insert_port_exceeded( *record++ = SYSLOG_DELIMITER; /* copy configured VRF NAME */ - memcpy(record, log_info->vrf_name, log_info->vrf_name_len); + clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len); record += log_info->vrf_name_len; *record++ = SYSLOG_DELIMITER; @@ -1621,7 +1621,7 @@ void cnat_syslog_nat44_insert_port_exceeded( *record++ = '['; /* Open the record */ /* Copy the record type */ - memcpy(record, sys_log_event[port_block_runout].event_name, + clib_memcpy(record, sys_log_event[port_block_runout].event_name, sys_log_event[port_block_runout].name_length); record += sys_log_event[port_block_runout].name_length; *record++ = SYSLOG_DELIMITER; @@ -1643,7 +1643,7 @@ void cnat_syslog_nat44_insert_port_exceeded( *record++ = SYSLOG_DELIMITER; /* copy configured VRF NAME */ - memcpy(record, log_info->vrf_name, log_info->vrf_name_len); + clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len); record += log_info->vrf_name_len; *record++ = SYSLOG_DELIMITER; @@ -1715,7 +1715,7 @@ void cnat_syslog_nat44_insert_tcp_seq_mismatch( *record++ = '['; /* Open the record */ /* Copy the record type */ - memcpy(record, sys_log_event[tcp_seq_mismatch].event_name, + clib_memcpy(record, sys_log_event[tcp_seq_mismatch].event_name, sys_log_event[tcp_seq_mismatch].name_length); record += sys_log_event[tcp_seq_mismatch].name_length; *record++ = SYSLOG_DELIMITER; @@ -1729,7 +1729,7 @@ void cnat_syslog_nat44_insert_tcp_seq_mismatch( *record++ = SYSLOG_DELIMITER; /* copy configured VRF NAME */ - memcpy(record, log_info->vrf_name, log_info->vrf_name_len); + clib_memcpy(record, log_info->vrf_name, log_info->vrf_name_len); record += log_info->vrf_name_len; *record++ = SYSLOG_DELIMITER; diff --git a/vnet/vnet/vcgn/vcgn_classify.c b/vnet/vnet/vcgn/vcgn_classify.c index 8db229ee..8a1e9ac3 100644 --- a/vnet/vnet/vcgn/vcgn_classify.c +++ b/vnet/vnet/vcgn/vcgn_classify.c @@ -882,7 +882,7 @@ static u16 nfv9_get_server_instance( /* Create a new one, initialize and return */ server = 0; pool_get(nfv9_server_info_pool, server); - memcpy(server, new_server_info, sizeof(nfv9_server_info_t)); + clib_memcpy(server, new_server_info, sizeof(nfv9_server_info_t)); server->ref_count = 1; nfv9_info->server_index = server - nfv9_server_info_pool; #ifdef DEBUG_NF_SERVER_CONFIG |