aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-10-17 10:38:51 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:06:46 +0000
commitb7b929931a07fbb27b43d5cd105f366c3e29807e (patch)
tree438681c89738802dbb5d339715b96ea2c31bafb4 /src
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/examples/srv6-sample-localsid/srv6_localsid_sample.c2
-rw-r--r--src/examples/vlib/mc_test.c2
-rw-r--r--src/plugins/abf/abf_api.c4
-rw-r--r--src/plugins/acl/acl.c90
-rw-r--r--src/plugins/acl/acl_test.c12
-rw-r--r--src/plugins/acl/hash_lookup.c18
-rw-r--r--src/plugins/acl/public_inlines.h2
-rw-r--r--src/plugins/avf/avf_api.c2
-rw-r--r--src/plugins/avf/avf_test.c2
-rw-r--r--src/plugins/avf/cli.c2
-rw-r--r--src/plugins/avf/device.c20
-rw-r--r--src/plugins/cdp/cdp_input.c2
-rw-r--r--src/plugins/cdp/cdp_periodic.c16
-rw-r--r--src/plugins/dpdk/api/dpdk_test.c4
-rw-r--r--src/plugins/dpdk/buffer.c6
-rw-r--r--src/plugins/dpdk/device/common.c2
-rw-r--r--src/plugins/dpdk/device/flow.c12
-rw-r--r--src/plugins/dpdk/device/init.c4
-rw-r--r--src/plugins/dpdk/hqos/hqos.c4
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c6
-rw-r--r--src/plugins/flowprobe/flowprobe.c6
-rw-r--r--src/plugins/gbp/gbp_api.c10
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.c2
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.c2
-rw-r--r--src/plugins/gbp/gbp_recirc.c2
-rw-r--r--src/plugins/gtpu/gtpu.c8
-rw-r--r--src/plugins/gtpu/gtpu_api.c2
-rw-r--r--src/plugins/gtpu/gtpu_decap.c2
-rw-r--r--src/plugins/gtpu/gtpu_test.c4
-rw-r--r--src/plugins/igmp/igmp.c2
-rw-r--r--src/plugins/igmp/igmp_api.c10
-rw-r--r--src/plugins/igmp/igmp_group.c2
-rw-r--r--src/plugins/igmp/igmp_pkt.c6
-rw-r--r--src/plugins/igmp/igmp_proxy.c2
-rw-r--r--src/plugins/igmp/igmp_src.c2
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c4
-rw-r--r--src/plugins/ioam/encap/ip6_ioam_pot.c2
-rw-r--r--src/plugins/ioam/encap/ip6_ioam_trace.c2
-rw-r--r--src/plugins/ioam/export-common/ioam_export.h6
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.c2
-rw-r--r--src/plugins/ioam/ip6/ioam_cache.h12
-rw-r--r--src/plugins/ioam/lib-e2e/ioam_seqno_lib.h7
-rw-r--r--src/plugins/ioam/lib-pot/pot_util.c4
-rw-r--r--src/plugins/ioam/lib-trace/trace_util.c2
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c2
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c4
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c6
-rw-r--r--src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c2
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c2
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_test.c2
-rw-r--r--src/plugins/ixge/ixge.c14
-rw-r--r--src/plugins/l2e/l2e.c2
-rw-r--r--src/plugins/lacp/cli.c2
-rw-r--r--src/plugins/lacp/lacp.c4
-rw-r--r--src/plugins/lacp/lacp_api.c2
-rw-r--r--src/plugins/lb/lb.c2
-rw-r--r--src/plugins/mactime/mactime.c6
-rw-r--r--src/plugins/map/examples/health_check.c2
-rw-r--r--src/plugins/map/map.c16
-rw-r--r--src/plugins/map/map_api.c8
-rw-r--r--src/plugins/marvell/pp2/pp2.c2
-rw-r--r--src/plugins/memif/memif.c14
-rw-r--r--src/plugins/memif/memif_api.c4
-rw-r--r--src/plugins/memif/node.c2
-rw-r--r--src/plugins/memif/socket.c4
-rw-r--r--src/plugins/nat/dslite_in2out.c4
-rwxr-xr-xsrc/plugins/nat/nat.c10
-rw-r--r--src/plugins/nat/nat44_cli.c4
-rw-r--r--src/plugins/nat/nat64.c4
-rw-r--r--src/plugins/nat/nat64_db.c18
-rw-r--r--src/plugins/nat/nat64_in2out.c18
-rw-r--r--src/plugins/nat/nat64_out2in.c20
-rw-r--r--src/plugins/nat/nat66.c2
-rw-r--r--src/plugins/nat/nat_api.c56
-rw-r--r--src/plugins/nat/nat_det.c2
-rw-r--r--src/plugins/nat/nat_ipfix_logging.c2
-rw-r--r--src/plugins/nat/nat_test.c2
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c2
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c10
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c2
-rw-r--r--src/plugins/nsh/nsh.c26
-rw-r--r--src/plugins/nsh/nsh_test.c4
-rw-r--r--src/plugins/pppoe/pppoe.c8
-rw-r--r--src/plugins/pppoe/pppoe_api.c2
-rw-r--r--src/plugins/pppoe/pppoe_test.c2
-rw-r--r--src/plugins/srv6-ad/ad.c2
-rw-r--r--src/plugins/srv6-am/am.c2
-rw-r--r--src/plugins/srv6-as/as.c2
-rw-r--r--src/plugins/stn/stn_api.c2
-rw-r--r--src/plugins/svs/svs_api.c2
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c4
-rw-r--r--src/plugins/tlsopenssl/tls_async.c2
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c4
-rw-r--r--src/plugins/unittest/CMakeLists.txt1
-rw-r--r--src/plugins/unittest/string_test.c145
-rw-r--r--src/plugins/unittest/tcp_test.c16
-rw-r--r--src/plugins/vmxnet3/cli.c2
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c16
-rw-r--r--src/plugins/vmxnet3/vmxnet3_api.c4
-rw-r--r--src/plugins/vmxnet3/vmxnet3_test.c2
-rw-r--r--src/svm/queue.c8
-rw-r--r--src/svm/ssvm.c2
-rw-r--r--src/svm/svm.c8
-rw-r--r--src/svm/svm_fifo.c35
-rw-r--r--src/svm/svm_fifo_segment.c14
-rw-r--r--src/svm/svmdb.c4
-rw-r--r--src/svm/svmdbtool.c6
-rw-r--r--src/svm/svmtool.c6
-rw-r--r--src/svm/test_svm_fifo1.c10
-rw-r--r--src/svm/test_svm_message_queue.c2
-rw-r--r--src/tests/vnet/lisp-cp/test_cp_serdes.c34
-rw-r--r--src/tests/vnet/lisp-cp/test_lisp_types.c28
-rw-r--r--src/tests/vnet/session/tcp_echo.c28
-rw-r--r--src/tests/vnet/session/udp_echo.c20
-rw-r--r--src/tools/elftool/elftool.c4
-rw-r--r--src/tools/g2/view1.c2
-rw-r--r--src/tools/perftool/cpel_util.c6
-rw-r--r--src/vat/api_format.c94
-rw-r--r--src/vat/json_format.c2
-rw-r--r--src/vat/main.c2
-rw-r--r--src/vat/plugin.c2
-rw-r--r--src/vat/restart.c2
-rw-r--r--src/vlib/buffer.c8
-rw-r--r--src/vlib/buffer_serialize.c2
-rw-r--r--src/vlib/error.c6
-rw-r--r--src/vlib/linux/pci.c16
-rwxr-xr-xsrc/vlib/linux/physmem.c2
-rw-r--r--src/vlib/main.c2
-rw-r--r--src/vlib/node.c6
-rw-r--r--src/vlib/node.h2
-rw-r--r--src/vlib/node_funcs.h2
-rw-r--r--src/vlib/threads.c20
-rw-r--r--src/vlib/threads_cli.c4
-rw-r--r--src/vlib/unix/cj.c2
-rw-r--r--src/vlib/unix/cli.c4
-rwxr-xr-xsrc/vlib/unix/main.c2
-rw-r--r--src/vlib/unix/mc_socket.c18
-rw-r--r--src/vlibapi/api_helper_macros.h2
-rw-r--r--src/vlibapi/api_shared.c6
-rw-r--r--src/vlibapi/vat_helper_macros.h6
-rw-r--r--src/vlibmemory/memory_api.c16
-rw-r--r--src/vlibmemory/memory_client.c14
-rw-r--r--src/vlibmemory/memory_shared.c4
-rw-r--r--src/vlibmemory/socket_api.c10
-rw-r--r--src/vlibmemory/socket_client.c6
-rw-r--r--src/vlibmemory/vlib_api.c8
-rw-r--r--src/vlibmemory/vlib_api_cli.c2
-rw-r--r--src/vnet/adj/adj.c4
-rw-r--r--src/vnet/adj/adj_nbr.c2
-rw-r--r--src/vnet/adj/rewrite.h8
-rw-r--r--src/vnet/bfd/bfd_api.c8
-rw-r--r--src/vnet/bfd/bfd_main.c18
-rw-r--r--src/vnet/bfd/bfd_udp.c14
-rw-r--r--src/vnet/bier/bier_api.c10
-rw-r--r--src/vnet/bier/bier_bift_table.c2
-rw-r--r--src/vnet/bier/bier_disp_table.c2
-rw-r--r--src/vnet/bier/bier_fmask.c8
-rw-r--r--src/vnet/bier/bier_fmask_db.c2
-rw-r--r--src/vnet/bier/bier_hdr_inlines.h2
-rw-r--r--src/vnet/bier/bier_test.c2
-rw-r--r--src/vnet/bonding/bond_api.c12
-rw-r--r--src/vnet/bonding/cli.c10
-rw-r--r--src/vnet/classify/classify_api.c6
-rw-r--r--src/vnet/classify/vnet_classify.c22
-rw-r--r--src/vnet/config.c2
-rw-r--r--src/vnet/cop/cop.c2
-rw-r--r--src/vnet/devices/af_packet/af_packet.c6
-rw-r--r--src/vnet/devices/af_packet/af_packet_api.c2
-rw-r--r--src/vnet/devices/netlink.c2
-rw-r--r--src/vnet/devices/netmap/netmap.c4
-rw-r--r--src/vnet/devices/pipe/pipe.c4
-rw-r--r--src/vnet/devices/tap/tap.c10
-rw-r--r--src/vnet/devices/tap/tapv2_api.c6
-rw-r--r--src/vnet/devices/virtio/device.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user.c8
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c4
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c2
-rw-r--r--src/vnet/devices/virtio/virtio.c6
-rw-r--r--src/vnet/dhcp/client.c8
-rw-r--r--src/vnet/dhcp/dhcp4_proxy_node.c6
-rw-r--r--src/vnet/dhcp/dhcp6_client_common_dp.c2
-rw-r--r--src/vnet/dhcp/dhcp6_ia_na_client_dp.c2
-rw-r--r--src/vnet/dhcp/dhcp6_pd_client_cp.c2
-rw-r--r--src/vnet/dhcp/dhcp6_pd_client_dp.c2
-rw-r--r--src/vnet/dhcp/dhcp6_proxy_node.c6
-rw-r--r--src/vnet/dhcp/dhcp_api.c4
-rw-r--r--src/vnet/dhcp/dhcp_proxy.c2
-rw-r--r--src/vnet/dns/dns.c22
-rw-r--r--src/vnet/dpo/classify_dpo.c2
-rw-r--r--src/vnet/dpo/l3_proxy_dpo.c2
-rw-r--r--src/vnet/dpo/load_balance.c2
-rw-r--r--src/vnet/dpo/load_balance_map.c2
-rw-r--r--src/vnet/dpo/mpls_disposition.c2
-rw-r--r--src/vnet/dpo/mpls_label_dpo.c2
-rw-r--r--src/vnet/dpo/receive_dpo.c2
-rw-r--r--src/vnet/dpo/replicate_dpo.c2
-rw-r--r--src/vnet/ethernet/interface.c6
-rw-r--r--src/vnet/fib/fib_api.c4
-rw-r--r--src/vnet/fib/fib_attached_export.c2
-rw-r--r--src/vnet/fib/fib_entry.c2
-rw-r--r--src/vnet/fib/fib_path.c6
-rw-r--r--src/vnet/fib/fib_path_list.c2
-rw-r--r--src/vnet/fib/fib_types.c2
-rw-r--r--src/vnet/fib/fib_urpf_list.c2
-rw-r--r--src/vnet/fib/fib_walk.c10
-rw-r--r--src/vnet/fib/ip4_fib.c2
-rw-r--r--src/vnet/fib/ip6_fib.c6
-rw-r--r--src/vnet/fib/mpls_fib.c2
-rw-r--r--src/vnet/flow/flow.c2
-rw-r--r--src/vnet/flow/flow_cli.c2
-rw-r--r--src/vnet/geneve/decap.c2
-rw-r--r--src/vnet/geneve/geneve.c8
-rw-r--r--src/vnet/geneve/geneve_api.c2
-rw-r--r--src/vnet/gre/gre.c2
-rw-r--r--src/vnet/gre/gre_api.c4
-rw-r--r--src/vnet/gre/interface.c4
-rw-r--r--src/vnet/gre/node.c8
-rw-r--r--src/vnet/hdlc/hdlc.c2
-rw-r--r--src/vnet/interface.c4
-rw-r--r--src/vnet/interface_api.c14
-rw-r--r--src/vnet/interface_cli.c2
-rw-r--r--src/vnet/interface_output.c2
-rw-r--r--src/vnet/ip/icmp4.c5
-rw-r--r--src/vnet/ip/icmp6.c15
-rw-r--r--src/vnet/ip/ip4_format.c2
-rw-r--r--src/vnet/ip/ip4_forward.c6
-rwxr-xr-xsrc/vnet/ip/ip4_mtrie.c6
-rw-r--r--src/vnet/ip/ip4_pg.c2
-rw-r--r--src/vnet/ip/ip4_punt_drop.c2
-rw-r--r--src/vnet/ip/ip4_reassembly.c4
-rw-r--r--src/vnet/ip/ip4_source_and_port_range_check.c2
-rw-r--r--src/vnet/ip/ip4_to_ip6.h8
-rw-r--r--src/vnet/ip/ip6_format.c6
-rw-r--r--src/vnet/ip/ip6_forward.c6
-rw-r--r--src/vnet/ip/ip6_hop_by_hop.c6
-rw-r--r--src/vnet/ip/ip6_hop_by_hop.h2
-rw-r--r--src/vnet/ip/ip6_ll_table.c2
-rwxr-xr-xsrc/vnet/ip/ip6_neighbor.c14
-rw-r--r--src/vnet/ip/ip6_packet.h2
-rw-r--r--src/vnet/ip/ip6_punt_drop.c2
-rw-r--r--src/vnet/ip/ip6_reassembly.c4
-rw-r--r--src/vnet/ip/ip_api.c48
-rw-r--r--src/vnet/ip/ip_init.c2
-rw-r--r--src/vnet/ip/ip_neighbor.c2
-rw-r--r--src/vnet/ip/ip_types_api.c2
-rw-r--r--src/vnet/ip/lookup.c24
-rw-r--r--src/vnet/ip/punt.c4
-rw-r--r--src/vnet/ipfix-export/flow_api.c8
-rw-r--r--src/vnet/ipfix-export/flow_report_classify.c2
-rw-r--r--src/vnet/ipip/ipip.c4
-rw-r--r--src/vnet/ipip/ipip_api.c2
-rw-r--r--src/vnet/ipip/sixrd.c2
-rw-r--r--src/vnet/ipsec-gre/interface.c6
-rw-r--r--src/vnet/ipsec-gre/ipsec_gre.c2
-rw-r--r--src/vnet/ipsec-gre/ipsec_gre_api.c4
-rw-r--r--src/vnet/ipsec/ah_decrypt.c6
-rw-r--r--src/vnet/ipsec/ah_encrypt.c6
-rw-r--r--src/vnet/ipsec/esp.h2
-rw-r--r--src/vnet/ipsec/esp_decrypt.c2
-rw-r--r--src/vnet/ipsec/ikev2.c12
-rw-r--r--src/vnet/ipsec/ikev2_crypto.c16
-rw-r--r--src/vnet/ipsec/ikev2_payload.c2
-rw-r--r--src/vnet/ipsec/ipsec.c4
-rw-r--r--src/vnet/ipsec/ipsec_api.c12
-rw-r--r--src/vnet/ipsec/ipsec_cli.c8
-rw-r--r--src/vnet/ipsec/ipsec_if.c8
-rw-r--r--src/vnet/l2/l2_api.c8
-rw-r--r--src/vnet/l2/l2_bd.c2
-rw-r--r--src/vnet/l2/l2_fib.c2
-rw-r--r--src/vnet/l2/l2_input.c2
-rw-r--r--src/vnet/l2/l2_rw.c4
-rw-r--r--src/vnet/l2/l2_xcrw.c6
-rw-r--r--src/vnet/l2tp/l2tp.c2
-rw-r--r--src/vnet/l2tp/l2tp_api.c2
-rw-r--r--src/vnet/lisp-cp/control.c95
-rw-r--r--src/vnet/lisp-cp/gid_dictionary.c24
-rw-r--r--src/vnet/lisp-cp/lisp_api.c46
-rw-r--r--src/vnet/lisp-cp/lisp_cli.c28
-rw-r--r--src/vnet/lisp-cp/lisp_msg_serdes.c24
-rw-r--r--src/vnet/lisp-cp/lisp_types.c28
-rw-r--r--src/vnet/lisp-cp/one_api.c50
-rw-r--r--src/vnet/lisp-cp/one_cli.c40
-rw-r--r--src/vnet/lisp-cp/packets.c6
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.c12
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_adjacency.c6
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_api.c12
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c18
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_sub_interface.c6
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_tenant.c2
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_tunnel.c4
-rw-r--r--src/vnet/llc/llc.c2
-rw-r--r--src/vnet/lldp/lldp_api.c2
-rw-r--r--src/vnet/lldp/lldp_input.c2
-rw-r--r--src/vnet/lldp/lldp_output.c6
-rw-r--r--src/vnet/mfib/ip4_mfib.c6
-rw-r--r--src/vnet/mfib/ip6_mfib.c10
-rw-r--r--src/vnet/mfib/mfib_entry.c2
-rw-r--r--src/vnet/mfib/mfib_test.c2
-rw-r--r--src/vnet/mpls/mpls.c2
-rw-r--r--src/vnet/mpls/mpls_api.c8
-rw-r--r--src/vnet/mpls/mpls_tunnel.c4
-rw-r--r--src/vnet/osi/osi.c2
-rw-r--r--src/vnet/pg/cli.c4
-rw-r--r--src/vnet/pg/pg.h2
-rw-r--r--src/vnet/policer/policer.c2
-rw-r--r--src/vnet/policer/policer_api.c4
-rw-r--r--src/vnet/policer/xlate.c12
-rw-r--r--src/vnet/ppp/ppp.c2
-rw-r--r--src/vnet/qos/qos_egress_map.c2
-rw-r--r--src/vnet/sctp/sctp.c10
-rw-r--r--src/vnet/sctp/sctp.h2
-rw-r--r--src/vnet/sctp/sctp_output.c2
-rw-r--r--src/vnet/sctp/sctp_packet.h2
-rw-r--r--src/vnet/session-apps/echo_client.c8
-rw-r--r--src/vnet/session-apps/echo_server.c10
-rw-r--r--src/vnet/session-apps/http_server.c10
-rw-r--r--src/vnet/session-apps/proxy.c16
-rw-r--r--src/vnet/session/application.c24
-rw-r--r--src/vnet/session/application_interface.h2
-rw-r--r--src/vnet/session/application_namespace.c2
-rw-r--r--src/vnet/session/mma_template.c4
-rw-r--r--src/vnet/session/segment_manager.c8
-rw-r--r--src/vnet/session/session.c6
-rwxr-xr-xsrc/vnet/session/session_api.c48
-rwxr-xr-xsrc/vnet/session/session_cli.c4
-rw-r--r--src/vnet/session/session_lookup.c18
-rw-r--r--src/vnet/session/session_node.c2
-rw-r--r--src/vnet/session/session_rules_table.c6
-rw-r--r--src/vnet/session/session_table.c2
-rw-r--r--src/vnet/session/session_test.c12
-rw-r--r--src/vnet/session/transport.c2
-rw-r--r--src/vnet/snap/snap.c2
-rw-r--r--src/vnet/span/span_api.c2
-rw-r--r--src/vnet/srmpls/sr_mpls_api.c4
-rwxr-xr-xsrc/vnet/srmpls/sr_mpls_policy.c6
-rwxr-xr-xsrc/vnet/srmpls/sr_mpls_steering.c12
-rw-r--r--src/vnet/srp/interface.c6
-rw-r--r--src/vnet/srp/node.c2
-rw-r--r--src/vnet/srv6/sr_api.c13
-rwxr-xr-xsrc/vnet/srv6/sr_localsid.c6
-rwxr-xr-xsrc/vnet/srv6/sr_policy_rewrite.c4
-rwxr-xr-xsrc/vnet/srv6/sr_steering.c6
-rw-r--r--src/vnet/tcp/tcp.c22
-rw-r--r--src/vnet/tcp/tcp_input.c4
-rw-r--r--src/vnet/tcp/tcp_output.c4
-rw-r--r--src/vnet/tcp/tcp_syn_filter4.c2
-rw-r--r--src/vnet/tls/tls.c10
-rw-r--r--src/vnet/udp/udp.c6
-rw-r--r--src/vnet/udp/udp_api.c2
-rw-r--r--src/vnet/udp/udp_local.c2
-rw-r--r--src/vnet/unix/pcap.c2
-rw-r--r--src/vnet/unix/tap_api.c8
-rw-r--r--src/vnet/unix/tapcli.c14
-rw-r--r--src/vnet/unix/tuntap.c18
-rw-r--r--src/vnet/util/radix.c14
-rw-r--r--src/vnet/util/throttle.h2
-rw-r--r--src/vnet/vxlan-gbp/decap.c4
-rw-r--r--src/vnet/vxlan-gbp/vxlan_gbp.c4
-rw-r--r--src/vnet/vxlan-gbp/vxlan_gbp_api.c2
-rw-r--r--src/vnet/vxlan-gpe/decap.c4
-rw-r--r--src/vnet/vxlan-gpe/vxlan_gpe.c4
-rw-r--r--src/vnet/vxlan-gpe/vxlan_gpe_api.c4
-rw-r--r--src/vnet/vxlan/decap.c4
-rw-r--r--src/vnet/vxlan/vxlan.c4
-rw-r--r--src/vnet/vxlan/vxlan_api.c2
-rw-r--r--src/vpp-api/client/client.c8
-rw-r--r--src/vpp-api/client/stat_client.c2
-rw-r--r--src/vpp-api/client/test.c2
-rw-r--r--src/vpp-api/vapi/vapi.c15
-rw-r--r--src/vpp/api/api.c2
-rw-r--r--src/vpp/api/api_main.c2
-rw-r--r--src/vpp/api/custom_dump.c12
-rw-r--r--src/vpp/api/gmon.c2
-rw-r--r--src/vpp/api/json_format.c2
-rw-r--r--src/vpp/api/plugin.c2
-rw-r--r--src/vpp/api/summary_stats_client.c4
-rw-r--r--src/vpp/api/test_client.c66
-rw-r--r--src/vpp/api/test_ha.c2
-rw-r--r--src/vpp/api/vpp_get_metrics.c4
-rw-r--r--src/vpp/app/vpp_prometheus_export.c2
-rw-r--r--src/vpp/app/vppctl.c2
-rw-r--r--src/vpp/oam/oam.c4
-rw-r--r--src/vpp/stats/stats_to_be_deprecated.c10
-rw-r--r--src/vppinfra/asm_x86.c2
-rw-r--r--src/vppinfra/bihash_16_8.h2
-rw-r--r--src/vppinfra/bihash_16_8_32.h2
-rw-r--r--src/vppinfra/bihash_24_8.h2
-rw-r--r--src/vppinfra/bihash_40_8.h2
-rw-r--r--src/vppinfra/bihash_48_8.h2
-rw-r--r--src/vppinfra/bihash_template.c30
-rw-r--r--src/vppinfra/cuckoo_8_8.h2
-rw-r--r--src/vppinfra/cuckoo_template.c12
-rw-r--r--src/vppinfra/dlist.h2
-rw-r--r--src/vppinfra/elf.c4
-rw-r--r--src/vppinfra/elf.h2
-rw-r--r--src/vppinfra/elog.c4
-rw-r--r--src/vppinfra/fheap.c2
-rw-r--r--src/vppinfra/fheap.h2
-rw-r--r--src/vppinfra/fifo.c2
-rw-r--r--src/vppinfra/flowhash_template.h2
-rw-r--r--src/vppinfra/format.c4
-rw-r--r--src/vppinfra/format.h4
-rw-r--r--src/vppinfra/graph.c2
-rw-r--r--src/vppinfra/hash.c6
-rw-r--r--src/vppinfra/hash.h2
-rw-r--r--src/vppinfra/heap.c2
-rw-r--r--src/vppinfra/heap.h2
-rw-r--r--src/vppinfra/lock.h4
-rw-r--r--src/vppinfra/maplog.c6
-rw-r--r--src/vppinfra/mem.h2
-rw-r--r--src/vppinfra/mem_dlmalloc.c4
-rw-r--r--src/vppinfra/memcpy_avx2.h2
-rw-r--r--src/vppinfra/memcpy_avx512.h2
-rw-r--r--src/vppinfra/memcpy_sse3.h2
-rw-r--r--src/vppinfra/mhash.c2
-rw-r--r--src/vppinfra/mheap.c12
-rw-r--r--src/vppinfra/phash.c2
-rw-r--r--src/vppinfra/phash.h2
-rw-r--r--src/vppinfra/pool.c3
-rw-r--r--src/vppinfra/qhash.c7
-rw-r--r--src/vppinfra/random_buffer.c2
-rw-r--r--src/vppinfra/serialize.c10
-rw-r--r--src/vppinfra/slist.c4
-rw-r--r--src/vppinfra/socket.c8
-rw-r--r--src/vppinfra/socket.h2
-rw-r--r--src/vppinfra/string.c19
-rw-r--r--src/vppinfra/string.h113
-rw-r--r--src/vppinfra/test_cuckoo_bihash.c2
-rw-r--r--src/vppinfra/test_elf.c4
-rw-r--r--src/vppinfra/test_heap.c2
-rw-r--r--src/vppinfra/test_maplog.c4
-rw-r--r--src/vppinfra/test_mheap.c2
-rw-r--r--src/vppinfra/test_qhash.c2
-rw-r--r--src/vppinfra/test_serialize.c2
-rw-r--r--src/vppinfra/test_time_range.c2
-rw-r--r--src/vppinfra/test_timing_wheel.c2
-rw-r--r--src/vppinfra/test_tw_timer.c30
-rw-r--r--src/vppinfra/test_vhash.c2
-rw-r--r--src/vppinfra/time.c2
-rw-r--r--src/vppinfra/time_range.c2
-rw-r--r--src/vppinfra/timer.c6
-rw-r--r--src/vppinfra/timing_wheel.c2
-rw-r--r--src/vppinfra/tw_timer_template.c10
-rw-r--r--src/vppinfra/unformat.c8
-rw-r--r--src/vppinfra/valloc.c12
-rw-r--r--src/vppinfra/vec.c4
-rw-r--r--src/vppinfra/vec.h8
-rw-r--r--src/vppinfra/vhash.c2
449 files changed, 1858 insertions, 1577 deletions
diff --git a/src/examples/srv6-sample-localsid/srv6_localsid_sample.c b/src/examples/srv6-sample-localsid/srv6_localsid_sample.c
index 115ee94866d..8ea3218e412 100755
--- a/src/examples/srv6-sample-localsid/srv6_localsid_sample.c
+++ b/src/examples/srv6-sample-localsid/srv6_localsid_sample.c
@@ -95,7 +95,7 @@ unformat_srv6_localsid_sample (unformat_input_t * input, va_list * args)
sizeof(srv6_localsid_sample_per_sid_memory_t), 0, 0, 1);
/* Set to zero the memory */
- memset (ls_mem, 0, sizeof(srv6_localsid_sample_per_sid_memory_t));
+ clib_memset (ls_mem, 0, sizeof(srv6_localsid_sample_per_sid_memory_t));
/* Our brand-new car is ready */
ls_mem->fib_table = table_id;
diff --git a/src/examples/vlib/mc_test.c b/src/examples/vlib/mc_test.c
index e84a713cc59..464d07cc471 100644
--- a/src/examples/vlib/mc_test.c
+++ b/src/examples/vlib/mc_test.c
@@ -164,7 +164,7 @@ mc_test_process (vlib_main_t * vm,
int i;
char *intfcs[] = { "eth1", "eth0", "ce" };
- memset (&config, 0, sizeof (config));
+ clib_memset (&config, 0, sizeof (config));
config.name = "test";
config.window_size = tm->window_size;
config.rx_buffer = test_rx_callback;
diff --git a/src/plugins/abf/abf_api.c b/src/plugins/abf/abf_api.c
index 958d129f8a4..0bf714bff89 100644
--- a/src/plugins/abf/abf_api.c
+++ b/src/plugins/abf/abf_api.c
@@ -82,7 +82,7 @@ vl_api_abf_plugin_get_version_t_handler (vl_api_abf_plugin_get_version_t * mp)
}
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_ABF_PLUGIN_GET_VERSION_REPLY + abf_base_msg_id);
rmp->context = mp->context;
@@ -176,7 +176,7 @@ abf_policy_send_details (u32 api, void *args)
msg_size = sizeof (*mp) + sizeof (mp->policy.paths[0]) * n_paths;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ABF_POLICY_DETAILS + abf_base_msg_id);
/* fill in the message */
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index 2af2d7a8b70..dbc658b3640 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -212,7 +212,7 @@ vl_api_acl_plugin_get_version_t_handler (vl_api_acl_plugin_get_version_t * mp)
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_ACL_PLUGIN_GET_VERSION_REPLY + am->msg_id_base);
rmp->context = mp->context;
@@ -390,7 +390,7 @@ acl_add_list (u32 count, vl_api_acl_rule_t rules[],
for (i = 0; i < count; i++)
{
r = vec_elt_at_index (acl_new_rules, i);
- memset (r, 0, sizeof (*r));
+ clib_memset (r, 0, sizeof (*r));
r->is_permit = rules[i].is_permit;
r->is_ipv6 = rules[i].is_ipv6;
if (r->is_ipv6)
@@ -418,7 +418,7 @@ acl_add_list (u32 count, vl_api_acl_rule_t rules[],
{
/* Get ACL index */
pool_get_aligned (am->acls, a, CLIB_CACHE_LINE_BYTES);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* Will return the newly allocated ACL index */
*acl_list_index = a - am->acls;
}
@@ -1105,7 +1105,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
*/
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
/* source MAC address */
memcpy (&mask[6], mt->mac_mask, 6);
@@ -1113,20 +1113,20 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
l3_offset = 14;
last_tag_table = &mt->arp_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
l3_offset = 18;
last_tag_table = &mt->arp_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
l3_offset = 22;
last_tag_table = &mt->arp_dot1ad_table_index;
break;
@@ -1151,26 +1151,26 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
if (mt->has_egress)
{
/* egress ARP table */
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
switch (tags)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
l3_offset = 14;
out_last_tag_table = &mt->out_arp_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
l3_offset = 18;
out_last_tag_table = &mt->out_arp_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
l3_offset = 22;
out_last_tag_table = &mt->out_arp_dot1ad_table_index;
break;
@@ -1207,25 +1207,25 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
*/
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
memcpy (&mask[6], mt->mac_mask, 6);
l3_src_offs = tags * 4 + get_l3_src_offset (is6);
switch (tags)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
last_tag_table = &mt->dot1ad_table_index;
break;
}
@@ -1253,7 +1253,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
/* MAC destination */
memcpy (&mask[0], mt->mac_mask, 6);
l3_dst_offs = tags * 4 + get_l3_dst_offset (is6);
@@ -1261,18 +1261,18 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
case 0:
default:
- memset (&mask[12], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_table_index;
break;
case 1:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_dot1q_table_index;
break;
case 2:
- memset (&mask[12], 0xff, 2); /* VLAN tag1 */
- memset (&mask[16], 0xff, 2); /* VLAN tag2 */
- memset (&mask[20], 0xff, 2); /* ethernet protocol */
+ clib_memset (&mask[12], 0xff, 2); /* VLAN tag1 */
+ clib_memset (&mask[16], 0xff, 2); /* VLAN tag2 */
+ clib_memset (&mask[20], 0xff, 2); /* ethernet protocol */
out_last_tag_table = &mt->out_dot1ad_table_index;
break;
}
@@ -1327,7 +1327,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
l3_src_offs = tags * 4 + get_l3_src_offset (is6);
memcpy (&mask[6], a->rules[i].src_mac, 6);
switch (tags)
@@ -1369,13 +1369,13 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
vnet_classify_add_del_session (cm, tag_table,
mask, a->rules[i].is_permit ? ~0 : 0,
i, 0, action, metadata, 1);
- memset (&mask[12], 0, sizeof (mask) - 12);
+ clib_memset (&mask[12], 0, sizeof (mask) - 12);
}
/* add ARP table entry too */
if (!is6 && (mvec[match_type_index].arp_table_index != ~0))
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
memcpy (&mask[6], a->rules[i].src_mac, 6);
for (tags = 2; tags >= 0; tags--)
@@ -1422,7 +1422,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
/* Add the egress entry with destination set */
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
l3_dst_offs = tags * 4 + get_l3_dst_offset (is6);
/* src mac in the other direction becomes dst */
memcpy (&mask[0], a->rules[i].src_mac, 6);
@@ -1468,7 +1468,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
mask,
a->rules[i].is_permit ? ~0 : 0,
i, 0, action, metadata, 1);
- // memset (&mask[12], 0, sizeof (mask) - 12);
+ // clib_memset (&mask[12], 0, sizeof (mask) - 12);
}
/* add ARP table entry too */
@@ -1476,7 +1476,7 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
{
for (tags = 2; tags >= 0; tags--)
{
- memset (mask, 0, sizeof (mask));
+ clib_memset (mask, 0, sizeof (mask));
switch (tags)
{
case 0:
@@ -1644,7 +1644,7 @@ macip_acl_add_list (u32 count, vl_api_macip_acl_rule_t rules[],
{
/* Get ACL index */
pool_get_aligned (am->macip_acls, a, CLIB_CACHE_LINE_BYTES);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* Will return the newly allocated ACL index */
*acl_list_index = a - am->macip_acls;
}
@@ -1980,7 +1980,7 @@ send_acl_details (acl_main_t * am, vl_api_registration_t * reg,
void *oldheap = acl_set_heap (am);
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_DETAILS + am->msg_id_base);
/* fill in the message */
@@ -2066,7 +2066,7 @@ send_acl_interface_list_details (acl_main_t * am,
msg_size += sizeof (mp->acls[0]) * count;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id =
ntohs (VL_API_ACL_INTERFACE_LIST_DETAILS + am->msg_id_base);
@@ -2218,7 +2218,7 @@ send_macip_acl_details (acl_main_t * am, vl_api_registration_t * reg,
int msg_size = sizeof (*mp) + (acl ? sizeof (mp->r[0]) * acl->count : 0);
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_DETAILS + am->msg_id_base);
/* fill in the message */
@@ -2308,7 +2308,7 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_MACIP_ACL_INTERFACE_GET_REPLY + am->msg_id_base);
rmp->context = mp->context;
@@ -2332,7 +2332,7 @@ send_macip_acl_interface_list_details (acl_main_t * am,
int msg_size = sizeof (*rmp) + sizeof (rmp->acls[0]);
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_MACIP_ACL_INTERFACE_LIST_DETAILS + am->msg_id_base);
@@ -2448,7 +2448,7 @@ send_acl_interface_etype_whitelist_details (acl_main_t * am,
msg_size += sizeof (mp->whitelist[0]) * count;
mp = vl_msg_api_alloc (msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id =
ntohs (VL_API_ACL_INTERFACE_ETYPE_WHITELIST_DETAILS + am->msg_id_base);
@@ -3533,7 +3533,7 @@ acl_init (vlib_main_t * vm)
{
acl_main_t *am = &acl_main;
clib_error_t *error = 0;
- memset (am, 0, sizeof (*am));
+ clib_memset (am, 0, sizeof (*am));
am->vlib_main = vm;
am->vnet_main = vnet_get_main ();
am->log_default = vlib_log_register_class ("acl_plugin", 0);
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 991d877f7af..dcb0888076d 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -313,7 +313,7 @@ static int api_acl_plugin_get_version (vat_main_t * vam)
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_PLUGIN_GET_VERSION + sm->msg_id_base);
mp->client_index = vam->my_client_index;
@@ -334,7 +334,7 @@ static int api_macip_acl_interface_get (vat_main_t * vam)
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_INTERFACE_GET + sm->msg_id_base);
mp->client_index = vam->my_client_index;
@@ -519,7 +519,7 @@ static int api_acl_add_replace (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
@@ -693,7 +693,7 @@ api_acl_add_replace_from_file (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if (n_rules > 0)
@@ -1257,7 +1257,7 @@ static int api_macip_acl_add (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_ADD + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
@@ -1409,7 +1409,7 @@ static int api_macip_acl_add_replace (vat_main_t * vam)
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
- memset (mp, 0, msg_size);
+ clib_memset (mp, 0, msg_size);
mp->_vl_msg_id = ntohs (VL_API_MACIP_ACL_ADD_REPLACE + sm->msg_id_base);
mp->client_index = vam->my_client_index;
if ((n_rules > 0) && rules)
diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c
index 0087a5e2ab7..8c1004e9212 100644
--- a/src/plugins/acl/hash_lookup.c
+++ b/src/plugins/acl/hash_lookup.c
@@ -315,7 +315,7 @@ release_mask_type_index(acl_main_t *am, u32 mask_type_index)
DBG0("RELEAS MTE index %d new refcount %d", mask_type_index, mte->refcount);
if (mte->refcount == 0) {
/* we are not using this entry anymore */
- memset(mte, 0xae, sizeof(*mte));
+ clib_memset(mte, 0xae, sizeof(*mte));
pool_put(am->ace_mask_type_pool, mte);
}
}
@@ -1057,7 +1057,7 @@ ip4_address_mask_from_width (ip4_address_t * a, u32 width)
{
int i, byte, bit, bitnum;
ASSERT (width <= 32);
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
for (i = 0; i < width; i++)
{
bitnum = (7 - (i & 7));
@@ -1090,8 +1090,8 @@ make_port_mask(u16 *portmask, u16 port_first, u16 port_last)
static void
make_mask_and_match_from_rule(fa_5tuple_t *mask, acl_rule_t *r, hash_ace_info_t *hi)
{
- memset(mask, 0, sizeof(*mask));
- memset(&hi->match, 0, sizeof(hi->match));
+ clib_memset(mask, 0, sizeof(*mask));
+ clib_memset(&hi->match, 0, sizeof(hi->match));
hi->action = r->is_permit;
/* we will need to be matching based on lc_index and mask_type_index when applied */
@@ -1107,7 +1107,7 @@ make_mask_and_match_from_rule(fa_5tuple_t *mask, acl_rule_t *r, hash_ace_info_t
make_ip6_address_mask(&mask->ip6_addr[1], r->dst_prefixlen);
hi->match.ip6_addr[1] = r->dst.ip6;
} else {
- memset(hi->match.l3_zero_pad, 0, sizeof(hi->match.l3_zero_pad));
+ clib_memset(hi->match.l3_zero_pad, 0, sizeof(hi->match.l3_zero_pad));
make_ip4_address_mask(&mask->ip4_addr[0], r->src_prefixlen);
hi->match.ip4_addr[0] = r->src.ip4;
make_ip4_address_mask(&mask->ip4_addr[1], r->dst_prefixlen);
@@ -1166,7 +1166,7 @@ void hash_acl_add(acl_main_t *am, int acl_index)
acl_list_t *a = &am->acls[acl_index];
vec_validate(am->hash_acl_infos, acl_index);
hash_acl_info_t *ha = vec_elt_at_index(am->hash_acl_infos, acl_index);
- memset(ha, 0, sizeof(*ha));
+ clib_memset(ha, 0, sizeof(*ha));
ha->hash_acl_exists = 1;
/* walk the newly added ACL entries and ensure that for each of them there
@@ -1174,7 +1174,7 @@ void hash_acl_add(acl_main_t *am, int acl_index)
for(i=0; i < a->count; i++) {
hash_ace_info_t ace_info;
fa_5tuple_t mask;
- memset(&ace_info, 0, sizeof(ace_info));
+ clib_memset(&ace_info, 0, sizeof(ace_info));
ace_info.acl_index = acl_index;
ace_info.ace_index = i;
@@ -1481,8 +1481,8 @@ split_partition(acl_main_t *am, u32 first_index,
hash_acl_info_t *ha = vec_elt_at_index(am->hash_acl_infos, pae->acl_index);
hash_ace_info_t *ace_info;
u32 coll_mask_type_index = pae->mask_type_index;
- memset(&the_min_tuple, 0, sizeof(the_min_tuple));
- memset(&the_max_tuple, 0, sizeof(the_max_tuple));
+ clib_memset(&the_min_tuple, 0, sizeof(the_min_tuple));
+ clib_memset(&the_max_tuple, 0, sizeof(the_max_tuple));
int i=0;
u64 collisions = vec_len(pae->colliding_rules);
diff --git a/src/plugins/acl/public_inlines.h b/src/plugins/acl/public_inlines.h
index 576d081784c..850babfa872 100644
--- a/src/plugins/acl/public_inlines.h
+++ b/src/plugins/acl/public_inlines.h
@@ -73,7 +73,7 @@ acl_fill_5tuple_l3_data (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
}
else
{
- memset(p5tuple_pkt->l3_zero_pad, 0, sizeof(p5tuple_pkt->l3_zero_pad));
+ clib_memset(p5tuple_pkt->l3_zero_pad, 0, sizeof(p5tuple_pkt->l3_zero_pad));
clib_memcpy (&p5tuple_pkt->ip4_addr,
get_ptr_to_offset (b0,
offsetof (ip4_header_t,
diff --git a/src/plugins/avf/avf_api.c b/src/plugins/avf/avf_api.c
index 8cb585ded2c..3503177837f 100644
--- a/src/plugins/avf/avf_api.c
+++ b/src/plugins/avf/avf_api.c
@@ -64,7 +64,7 @@ vl_api_avf_create_t_handler (vl_api_avf_create_t * mp)
avf_create_if_args_t args;
int rv;
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
args.enable_elog = ntohl (mp->enable_elog);
args.addr.as_u32 = ntohl (mp->pci_addr);
diff --git a/src/plugins/avf/avf_test.c b/src/plugins/avf/avf_test.c
index fbb125cee9d..368d5035bb9 100644
--- a/src/plugins/avf/avf_test.c
+++ b/src/plugins/avf/avf_test.c
@@ -97,7 +97,7 @@ api_avf_create (vat_main_t * vam)
int ret;
u32 x[4];
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c
index cd5f02dea3e..492494dcc79 100644
--- a/src/plugins/avf/cli.c
+++ b/src/plugins/avf/cli.c
@@ -34,7 +34,7 @@ avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
avf_create_if_args_t args;
u32 tmp;
- memset (&args, 0, sizeof (avf_create_if_args_t));
+ clib_memset (&args, 0, sizeof (avf_create_if_args_t));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index e71b74ec8fc..914c32cab4b 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -227,7 +227,7 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
rxq->descs = vlib_physmem_alloc_aligned (vm, am->physmem_region, &error,
rxq->size * sizeof (avf_rx_desc_t),
2 * CLIB_CACHE_LINE_BYTES);
- memset ((void *) rxq->descs, 0, rxq->size * sizeof (avf_rx_desc_t));
+ clib_memset ((void *) rxq->descs, 0, rxq->size * sizeof (avf_rx_desc_t));
vec_validate_aligned (rxq->bufs, rxq->size, CLIB_CACHE_LINE_BYTES);
rxq->qrx_tail = ad->bar0 + AVF_QRX_TAIL (qid);
@@ -295,7 +295,7 @@ avf_arq_slot_init (avf_device_t * ad, u16 slot)
avf_aq_desc_t *d;
u64 pa = ad->arq_bufs_pa + slot * AVF_MBOX_BUF_SZ;
d = &ad->arq[slot];
- memset (d, 0, sizeof (avf_aq_desc_t));
+ clib_memset (d, 0, sizeof (avf_aq_desc_t));
d->flags = AVF_AQ_F_BUF;
d->datalen = AVF_MBOX_BUF_SZ;
d->addr_hi = (u32) (pa >> 32);
@@ -318,7 +318,7 @@ avf_adminq_init (vlib_main_t * vm, avf_device_t * ad)
int i;
/* VF MailBox Transmit */
- memset (ad->atq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
+ clib_memset (ad->atq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
ad->atq_bufs_pa = avf_dma_addr (vm, ad, ad->atq_bufs);
pa = avf_dma_addr (vm, ad, ad->atq);
@@ -329,7 +329,7 @@ avf_adminq_init (vlib_main_t * vm, avf_device_t * ad)
avf_reg_write (ad, AVF_ATQBAH, (u32) (pa >> 32)); /* Base Address High */
/* VF MailBox Receive */
- memset (ad->arq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
+ clib_memset (ad->arq, 0, sizeof (avf_aq_desc_t) * AVF_MBOX_LEN);
ad->arq_bufs_pa = avf_dma_addr (vm, ad, ad->arq_bufs);
for (i = 0; i < AVF_MBOX_LEN; i++)
@@ -498,7 +498,7 @@ avf_op_config_rss_lut (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_rss_lut_t *rl;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
rl = (virtchnl_rss_lut_t *) msg;
rl->vsi_id = ad->vsi_id;
rl->lut_entries = ad->rss_lut_size;
@@ -517,7 +517,7 @@ avf_op_config_rss_key (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_rss_key_t *rk;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
rk = (virtchnl_rss_key_t *) msg;
rk->vsi_id = ad->vsi_id;
rk->key_len = ad->rss_key_size;
@@ -558,7 +558,7 @@ avf_op_config_vsi_queues (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_vsi_queue_config_info_t *ci;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
ci = (virtchnl_vsi_queue_config_info_t *) msg;
ci->vsi_id = ad->vsi_id;
ci->num_queue_pairs = n_qp;
@@ -603,7 +603,7 @@ avf_op_config_irq_map (vlib_main_t * vm, avf_device_t * ad)
u8 msg[msg_len];
virtchnl_irq_map_info_t *imi;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
imi = (virtchnl_irq_map_info_t *) msg;
imi->num_vectors = count;
@@ -624,7 +624,7 @@ avf_op_add_eth_addr (vlib_main_t * vm, avf_device_t * ad, u8 count, u8 * macs)
virtchnl_ether_addr_list_t *al;
int i;
- memset (msg, 0, msg_len);
+ clib_memset (msg, 0, msg_len);
al = (virtchnl_ether_addr_list_t *) msg;
al->vsi_id = ad->vsi_id;
al->num_elements = count;
@@ -1161,7 +1161,7 @@ avf_delete_if (vlib_main_t * vm, avf_device_t * ad)
vec_free (ad->txqs);
clib_error_free (ad->error);
- memset (ad, 0, sizeof (*ad));
+ clib_memset (ad, 0, sizeof (*ad));
pool_put (am->devices, ad);
}
diff --git a/src/plugins/cdp/cdp_input.c b/src/plugins/cdp/cdp_input.c
index 66ae97142c5..dd3619cb8ac 100644
--- a/src/plugins/cdp/cdp_input.c
+++ b/src/plugins/cdp/cdp_input.c
@@ -328,7 +328,7 @@ cdp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
if (p == 0)
{
pool_get (cm->neighbors, n);
- memset (n, 0, sizeof (*n));
+ clib_memset (n, 0, sizeof (*n));
n->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
n->packet_template_index = (u8) ~ 0;
hash_set (cm->neighbor_by_sw_if_index, n->sw_if_index,
diff --git a/src/plugins/cdp/cdp_periodic.c b/src/plugins/cdp/cdp_periodic.c
index a4c4bb91765..da08523176f 100644
--- a/src/plugins/cdp/cdp_periodic.c
+++ b/src/plugins/cdp/cdp_periodic.c
@@ -408,11 +408,11 @@ cdp_periodic_init (vlib_main_t * vm)
{
ethernet_llc_snap_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/* Send to 01:00:0c:cc:cc */
h.ethernet.dst_address[0] = 0x01;
- /* h.ethernet.dst_address[1] = 0x00; (memset) */
+ /* h.ethernet.dst_address[1] = 0x00; (clib_memset) */
h.ethernet.dst_address[2] = 0x0C;
h.ethernet.dst_address[3] = 0xCC;
h.ethernet.dst_address[4] = 0xCC;
@@ -427,8 +427,8 @@ cdp_periodic_init (vlib_main_t * vm)
h.llc.control = 0x03; /* UI (no extended control bytes) */
/* SNAP */
- /* h.snap.oui[0] = 0x00; (memset) */
- /* h.snap.oui[1] = 0x00; (memset) */
+ /* h.snap.oui[0] = 0x00; (clib_memset) */
+ /* h.snap.oui[1] = 0x00; (clib_memset) */
h.snap.oui[2] = 0x0C; /* Cisco = 0x00000C */
h.snap.protocol = htons (0x2000); /* CDP = 0x2000 */
@@ -450,10 +450,10 @@ cdp_periodic_init (vlib_main_t * vm)
{
hdlc_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
h.hdlc.address = 0x0f;
- /* h.hdlc.control = 0; (memset) */
+ /* h.hdlc.control = 0; (clib_memset) */
h.hdlc.protocol = htons (0x2000); /* CDP = 0x2000 */
/* CDP */
@@ -472,11 +472,11 @@ cdp_periodic_init (vlib_main_t * vm)
{
srp_and_cdp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/* Send to 01:00:0c:cc:cc */
h.ethernet.dst_address[0] = 0x01;
- /* h.ethernet.dst_address[1] = 0x00; (memset) */
+ /* h.ethernet.dst_address[1] = 0x00; (clib_memset) */
h.ethernet.dst_address[2] = 0x0C;
h.ethernet.dst_address[3] = 0xCC;
h.ethernet.dst_address[4] = 0xCC;
diff --git a/src/plugins/dpdk/api/dpdk_test.c b/src/plugins/dpdk/api/dpdk_test.c
index 8204edfe66a..637b4016111 100644
--- a/src/plugins/dpdk/api/dpdk_test.c
+++ b/src/plugins/dpdk/api/dpdk_test.c
@@ -94,7 +94,7 @@ _(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY, \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + dm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
@@ -103,7 +103,7 @@ do { \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + dm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index cc7eed059f0..f7ed932e35f 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -140,7 +140,7 @@ del_free_list (vlib_main_t * vm, vlib_buffer_free_list_t * f)
vec_free (f->name);
vec_free (f->buffers);
/* Poison it. */
- memset (f, 0xab, sizeof (f[0]));
+ clib_memset (f, 0xab, sizeof (f[0]));
}
/* Add buffer free list. */
@@ -209,7 +209,7 @@ CLIB_MULTIARCH_FN (dpdk_buffer_fill_free_list) (vlib_main_t * vm,
if (rte_mempool_get_bulk (rmp, (void *) d->mbuf_alloc_list, n_alloc) < 0)
return 0;
- memset (&bt, 0, sizeof (vlib_buffer_t));
+ clib_memset (&bt, 0, sizeof (vlib_buffer_t));
vlib_buffer_init_for_free_list (&bt, fl);
bt.buffer_pool_index = privp->buffer_pool_index;
@@ -383,7 +383,7 @@ dpdk_packet_template_init (vlib_main_t * vm,
vlib_packet_template_t *t = (vlib_packet_template_t *) vt;
vlib_worker_thread_barrier_sync (vm);
- memset (t, 0, sizeof (t[0]));
+ clib_memset (t, 0, sizeof (t[0]));
vec_add (t->packet_data, packet_data, n_packet_data_bytes);
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index b9ba161423b..57430eff977 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -214,7 +214,7 @@ dpdk_device_stop (dpdk_device_t * xd)
rte_eth_allmulticast_disable (xd->port_id);
rte_eth_dev_stop (xd->port_id);
- memset (&xd->link, 0, sizeof (struct rte_eth_link));
+ clib_memset (&xd->link, 0, sizeof (struct rte_eth_link));
/* For bonded interface, stop slave links */
if (xd->pmd == VNET_DPDK_PMD_BOND)
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index 6ed11e2f304..6612ce4e1ad 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -179,7 +179,7 @@ dpdk_flow_add (dpdk_device_t * xd, vnet_flow_t * f, dpdk_flow_entry_t * fe)
.vni_reserved = clib_host_to_net_u32 (((u32) - 1) << 8)
};
- memset (raw, 0, sizeof raw);
+ clib_memset (raw, 0, sizeof raw);
raw[0].item.relative = 1;
raw[0].item.length = vxlan_hdr_sz;
@@ -258,12 +258,12 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
{
/* make sure no action is taken for in-flight (marked) packets */
fle = pool_elt_at_index (xd->flow_lookup_entries, fe->mark);
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
vec_add1 (xd->parked_lookup_indexes, fe->mark);
xd->parked_loop_count = dm->vlib_main->main_loop_count;
}
- memset (fe, 0, sizeof (*fe));
+ clib_memset (fe, 0, sizeof (*fe));
pool_put (xd->flow_entries, fe);
goto disable_rx_offload;
@@ -294,7 +294,7 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
fe->mark = fle - xd->flow_lookup_entries;
/* install entry in the lookup table */
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
if (flow->actions & VNET_FLOW_ACTION_MARK)
fle->flow_id = flow->mark_flow_id;
if (flow->actions & VNET_FLOW_ACTION_REDIRECT_TO_NODE)
@@ -329,11 +329,11 @@ dpdk_flow_ops_fn (vnet_main_t * vnm, vnet_flow_dev_op_t op, u32 dev_instance,
done:
if (rv)
{
- memset (fe, 0, sizeof (*fe));
+ clib_memset (fe, 0, sizeof (*fe));
pool_put (xd->flow_entries, fe);
if (fle)
{
- memset (fle, -1, sizeof (*fle));
+ clib_memset (fle, -1, sizeof (*fle));
pool_put (xd->flow_lookup_entries, fle);
}
}
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 7d9ec7e5c80..697458c04b6 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -145,7 +145,7 @@ dpdk_device_lock_init (dpdk_device_t * xd)
{
xd->lockp[q] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) xd->lockp[q], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) xd->lockp[q], 0, CLIB_CACHE_LINE_BYTES);
}
}
@@ -1518,7 +1518,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
return;
xd->time_last_link_update = now ? now : xd->time_last_link_update;
- memset (&xd->link, 0, sizeof (xd->link));
+ clib_memset (&xd->link, 0, sizeof (xd->link));
rte_eth_link_get_nowait (xd->port_id, &xd->link);
if (LINK_STATE_ELOGS)
diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c
index 04455c5d534..1a8dd6d98fe 100644
--- a/src/plugins/dpdk/hqos/hqos.c
+++ b/src/plugins/dpdk/hqos/hqos.c
@@ -268,10 +268,10 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
/* Allocate the per-thread device data array */
vec_validate_aligned (xd->hqos_wt, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0]));
+ clib_memset (xd->hqos_wt, 0, tm->n_vlib_mains * sizeof (xd->hqos_wt[0]));
vec_validate_aligned (xd->hqos_ht, 0, CLIB_CACHE_LINE_BYTES);
- memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0]));
+ clib_memset (xd->hqos_ht, 0, sizeof (xd->hqos_ht[0]));
/* Allocate space for one SWQ per worker thread in the I/O TX thread data structure */
vec_validate (xd->hqos_ht->swq, worker_thread_count);
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index 1bd46d55b8e..ded8912e943 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -407,7 +407,7 @@ static void __attribute__ ((unused)) clear_and_free_obj (void *obj)
{
struct rte_mempool *mp = rte_mempool_from_obj (obj);
- memset (obj, 0, mp->elt_size);
+ clib_memset (obj, 0, mp->elt_size);
rte_mempool_put (mp, obj);
}
@@ -1031,9 +1031,9 @@ dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
vec_validate_init_empty_aligned (cwm->ops, VLIB_FRAME_SIZE - 1, 0,
CLIB_CACHE_LINE_BYTES);
- memset (cwm->cipher_resource_idx, ~0,
+ clib_memset (cwm->cipher_resource_idx, ~0,
IPSEC_CRYPTO_N_ALG * sizeof(*cwm->cipher_resource_idx));
- memset (cwm->auth_resource_idx, ~0,
+ clib_memset (cwm->auth_resource_idx, ~0,
IPSEC_INTEG_N_ALG * sizeof(*cwm->auth_resource_idx));
}
/* *INDENT-ON* */
diff --git a/src/plugins/flowprobe/flowprobe.c b/src/plugins/flowprobe/flowprobe.c
index ee951965e96..c130b908934 100644
--- a/src/plugins/flowprobe/flowprobe.c
+++ b/src/plugins/flowprobe/flowprobe.c
@@ -1113,9 +1113,9 @@ flowprobe_init (vlib_main_t * vm)
fm->vlib_time_0 = vlib_time_now (vm);
fm->nanosecond_time_0 = unix_time_now_nsec ();
- memset (fm->template_reports, 0, sizeof (fm->template_reports));
- memset (fm->template_size, 0, sizeof (fm->template_size));
- memset (fm->template_per_flow, 0, sizeof (fm->template_per_flow));
+ clib_memset (fm->template_reports, 0, sizeof (fm->template_reports));
+ clib_memset (fm->template_size, 0, sizeof (fm->template_size));
+ clib_memset (fm->template_per_flow, 0, sizeof (fm->template_per_flow));
/* Decide how many worker threads we have */
num_threads = 1 /* main thread */ + tm->n_threads;
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 0cbe9910101..6bd1abc727e 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -143,7 +143,7 @@ gbp_endpoint_send_details (gbp_endpoint_t * gbpe, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_ENDPOINT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -242,7 +242,7 @@ gbp_subnet_send_details (u32 table_id,
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_SUBNET_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -285,7 +285,7 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gepg, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_ENDPOINT_GROUP_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -351,7 +351,7 @@ gbp_recirc_send_details (gbp_recirc_t * gr, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_RECIRC_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
@@ -409,7 +409,7 @@ gbp_contract_send_details (gbp_contract_t * gbpc, void *args)
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GBP_CONTRACT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
diff --git a/src/plugins/gbp/gbp_endpoint_group.c b/src/plugins/gbp/gbp_endpoint_group.c
index 27d404e09dd..095c8fe607b 100644
--- a/src/plugins/gbp/gbp_endpoint_group.c
+++ b/src/plugins/gbp/gbp_endpoint_group.c
@@ -61,7 +61,7 @@ gbp_endpoint_group_add (epg_id_t epg_id,
fib_protocol_t fproto;
pool_get (gbp_endpoint_group_pool, gepg);
- memset (gepg, 0, sizeof (*gepg));
+ clib_memset (gepg, 0, sizeof (*gepg));
gepg->gepg_id = epg_id;
gepg->gepg_bd = bd_id;
diff --git a/src/plugins/gbp/gbp_policy_dpo.c b/src/plugins/gbp/gbp_policy_dpo.c
index 3a06604121b..a2d9510b838 100644
--- a/src/plugins/gbp/gbp_policy_dpo.c
+++ b/src/plugins/gbp/gbp_policy_dpo.c
@@ -110,7 +110,7 @@ gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
dpo_id_t parent = DPO_INVALID;
gpd = gbp_policy_dpo_alloc ();
- memset (gpd, 0, sizeof (*gpd));
+ clib_memset (gpd, 0, sizeof (*gpd));
gpd->gpd_proto = dproto;
gpd->gpd_sw_if_index = sw_if_index;
diff --git a/src/plugins/gbp/gbp_recirc.c b/src/plugins/gbp/gbp_recirc.c
index 576ec8512bc..95e8066d443 100644
--- a/src/plugins/gbp/gbp_recirc.c
+++ b/src/plugins/gbp/gbp_recirc.c
@@ -46,7 +46,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
fib_protocol_t fproto;
pool_get (gbp_recirc_pool, gr);
- memset (gr, 0, sizeof (*gr));
+ clib_memset (gr, 0, sizeof (*gr));
gri = gr - gbp_recirc_pool;
gr->gr_epg = epg_id;
diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c
index 027af9b4aec..dcdbc518b30 100644
--- a/src/plugins/gtpu/gtpu.c
+++ b/src/plugins/gtpu/gtpu.c
@@ -397,7 +397,7 @@ int vnet_gtpu_add_del_tunnel
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (gtm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* copy from arg structure */
#define _(x) t->x = a->x;
@@ -672,8 +672,8 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -796,7 +796,7 @@ gtpu_add_del_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/plugins/gtpu/gtpu_api.c b/src/plugins/gtpu/gtpu_api.c
index 502720df179..f2f1c297850 100644
--- a/src/plugins/gtpu/gtpu_api.c
+++ b/src/plugins/gtpu/gtpu_api.c
@@ -156,7 +156,7 @@ static void send_gtpu_tunnel_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->dst);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_GTPU_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/plugins/gtpu/gtpu_decap.c b/src/plugins/gtpu/gtpu_decap.c
index d52ccc0219c..c4e6c85418e 100644
--- a/src/plugins/gtpu/gtpu_decap.c
+++ b/src/plugins/gtpu/gtpu_decap.c
@@ -87,7 +87,7 @@ gtpu_input (vlib_main_t * vm,
if (is_ip4)
last_key4.as_u64 = ~0;
else
- memset (&last_key6, 0xff, sizeof (last_key6));
+ clib_memset (&last_key6, 0xff, sizeof (last_key6));
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/plugins/gtpu/gtpu_test.c b/src/plugins/gtpu/gtpu_test.c
index 1eb54d6a6b8..f9812c65ccf 100644
--- a/src/plugins/gtpu/gtpu_test.c
+++ b/src/plugins/gtpu/gtpu_test.c
@@ -247,8 +247,8 @@ api_gtpu_add_del_tunnel (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/igmp/igmp.c b/src/plugins/igmp/igmp.c
index 61a9970af14..e12a6323b40 100644
--- a/src/plugins/igmp/igmp.c
+++ b/src/plugins/igmp/igmp.c
@@ -375,7 +375,7 @@ igmp_enable_disable (u32 sw_if_index, u8 enable, igmp_mode_t mode)
vec_validate_init_empty (im->igmp_config_by_sw_if_index,
sw_if_index, ~0);
pool_get (im->configs, config);
- memset (config, 0, sizeof (igmp_config_t));
+ clib_memset (config, 0, sizeof (igmp_config_t));
config->sw_if_index = sw_if_index;
config->igmp_group_by_key =
hash_create_mem (0, sizeof (igmp_key_t), sizeof (uword));
diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c
index 5d836967b4b..75a2daedd62 100644
--- a/src/plugins/igmp/igmp_api.c
+++ b/src/plugins/igmp/igmp_api.c
@@ -81,7 +81,7 @@ vl_api_igmp_listen_t_handler (vl_api_igmp_listen_t * mp)
goto done;
}
- memset (&gaddr, 0, sizeof (gaddr));
+ clib_memset (&gaddr, 0, sizeof (gaddr));
clib_memcpy (&gaddr.ip4, &mp->group.gaddr, sizeof (ip4_address_t));
vec_validate (saddrs, mp->group.n_srcs - 1);
@@ -167,7 +167,7 @@ send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im,
vl_api_igmp_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (IGMP_MSG_ID (VL_API_IGMP_DETAILS));
mp->context = context;
@@ -298,7 +298,7 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx,
vl_api_igmp_group_prefix_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (IGMP_MSG_ID (VL_API_IGMP_DETAILS));
mp->context = ctx->context;
@@ -364,7 +364,7 @@ vl_api_want_igmp_events_t_handler (vl_api_want_igmp_events_t * mp)
if (mp->enable)
{
pool_get (im->api_clients, api_client);
- memset (api_client, 0, sizeof (vpe_client_registration_t));
+ clib_memset (api_client, 0, sizeof (vpe_client_registration_t));
api_client->client_index = mp->client_index;
api_client->client_pid = mp->pid;
hash_set (im->igmp_api_client_by_client_index,
@@ -405,7 +405,7 @@ send_igmp_event (unix_shared_memory_queue_t * q,
const ip46_address_t * saddr, const ip46_address_t * gaddr)
{
vl_api_igmp_event_t *mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs ((VL_API_IGMP_EVENT) + igmp_main.msg_id_base);
mp->context = context;
diff --git a/src/plugins/igmp/igmp_group.c b/src/plugins/igmp/igmp_group.c
index 9f50ad9b05a..38499e4778f 100644
--- a/src/plugins/igmp/igmp_group.c
+++ b/src/plugins/igmp/igmp_group.c
@@ -109,7 +109,7 @@ igmp_group_alloc (igmp_config_t * config,
IGMP_DBG ("new-group: %U", format_igmp_key, gkey);
pool_get (im->groups, group);
- memset (group, 0, sizeof (igmp_group_t));
+ clib_memset (group, 0, sizeof (igmp_group_t));
group->key = clib_mem_alloc (sizeof (igmp_key_t));
clib_memcpy (group->key, gkey, sizeof (igmp_key_t));
group->igmp_src_by_key[IGMP_FILTER_MODE_INCLUDE] =
diff --git a/src/plugins/igmp/igmp_pkt.c b/src/plugins/igmp/igmp_pkt.c
index a2034d4bec6..c2a5d0911c6 100644
--- a/src/plugins/igmp/igmp_pkt.c
+++ b/src/plugins/igmp/igmp_pkt.c
@@ -73,7 +73,7 @@ igmp_pkt_build_ip_header (igmp_pkt_build_t * bk,
return (NULL);
ip4 = vlib_buffer_get_current (b);
- memset (ip4, 0, sizeof (ip4_header_t));
+ clib_memset (ip4, 0, sizeof (ip4_header_t));
ip4->ip_version_and_header_length = 0x46;
ip4->ttl = 1;
ip4->protocol = IP_PROTOCOL_IGMP;
@@ -402,7 +402,7 @@ igmp_pkt_report_v3_add_group (igmp_pkt_build_report_t * br,
void
igmp_pkt_build_report_init (igmp_pkt_build_report_t * br, u32 sw_if_index)
{
- memset (br, 0, sizeof (*br));
+ clib_memset (br, 0, sizeof (*br));
br->base.sw_if_index = sw_if_index;
}
@@ -525,7 +525,7 @@ igmp_pkt_query_v3_send (igmp_pkt_build_query_t * bq)
void
igmp_pkt_build_query_init (igmp_pkt_build_query_t * bq, u32 sw_if_index)
{
- memset (bq, 0, sizeof (*bq));
+ clib_memset (bq, 0, sizeof (*bq));
bq->base.sw_if_index = sw_if_index;
}
diff --git a/src/plugins/igmp/igmp_proxy.c b/src/plugins/igmp/igmp_proxy.c
index 4a439d650c9..690b38a8001 100644
--- a/src/plugins/igmp/igmp_proxy.c
+++ b/src/plugins/igmp/igmp_proxy.c
@@ -106,7 +106,7 @@ igmp_proxy_device_add_del (u32 vrf_id, u32 sw_if_index, u8 add)
pool_get (im->proxy_devices, proxy_device);
im->igmp_proxy_device_by_vrf_id[vrf_id] =
proxy_device - im->proxy_devices;
- memset (proxy_device, 0, sizeof (igmp_proxy_device_t));
+ clib_memset (proxy_device, 0, sizeof (igmp_proxy_device_t));
proxy_device->vrf_id = vrf_id;
proxy_device->upstream_if = sw_if_index;
config->proxy_device_id = vrf_id;
diff --git a/src/plugins/igmp/igmp_src.c b/src/plugins/igmp/igmp_src.c
index 0bdde83214c..cc7de6c1921 100644
--- a/src/plugins/igmp/igmp_src.c
+++ b/src/plugins/igmp/igmp_src.c
@@ -78,7 +78,7 @@ igmp_src_alloc (u32 group_index, const igmp_key_t * skey, igmp_mode_t mode)
IGMP_DBG ("new-src: (%U)", format_igmp_key, skey);
pool_get (im->srcs, src);
- memset (src, 0, sizeof (igmp_src_t));
+ clib_memset (src, 0, sizeof (igmp_src_t));
src->mode = mode;
src->key = clib_mem_alloc (sizeof (*skey));
src->group = group_index;
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index 440dcca8369..c16e8398bd3 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -288,7 +288,7 @@ ioam_send_flows (flow_report_main_t * frm, flow_report_t * fr,
stream = &frm->streams[fr->stream_index];
- memset (&temp, 0, sizeof (ip6_address_t));
+ clib_memset (&temp, 0, sizeof (ip6_address_t));
aggregated_data = ioam_analyser_main.aggregated_data;
data_len = vec_len (aggregated_data);
@@ -402,7 +402,7 @@ ioam_flow_create (u8 del)
flow_report_main_t *frm = &flow_report_main;
u16 template_id;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
args.rewrite_callback = ioam_template_rewrite;
args.flow_data_callback = ioam_send_flows;
del ? (args.is_add = 0) : (args.is_add = 1);
diff --git a/src/plugins/ioam/encap/ip6_ioam_pot.c b/src/plugins/ioam/encap/ip6_ioam_pot.c
index 9a76123330d..8dd06c144e3 100644
--- a/src/plugins/ioam/encap/ip6_ioam_pot.c
+++ b/src/plugins/ioam/encap/ip6_ioam_pot.c
@@ -242,7 +242,7 @@ ip6_hop_by_hop_ioam_pot_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main();
- memset(hm->counters, 0, sizeof(hm->counters));
+ clib_memset(hm->counters, 0, sizeof(hm->counters));
if (ip6_hbh_register_option(HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT, ip6_hbh_ioam_proof_of_transit_handler,
ip6_hbh_ioam_proof_of_transit_trace_handler) < 0)
diff --git a/src/plugins/ioam/encap/ip6_ioam_trace.c b/src/plugins/ioam/encap/ip6_ioam_trace.c
index 3ec3ea82113..148d566e65e 100644
--- a/src/plugins/ioam/encap/ip6_ioam_trace.c
+++ b/src/plugins/ioam/encap/ip6_ioam_trace.c
@@ -430,7 +430,7 @@ ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main ();
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (ip6_hbh_register_option
diff --git a/src/plugins/ioam/export-common/ioam_export.h b/src/plugins/ioam/export-common/ioam_export.h
index 6e640951802..511cb88a73b 100644
--- a/src/plugins/ioam/export-common/ioam_export.h
+++ b/src/plugins/ioam/export-common/ioam_export.h
@@ -187,7 +187,7 @@ ioam_export_thread_buffer_init (ioam_export_main_t * em, vlib_main_t * vm)
{
eb = 0;
pool_get_aligned (em->buffer_pool, eb, CLIB_CACHE_LINE_BYTES);
- memset (eb, 0, sizeof (*eb));
+ clib_memset (eb, 0, sizeof (*eb));
em->buffer_per_thread[i] = eb - em->buffer_pool;
if (ioam_export_init_buffer (em, vm, eb) != 1)
{
@@ -196,7 +196,7 @@ ioam_export_thread_buffer_init (ioam_export_main_t * em, vlib_main_t * vm)
}
em->lockp[i] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) em->lockp[i], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) em->lockp[i], 0, CLIB_CACHE_LINE_BYTES);
}
return (1);
}
@@ -412,7 +412,7 @@ ioam_export_process_common (ioam_export_main_t * em, vlib_main_t * vm,
{
pool_get_aligned (em->buffer_pool, new_eb,
CLIB_CACHE_LINE_BYTES);
- memset (new_eb, 0, sizeof (*new_eb));
+ clib_memset (new_eb, 0, sizeof (*new_eb));
if (ioam_export_init_buffer (em, vm, new_eb) == 1)
{
new_pool_index = new_eb - em->buffer_pool;
diff --git a/src/plugins/ioam/ip6/ioam_cache.c b/src/plugins/ioam/ip6/ioam_cache.c
index e2f878a5f77..fcacae0cf2c 100644
--- a/src/plugins/ioam/ip6/ioam_cache.c
+++ b/src/plugins/ioam/ip6/ioam_cache.c
@@ -381,7 +381,7 @@ ioam_cache_init (vlib_main_t * vm)
name = format (0, "ioam_cache_%08x%c", api_version, 0);
- memset (&ioam_cache_main, 0, sizeof (ioam_cache_main));
+ clib_memset (&ioam_cache_main, 0, sizeof (ioam_cache_main));
/* Ask for a correctly-sized block of API message decode slots */
em->msg_id_base = vl_msg_api_get_msg_ids
((char *) name, VL_MSG_FIRST_AVAILABLE);
diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h
index 3a3cf6a620e..717aaf11b8f 100644
--- a/src/plugins/ioam/ip6/ioam_cache.h
+++ b/src/plugins/ioam/ip6/ioam_cache.h
@@ -299,7 +299,7 @@ ioam_cache_entry_free (ioam_cache_entry_t * entry)
if (entry)
{
vec_free (entry->ioam_rewrite_string);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
pool_put (cm->ioam_rewrite_pool, entry);
}
}
@@ -371,7 +371,7 @@ ioam_cache_add (vlib_buffer_t * b0,
ioam_e2e_id_option_t *e2e = 0;
pool_get_aligned (cm->ioam_rewrite_pool, entry, CLIB_CACHE_LINE_BYTES);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
pool_index = entry - cm->ioam_rewrite_pool;
clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64,
@@ -437,7 +437,7 @@ ioam_cache_sr_rewrite_template_create (void)
/* This nodes address and the original dest will be
* filled when the packet is processed */
vec_add2 (segments, this_seg, 1);
- memset (this_seg, 0xfe, sizeof (ip6_address_t));
+ clib_memset (this_seg, 0xfe, sizeof (ip6_address_t));
cm->sr_rewrite_template = ip6_sr_compute_rewrite_string_insert (segments);
vec_free (segments);
}
@@ -540,7 +540,7 @@ ioam_cache_ts_table_init (vlib_main_t * vm)
{
pool_alloc_aligned (cm->ioam_ts_pool[i],
MAX_CACHE_TS_ENTRIES, CLIB_CACHE_LINE_BYTES);
- memset (&cm->ts_stats[i], 0, sizeof (ioam_cache_ts_pool_stats_t));
+ clib_memset (&cm->ts_stats[i], 0, sizeof (ioam_cache_ts_pool_stats_t));
tw_timer_wheel_init_16t_2w_512sl (&cm->timer_wheels[i],
expired_cache_ts_timer_callback,
IOAM_CACHE_TS_TICK
@@ -592,7 +592,7 @@ ioam_cache_ts_entry_free (u32 thread_id,
}
pool_put (cm->ioam_ts_pool[thread_id], entry);
cm->ts_stats[thread_id].inuse--;
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
}
}
@@ -654,7 +654,7 @@ ioam_cache_ts_add (ip6_header_t * ip0,
pool_get_aligned (cm->ioam_ts_pool[thread_id], entry,
CLIB_CACHE_LINE_BYTES);
- memset (entry, 0, sizeof (*entry));
+ clib_memset (entry, 0, sizeof (*entry));
*pool_index = entry - cm->ioam_ts_pool[thread_id];
clib_memcpy (entry->dst_address.as_u64, ip0->dst_address.as_u64,
diff --git a/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h b/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
index 6bd38ff2968..31a7431c401 100644
--- a/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
+++ b/src/plugins/ioam/lib-e2e/ioam_seqno_lib.h
@@ -138,7 +138,7 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
else
{
seqno_rx->lost_packets += diff - 1;
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
}
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
@@ -151,7 +151,7 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
{
if (seqno_check_wraparound (bitmap->highest, seqno))
{
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
return;
@@ -162,7 +162,8 @@ ioam_analyze_seqno (seqno_rx_info * seqno_rx, u64 seqno)
if (peer_dead_count > 25)
{
peer_dead_count = 0;
- memset (bitmap->array, 0, bitmap->array_size * sizeof (u64));
+ clib_memset (bitmap->array, 0,
+ bitmap->array_size * sizeof (u64));
BIT_SET (bitmap->array, seqno & bitmap->mask);
bitmap->highest = seqno;
}
diff --git a/src/plugins/ioam/lib-pot/pot_util.c b/src/plugins/ioam/lib-pot/pot_util.c
index a253ad4130f..2fe9ce97f4e 100644
--- a/src/plugins/ioam/lib-pot/pot_util.c
+++ b/src/plugins/ioam/lib-pot/pot_util.c
@@ -50,7 +50,7 @@ static void pot_profile_init(pot_profile * new, u8 id)
{
if (new)
{
- memset(new, 0, sizeof(pot_profile));
+ clib_memset(new, 0, sizeof(pot_profile));
new->id = id;
}
}
@@ -110,7 +110,7 @@ static void pot_profile_cleanup(pot_profile * profile)
{
u16 id = profile->id;
- memset(profile, 0, sizeof(pot_profile));
+ clib_memset(profile, 0, sizeof(pot_profile));
profile->id = id; /* Restore id alone */
}
diff --git a/src/plugins/ioam/lib-trace/trace_util.c b/src/plugins/ioam/lib-trace/trace_util.c
index b316a236286..af92513685f 100644
--- a/src/plugins/ioam/lib-trace/trace_util.c
+++ b/src/plugins/ioam/lib-trace/trace_util.c
@@ -26,7 +26,7 @@ static int
trace_profile_cleanup (trace_profile * profile)
{
- memset (profile, 0, sizeof (trace_profile));
+ clib_memset (profile, 0, sizeof (trace_profile));
profile->trace_tsp = TSP_MICROSECONDS; /* Micro seconds */
ip6_trace_profile_cleanup (); /* lib-trace_TODO: Remove this once IOAM-IPv6 transport is a plugin */
return 0;
diff --git a/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c b/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
index 60eabc22019..7567f31caf2 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/ioam_transit.c
@@ -120,7 +120,7 @@ vxlan_gpe_transit_ioam (vlib_main_t * vm,
uword *t = NULL;
vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main;
fib_prefix_t key4;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = ip0->dst_address.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
index 870764eb971..2d9c6bfab3d 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_api.c
@@ -249,7 +249,7 @@ static void vl_api_vxlan_gpe_ioam_transit_enable_t_handler
vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
ip46_address_t dst_addr;
- memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
+ clib_memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
if (!mp->is_ipv6)
{
clib_memcpy (&dst_addr.ip4, &mp->dst_addr, sizeof (dst_addr.ip4));
@@ -271,7 +271,7 @@ static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler
vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
ip46_address_t dst_addr;
- memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
+ clib_memset (&dst_addr.ip4, 0, sizeof (dst_addr.ip4));
if (!mp->is_ipv6)
{
clib_memcpy (&dst_addr.ip4, &mp->dst_addr, sizeof (dst_addr.ip4));
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
index 8558c505a43..5a59e75bf01 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c
@@ -222,7 +222,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
if (is_ipv4)
{
- memset (&fib_prefix, 0, sizeof (fib_prefix_t));
+ clib_memset (&fib_prefix, 0, sizeof (fib_prefix_t));
fib_prefix.fp_len = 32;
fib_prefix.fp_proto = FIB_PROTOCOL_IP4;
fib_prefix.fp_addr = dst_addr;
@@ -303,7 +303,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
vxlan_gpe_ioam_dest_tunnels_t *t1;
fib_prefix_t key4, *key4_copy;
hash_pair_t *hp;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
@@ -314,7 +314,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
return 0;
}
pool_get_aligned (hm->dst_tunnels, t1, CLIB_CACHE_LINE_BYTES);
- memset (t1, 0, sizeof (*t1));
+ clib_memset (t1, 0, sizeof (*t1));
t1->fp_proto = FIB_PROTOCOL_IP4;
t1->dst_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
key4_copy = clib_mem_alloc (sizeof (*key4_copy));
diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
index e758b522ba0..e2c130c00df 100644
--- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
+++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
@@ -449,7 +449,7 @@ vxlan_gpe_ioam_trace_init (vlib_main_t * vm)
hm->vlib_main = vm;
hm->vnet_main = vnet_get_main ();
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (vxlan_gpe_ioam_register_option
(VXLAN_GPE_OPTION_TYPE_IOAM_TRACE,
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 73835919dd9..7a7cad4934a 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -231,7 +231,7 @@ udp_ping_flow_create (u8 del)
flow_report_main_t *frm = &flow_report_main;
u16 template_id;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
args.rewrite_callback = udp_ping_template_rewrite;
args.flow_data_callback = udp_ping_send_flows;
del ? (args.is_add = 0) : (args.is_add = 1);
diff --git a/src/plugins/ioam/udp-ping/udp_ping_test.c b/src/plugins/ioam/udp-ping/udp_ping_test.c
index 9a5375cda0d..9c795969d51 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_test.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_test.c
@@ -95,7 +95,7 @@ _(UDP_PING_EXPORT_REPLY, udp_ping_export_reply) \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
diff --git a/src/plugins/ixge/ixge.c b/src/plugins/ixge/ixge.c
index 09394ca4fc0..3c4a5b4bbfc 100644
--- a/src/plugins/ixge/ixge.c
+++ b/src/plugins/ixge/ixge.c
@@ -2496,8 +2496,8 @@ ixge_dma_init (ixge_device_t * xd, vlib_rx_or_tx_t rt, u32 queue_index)
if (error)
return error;
- memset (dq->descriptors, 0,
- dq->n_descriptors * sizeof (dq->descriptors[0]));
+ clib_memset (dq->descriptors, 0,
+ dq->n_descriptors * sizeof (dq->descriptors[0]));
vec_resize (dq->descriptor_buffer_indices, dq->n_descriptors);
if (rt == VLIB_RX)
@@ -2723,7 +2723,7 @@ ixge_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
vec_foreach (xd, xm->devices)
{
ixge_update_counters (xd);
- memset (xd->counters, 0, sizeof (xd->counters));
+ clib_memset (xd->counters, 0, sizeof (xd->counters));
}
timeout = 30.0;
@@ -2798,10 +2798,10 @@ ixge_init (vlib_main_t * vm)
clib_error_t *error;
xm->vlib_main = vm;
- memset (&xm->tx_descriptor_template, 0,
- sizeof (xm->tx_descriptor_template));
- memset (&xm->tx_descriptor_template_mask, 0,
- sizeof (xm->tx_descriptor_template_mask));
+ clib_memset (&xm->tx_descriptor_template, 0,
+ sizeof (xm->tx_descriptor_template));
+ clib_memset (&xm->tx_descriptor_template_mask, 0,
+ sizeof (xm->tx_descriptor_template_mask));
xm->tx_descriptor_template.status0 =
(IXGE_TX_DESCRIPTOR_STATUS0_ADVANCED |
IXGE_TX_DESCRIPTOR_STATUS0_IS_ADVANCED |
diff --git a/src/plugins/l2e/l2e.c b/src/plugins/l2e/l2e.c
index a56c25c54f8..77abbecaa95 100644
--- a/src/plugins/l2e/l2e.c
+++ b/src/plugins/l2e/l2e.c
@@ -82,7 +82,7 @@ l2_emulation_disable (u32 sw_if_index)
if (vec_len (l2_emulations) >= sw_if_index)
{
l2_emulation_t *l23e = &l2_emulations[sw_if_index];
- memset (l23e, 0, sizeof (*l23e));
+ clib_memset (l23e, 0, sizeof (*l23e));
l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_L2_EMULATION, 0);
ip4_sw_interface_enable_disable (sw_if_index, 0);
diff --git a/src/plugins/lacp/cli.c b/src/plugins/lacp/cli.c
index c6184b6937e..d210139c4b4 100644
--- a/src/plugins/lacp/cli.c
+++ b/src/plugins/lacp/cli.c
@@ -33,7 +33,7 @@ lacp_dump_ifs (lacp_interface_details_t ** out_lacpifs)
if ((sif->port_enabled == 0) || (sif->lacp_enabled == 0))
continue;
vec_add2(r_lacpifs, lacpif, 1);
- memset (lacpif, 0, sizeof (*lacpif));
+ clib_memset (lacpif, 0, sizeof (*lacpif));
lacpif->sw_if_index = sif->sw_if_index;
hi = vnet_get_hw_interface (vnm, sif->hw_if_index);
clib_memcpy(lacpif->interface_name, hi->name,
diff --git a/src/plugins/lacp/lacp.c b/src/plugins/lacp/lacp.c
index 7bd6e374dab..473458af4e4 100644
--- a/src/plugins/lacp/lacp.c
+++ b/src/plugins/lacp/lacp.c
@@ -216,7 +216,7 @@ lacp_periodic_init (vlib_main_t * vm)
/* Create the ethernet lacp packet template */
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
memcpy (h.ethernet.dst_address, dst, sizeof (h.ethernet.dst_address));
@@ -253,7 +253,7 @@ lacp_periodic_init (vlib_main_t * vm)
/* Create the ethernet marker protocol packet template */
- memset (&m, 0, sizeof (m));
+ clib_memset (&m, 0, sizeof (m));
memcpy (m.ethernet.dst_address, dst, sizeof (m.ethernet.dst_address));
diff --git a/src/plugins/lacp/lacp_api.c b/src/plugins/lacp/lacp_api.c
index 129c3605527..8bb6fa90eb0 100644
--- a/src/plugins/lacp/lacp_api.c
+++ b/src/plugins/lacp/lacp_api.c
@@ -99,7 +99,7 @@ lacp_send_sw_interface_details (vl_api_registration_t * reg,
vl_api_sw_interface_lacp_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_LACP_DETAILS + lm->msg_id_base);
mp->sw_if_index = htonl (lacp_if->sw_if_index);
diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c
index 76bbfa0ac81..53264339811 100644
--- a/src/plugins/lb/lb.c
+++ b/src/plugins/lb/lb.c
@@ -676,7 +676,7 @@ next:
{
/* Add SNAT static mapping */
pool_get (lbm->snat_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
if (lb_vip_is_nat4_port(vip)) {
lb_snat4_key_t m_key4;
clib_bihash_kv_8_8_t kv4;
diff --git a/src/plugins/mactime/mactime.c b/src/plugins/mactime/mactime.c
index c5c6b8b9f2c..21857d430c0 100644
--- a/src/plugins/mactime/mactime.c
+++ b/src/plugins/mactime/mactime.c
@@ -199,7 +199,7 @@ mactime_send_create_entry_message (u8 * mac_address)
am = &api_main;
shmem_hdr = am->shmem_hdr;
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MACTIME_ADD_DEL_RANGE + mm->msg_id_base);
name = format (0, "mac-%U", format_mac_address, mac_address);
@@ -227,7 +227,7 @@ static void vl_api_mactime_add_del_range_t_handler
feature_init (mm);
- memset (&kv, 0, sizeof (kv));
+ clib_memset (&kv, 0, sizeof (kv));
memcpy (&kv.key, mp->mac_address, sizeof (mp->mac_address));
/* See if we have a lookup table entry for this src mac address */
@@ -241,7 +241,7 @@ static void vl_api_mactime_add_del_range_t_handler
if (found == 0)
{
pool_get (mm->devices, dp);
- memset (dp, 0, sizeof (*dp));
+ clib_memset (dp, 0, sizeof (*dp));
vlib_validate_combined_counter (&mm->allow_counters,
dp - mm->devices);
vlib_zero_combined_counter (&mm->allow_counters, dp - mm->devices);
diff --git a/src/plugins/map/examples/health_check.c b/src/plugins/map/examples/health_check.c
index 5f0d85fec08..f4e9a689b5b 100644
--- a/src/plugins/map/examples/health_check.c
+++ b/src/plugins/map/examples/health_check.c
@@ -55,7 +55,7 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
- memset(&ifr, 0, sizeof(ifr));
+ clib_memset(&ifr, 0, sizeof(ifr));
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", interface);
/* Bind socket to interface of this node. */
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c
index f2da818dd7b..13caa368322 100644
--- a/src/plugins/map/map.c
+++ b/src/plugins/map/map.c
@@ -130,7 +130,7 @@ map_create_domain (ip4_address_t * ip4_prefix,
/* Get domain index */
pool_get_aligned (mm->domains, d, CLIB_CACHE_LINE_BYTES);
- memset (d, 0, sizeof (*d));
+ clib_memset (d, 0, sizeof (*d));
*map_domain_index = d - mm->domains;
/* Init domain struct */
@@ -316,7 +316,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep,
d->rules = clib_mem_alloc_aligned (l, CLIB_CACHE_LINE_BYTES);
if (!d->rules)
return -1;
- memset (d->rules, 0, l);
+ clib_memset (d->rules, 0, l);
}
if (psid >= (0x1 << d->psid_length))
@@ -332,7 +332,7 @@ map_add_del_psid (u32 map_domain_index, u16 psid, ip6_address_t * tep,
}
else
{
- memset (&d->rules[psid], 0, sizeof (ip6_address_t));
+ clib_memset (&d->rules[psid], 0, sizeof (ip6_address_t));
}
return 0;
}
@@ -745,8 +745,8 @@ map_pre_resolve_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
int is_del = 0;
- memset (&ip4nh, 0, sizeof (ip4nh));
- memset (&ip6nh, 0, sizeof (ip6nh));
+ clib_memset (&ip4nh, 0, sizeof (ip4nh));
+ clib_memset (&ip6nh, 0, sizeof (ip6nh));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -974,7 +974,7 @@ format_map_domain (u8 * s, va_list * args)
ip6_address_t ip6_prefix;
if (d->rules)
- memset (&ip6_prefix, 0, sizeof (ip6_prefix));
+ clib_memset (&ip6_prefix, 0, sizeof (ip6_prefix));
else
ip6_prefix = d->ip6_prefix;
@@ -1210,8 +1210,8 @@ show_map_stats_command_fn (vlib_main_t * vm, unformat_input_t * input,
int which, i;
vlib_counter_t v;
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
map_domain_counter_lock (mm);
vec_foreach (cm, mm->domain_counters)
diff --git a/src/plugins/map/map_api.c b/src/plugins/map/map_api.c
index 90dbd1bcfd6..4b21c378379 100644
--- a/src/plugins/map/map_api.c
+++ b/src/plugins/map/map_api.c
@@ -120,7 +120,7 @@ vl_api_map_domain_dump_t_handler (vl_api_map_domain_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach(d, mm->domains,
({
- /* Make sure every field is initiated (or don't skip the memset()) */
+ /* Make sure every field is initiated (or don't skip the clib_memset()) */
rmp = vl_msg_api_alloc (sizeof (*rmp));
rmp->_vl_msg_id = htons(VL_API_MAP_DOMAIN_DETAILS + mm->msg_id_base);
rmp->context = mp->context;
@@ -175,7 +175,7 @@ vl_api_map_rule_dump_t_handler (vl_api_map_rule_dump_t * mp)
continue;
}
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_MAP_RULE_DETAILS + mm->msg_id_base);
rmp->psid = htons (i);
clib_memcpy (rmp->ip6_dst, &dst, sizeof (rmp->ip6_dst));
@@ -211,8 +211,8 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp)
goto out;
}
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
map_domain_counter_lock (mm);
vec_foreach (cm, mm->domain_counters)
diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c
index ded2b49a3b9..b808f3c7bfb 100644
--- a/src/plugins/marvell/pp2/pp2.c
+++ b/src/plugins/marvell/pp2/pp2.c
@@ -213,7 +213,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
}
pool_get (ppm->interfaces, ppif);
- memset (ppif, 0, sizeof (*ppif));
+ clib_memset (ppif, 0, sizeof (*ppif));
ppif->dev_instance = ppif - ppm->interfaces;
ppif->hw_if_index = ~0;
vec_validate_aligned (ppif->inqs, n_inqs - 1, CLIB_CACHE_LINE_BYTES);
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index e8fb0e94a69..763572c2f0e 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -460,7 +460,7 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
clib_error_t *err;
sock = clib_mem_alloc (sizeof (clib_socket_t));
- memset (sock, 0, sizeof (clib_socket_t));
+ clib_memset (sock, 0, sizeof (clib_socket_t));
while (1)
{
@@ -511,7 +511,7 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
if (mif->flags & MEMIF_IF_FLAG_IS_SLAVE)
{
- memset (sock, 0, sizeof(clib_socket_t));
+ clib_memset (sock, 0, sizeof(clib_socket_t));
sock->config = (char *) msf->filename;
sock->flags = CLIB_SOCKET_F_IS_CLIENT| CLIB_SOCKET_F_SEQPACKET;
@@ -576,7 +576,7 @@ memif_add_socket_file (u32 sock_id, u8 * socket_filename)
}
pool_get (mm->socket_files, msf);
- memset (msf, 0, sizeof (memif_socket_file_t));
+ clib_memset (msf, 0, sizeof (memif_socket_file_t));
msf->filename = socket_filename;
msf->socket_id = sock_id;
@@ -756,7 +756,7 @@ memif_delete_if (vlib_main_t * vm, memif_if_t * mif)
}
}
- memset (mif, 0, sizeof (*mif));
+ clib_memset (mif, 0, sizeof (*mif));
pool_put (mm->interfaces, mif);
if (pool_elts (mm->interfaces) == 0)
@@ -875,7 +875,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
}
pool_get (mm->interfaces, mif);
- memset (mif, 0, sizeof (*mif));
+ clib_memset (mif, 0, sizeof (*mif));
mif->dev_instance = mif - mm->interfaces;
mif->socket_file_index = msf - mm->socket_files;
mif->id = args->id;
@@ -944,7 +944,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
ASSERT (msf->sock == 0);
msf->sock = s;
- memset (s, 0, sizeof (clib_socket_t));
+ clib_memset (s, 0, sizeof (clib_socket_t));
s->config = (char *) msf->filename;
s->flags = CLIB_SOCKET_F_IS_SERVER |
CLIB_SOCKET_F_ALLOW_GROUP_WRITE |
@@ -1019,7 +1019,7 @@ memif_init (vlib_main_t * vm)
{
memif_main_t *mm = &memif_main;
- memset (mm, 0, sizeof (memif_main_t));
+ clib_memset (mm, 0, sizeof (memif_main_t));
mm->log_class = vlib_log_register_class ("memif_plugin", 0);
memif_log_debug (0, "initialized");
diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c
index a4137e48006..77a87cc709d 100644
--- a/src/plugins/memif/memif_api.c
+++ b/src/plugins/memif/memif_api.c
@@ -274,7 +274,7 @@ send_memif_details (vl_api_registration_t * reg,
hwif = vnet_get_sup_hw_interface (vnm, swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_MEMIF_DETAILS + mm->msg_id_base);
mp->context = context;
@@ -347,7 +347,7 @@ send_memif_socket_filename_details (vl_api_registration_t * reg,
memif_main_t *mm = &memif_main;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_MEMIF_SOCKET_FILENAME_DETAILS
+ mm->msg_id_base);
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 53a355361a6..997ac8fcbad 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -750,7 +750,7 @@ refill:
goto done;
memif_desc_t *dt = &ptd->desc_template;
- memset (dt, 0, sizeof (memif_desc_t));
+ clib_memset (dt, 0, sizeof (memif_desc_t));
dt->length = buffer_length;
n_alloc = vlib_buffer_alloc_to_ring (vm, mq->buffers, head & mask,
diff --git a/src/plugins/memif/socket.c b/src/plugins/memif/socket.c
index ac48ba88da5..fac8cd4838e 100644
--- a/src/plugins/memif/socket.c
+++ b/src/plugins/memif/socket.c
@@ -356,7 +356,7 @@ memif_msg_receive_add_ring (memif_if_t * mif, memif_msg_t * msg, int fd)
}
// clear previous cache data if interface reconncected
- memset (mq, 0, sizeof (memif_queue_t));
+ clib_memset (mq, 0, sizeof (memif_queue_t));
mq->int_fd = fd;
mq->int_clib_file_index = ~0;
mq->log2_ring_size = ar->log2_ring_size;
@@ -656,7 +656,7 @@ memif_conn_fd_accept_ready (clib_file_t * uf)
clib_socket_t *client;
client = clib_mem_alloc (sizeof (clib_socket_t));
- memset (client, 0, sizeof (clib_socket_t));
+ clib_memset (client, 0, sizeof (clib_socket_t));
err = clib_socket_accept (msf->sock, client);
if (err)
goto error;
diff --git a/src/plugins/nat/dslite_in2out.c b/src/plugins/nat/dslite_in2out.c
index 4eec5958da9..e7a3028f28a 100644
--- a/src/plugins/nat/dslite_in2out.c
+++ b/src/plugins/nat/dslite_in2out.c
@@ -56,7 +56,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
(&dm->per_thread_data[thread_index].b4_hash, &b4_kv, &b4_value))
{
pool_get (dm->per_thread_data[thread_index].b4s, b4);
- memset (b4, 0, sizeof (*b4));
+ clib_memset (b4, 0, sizeof (*b4));
b4->addr.as_u64[0] = in2out_key->softwire_id.as_u64[0];
b4->addr.as_u64[1] = in2out_key->softwire_id.as_u64[1];
@@ -119,7 +119,7 @@ slow_path (dslite_main_t * dm, dslite_session_key_t * in2out_key,
return DSLITE_IN2OUT_NEXT_DROP;
}
pool_get (dm->per_thread_data[thread_index].sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
b4->nsessions++;
pool_get (dm->per_thread_data[thread_index].list_pool, elt);
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c
index 2ebd6834d92..8115a578e52 100755
--- a/src/plugins/nat/nat.c
+++ b/src/plugins/nat/nat.c
@@ -293,7 +293,7 @@ nat_user_get_or_create (snat_main_t * sm, ip4_address_t * addr, u32 fib_index,
{
/* no, make a new one */
pool_get (tsm->users, u);
- memset (u, 0, sizeof (*u));
+ clib_memset (u, 0, sizeof (*u));
u->addr.as_u32 = addr->as_u32;
u->fib_index = fib_index;
@@ -368,7 +368,7 @@ nat_session_alloc_or_recycle (snat_main_t * sm, snat_user_t * u,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -440,7 +440,7 @@ nat_ed_session_alloc (snat_main_t * sm, snat_user_t * u, u32 thread_index,
else
{
pool_get (tsm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
/* Create list elts */
pool_get (tsm->list_pool, per_user_translation_list_elt);
@@ -845,7 +845,7 @@ snat_add_static_mapping (ip4_address_t l_addr, ip4_address_t e_addr,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->local_addr = l_addr;
m->external_addr = e_addr;
@@ -1186,7 +1186,7 @@ nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
}
pool_get (sm->static_mappings, m);
- memset (m, 0, sizeof (*m));
+ clib_memset (m, 0, sizeof (*m));
m->tag = vec_dup (tag);
m->external_addr = e_addr;
m->external_port = e_port;
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c
index 0a3379acb32..0c5b80c394e 100644
--- a/src/plugins/nat/nat44_cli.c
+++ b/src/plugins/nat/nat44_cli.c
@@ -861,7 +861,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
if (unformat (line_input, "local %U:%u probability %u",
unformat_ip4_address, &l_addr, &l_port, &probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
@@ -871,7 +871,7 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm,
unformat_ip4_address, &l_addr, &l_port, &vrf_id,
&probability))
{
- memset (&local, 0, sizeof (local));
+ clib_memset (&local, 0, sizeof (local));
local.addr = l_addr;
local.port = (u16) l_port;
local.probability = (u8) probability;
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 8396bd1b76b..86c65edfbee 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -157,7 +157,7 @@ nat64_get_worker_out2in (ip4_header_t * ip)
ip46_address_t daddr;
nat64_db_bib_entry_t *bibe;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip->dst_address.as_u32;
/* *INDENT-OFF* */
@@ -687,7 +687,7 @@ nat64_add_del_static_bib_entry (ip6_address_t * in_addr,
foreach_snat_protocol
#undef _
default:
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = out_addr->as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, fib_index, 0))
return VNET_API_ERROR_INVALID_VALUE;
diff --git a/src/plugins/nat/nat64_db.c b/src/plugins/nat/nat64_db.c
index 9ff68c80282..bb327a57152 100644
--- a/src/plugins/nat/nat64_db.c
+++ b/src/plugins/nat/nat64_db.c
@@ -86,7 +86,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
db->bib.bib_entries_num++;
- memset (bibe, 0, sizeof (*bibe));
+ clib_memset (bibe, 0, sizeof (*bibe));
bibe->in_addr.as_u64[0] = in_addr->as_u64[0];
bibe->in_addr.as_u64[1] = in_addr->as_u64[1];
bibe->in_port = in_port;
@@ -108,7 +108,7 @@ nat64_db_bib_entry_create (nat64_db_t * db, ip6_address_t * in_addr,
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 1);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -179,7 +179,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
kv.key[2] = bibe_key.as_u64[2];
clib_bihash_add_del_24_8 (&db->bib.in2out, &kv, 0);
- memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
+ clib_memset (&bibe_key.addr, 0, sizeof (bibe_key.addr));
bibe_key.addr.ip4.as_u32 = bibe->out_addr.as_u32;
bibe_key.fib_index = 0;
bibe_key.port = bibe->out_port;
@@ -407,7 +407,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
db->st.st_entries_num++;
- memset (ste, 0, sizeof (*ste));
+ clib_memset (ste, 0, sizeof (*ste));
ste->in_r_addr.as_u64[0] = in_r_addr->as_u64[0];
ste->in_r_addr.as_u64[1] = in_r_addr->as_u64[1];
ste->out_r_addr.as_u32 = out_r_addr->as_u32;
@@ -419,7 +419,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
bibe->ses_num++;
/* create hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -436,7 +436,7 @@ nat64_db_st_entry_create (nat64_db_t * db, nat64_db_bib_entry_t * bibe,
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 1);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -491,7 +491,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
db->st.st_entries_num--;
/* delete hash lookup */
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = bibe->in_addr.as_u64[0];
ste_key.l_addr.as_u64[1] = bibe->in_addr.as_u64[1];
ste_key.r_addr.as_u64[0] = ste->in_r_addr.as_u64[0];
@@ -508,7 +508,7 @@ nat64_db_st_entry_free (nat64_db_t * db, nat64_db_st_entry_t * ste)
kv.key[5] = ste_key.as_u64[5];
clib_bihash_add_del_48_8 (&db->st.in2out, &kv, 0);
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.ip4.as_u32 = bibe->out_addr.as_u32;
ste_key.r_addr.ip4.as_u32 = ste->out_r_addr.as_u32;
ste_key.l_port = bibe->out_port;
@@ -565,7 +565,7 @@ nat64_db_st_entry_find (nat64_db_t * db, ip46_address_t * l_addr,
break;
}
- memset (&ste_key, 0, sizeof (ste_key));
+ clib_memset (&ste_key, 0, sizeof (ste_key));
ste_key.l_addr.as_u64[0] = l_addr->as_u64[0];
ste_key.l_addr.as_u64[1] = l_addr->as_u64[1];
ste_key.r_addr.as_u64[0] = r_addr->as_u64[0];
diff --git a/src/plugins/nat/nat64_in2out.c b/src/plugins/nat/nat64_in2out.c
index dc5cc005fd7..d19aab87983 100644
--- a/src/plugins/nat/nat64_in2out.c
+++ b/src/plugins/nat/nat64_in2out.c
@@ -445,9 +445,9 @@ unk_proto_st_walk (nat64_db_st_entry_t * ste, void *arg)
if (ip46_address_is_equal (&bibe->in_addr, &ctx->src_addr)
&& bibe->fib_index == ctx->fib_index)
{
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = bibe->out_addr.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
nat64_extract_ip4 (&ctx->dst_addr, &daddr.ip4, ctx->fib_index);
if (nat64_db_st_entry_find
@@ -518,7 +518,7 @@ nat64_in2out_unk_proto_set_cb (ip6_header_t * ip6, ip4_header_t * ip4,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -646,7 +646,7 @@ nat64_in2out_tcp_udp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
sport = udp->src_port = bibe->out_port;
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -746,8 +746,8 @@ nat64_in2out_icmp_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
dport = udp->dst_port = bibe->out_port;
nat64_compose_ip6 (&inner_ip6->dst_address, &bibe->out_addr, fib_index);
- memset (&saddr, 0, sizeof (saddr));
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
saddr.ip4.as_u32 = ste->out_r_addr.as_u32;
daddr.ip4.as_u32 = bibe->out_addr.as_u32;
@@ -859,7 +859,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_db_st_walk (db, IP_PROTOCOL_UDP, unk_proto_st_walk, &ctx);
/* Verify if out address is not already in use for protocol */
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.ip4.as_u32 = ctx.out_addr.as_u32;
if (nat64_db_bib_entry_find (db, &addr, 0, proto, 0, 0))
ctx.out_addr.as_u32 = 0;
@@ -896,7 +896,7 @@ nat64_in2out_unk_proto_hairpinning (vlib_main_t * vm, vlib_buffer_t * b,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
@@ -1279,7 +1279,7 @@ nat64_in2out_frag_hairpinning (vlib_buffer_t * b, ip6_header_t * ip6,
nat64_compose_ip6 (&ip6->src_address, &bibe->out_addr, bibe->fib_index);
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ste->out_r_addr.as_u32;
bibe = 0;
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index 89bb71c8960..79ff161b326 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -134,9 +134,9 @@ nat64_out2in_tcp_udp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -202,9 +202,9 @@ nat64_out2in_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (icmp->type == ICMP6_echo_request || icmp->type == ICMP6_echo_reply)
@@ -276,9 +276,9 @@ nat64_out2in_inner_icmp_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
fib_index =
fib_table_get_index_for_sw_if_index (FIB_PROTOCOL_IP6, sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
if (proto == IP_PROTOCOL_ICMP6)
@@ -368,9 +368,9 @@ nat64_out2in_unk_proto_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
sw_if_index = vnet_buffer (ctx->b)->sw_if_index[VLIB_RX];
fib_index = ip4_fib_table_get_index_for_sw_if_index (sw_if_index);
- memset (&saddr, 0, sizeof (saddr));
+ clib_memset (&saddr, 0, sizeof (saddr));
saddr.ip4.as_u32 = ip4->src_address.as_u32;
- memset (&daddr, 0, sizeof (daddr));
+ clib_memset (&daddr, 0, sizeof (daddr));
daddr.ip4.as_u32 = ip4->dst_address.as_u32;
ste =
@@ -738,9 +738,9 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
ctx0.first_frag = 1;
- memset (&saddr0, 0, sizeof (saddr0));
+ clib_memset (&saddr0, 0, sizeof (saddr0));
saddr0.ip4.as_u32 = ip40->src_address.as_u32;
- memset (&daddr0, 0, sizeof (daddr0));
+ clib_memset (&daddr0, 0, sizeof (daddr0));
daddr0.ip4.as_u32 = ip40->dst_address.as_u32;
ste0 =
diff --git a/src/plugins/nat/nat66.c b/src/plugins/nat/nat66.c
index 729674171d7..a0f6ec7929a 100644
--- a/src/plugins/nat/nat66.c
+++ b/src/plugins/nat/nat66.c
@@ -165,7 +165,7 @@ nat66_static_mapping_add_del (ip6_address_t * l_addr, ip6_address_t * e_addr,
fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, vrf_id,
FIB_SOURCE_PLUGIN_HI);
pool_get (nm->sm, sm);
- memset (sm, 0, sizeof (*sm));
+ clib_memset (sm, 0, sizeof (*sm));
sm->l_addr.as_u64[0] = l_addr->as_u64[0];
sm->l_addr.as_u64[1] = l_addr->as_u64[1];
sm->e_addr.as_u64[0] = e_addr->as_u64[0];
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c
index 4727826049b..378e7abe871 100644
--- a/src/plugins/nat/nat_api.c
+++ b/src/plugins/nat/nat_api.c
@@ -202,7 +202,7 @@ send_nat_worker_details (u32 worker_index, vl_api_registration_t * reg,
vlib_worker_threads + worker_index + sm->first_worker_index;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_WORKER_DETAILS + sm->msg_id_base);
rmp->context = context;
rmp->worker_index = htonl (worker_index);
@@ -350,7 +350,7 @@ nat_ip4_reass_walk_api (nat_reass_ip4_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 4);
@@ -373,7 +373,7 @@ nat_ip6_reass_walk_api (nat_reass_ip6_t * reass, void *arg)
nat_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_REASS_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->src_addr, &(reass->key.src), 16);
@@ -718,7 +718,7 @@ send_nat44_address_details (snat_address_t * a,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -807,7 +807,7 @@ send_nat44_interface_details (snat_interface_t * i,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -896,7 +896,7 @@ send_nat44_interface_output_feature_details (snat_interface_t * i,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
@@ -1024,7 +1024,7 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1059,7 +1059,7 @@ send_nat44_static_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_STATIC_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1198,7 +1198,7 @@ send_nat44_identity_mapping_details (snat_static_mapping_t * m, int index,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = is_addr_only_static_mapping (m);
@@ -1223,7 +1223,7 @@ send_nat44_identity_map_resolve_details (snat_static_map_resolve_t * m,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_IDENTITY_MAPPING_DETAILS + sm->msg_id_base);
rmp->addr_only = m->addr_only;
@@ -1331,7 +1331,7 @@ send_nat44_interface_addr_details (u32 sw_if_index,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_INTERFACE_ADDR_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (sw_if_index);
@@ -1384,7 +1384,7 @@ send_nat44_user_details (snat_user_t * u, vl_api_registration_t * reg,
ip4_main_t *im = &ip4_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT44_USER_DETAILS + sm->msg_id_base);
if (!pool_is_free_index (im->fibs, u->fib_index))
@@ -1445,7 +1445,7 @@ send_nat44_user_session_details (snat_session_t * s,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_USER_SESSION_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->outside_ip_address, (&s->out2in.addr), 4);
@@ -1564,7 +1564,7 @@ unformat_nat44_lb_addr_port (vl_api_nat44_lb_addr_port_t * addr_port_pairs,
for (i = 0; i < addr_port_pair_num; i++)
{
ap = &addr_port_pairs[i];
- memset (&lb_addr_port, 0, sizeof (lb_addr_port));
+ clib_memset (&lb_addr_port, 0, sizeof (lb_addr_port));
clib_memcpy (&lb_addr_port.addr, ap->addr, 4);
lb_addr_port.port = clib_net_to_host_u16 (ap->port);
lb_addr_port.probability = ap->probability;
@@ -1644,7 +1644,7 @@ send_nat44_lb_static_mapping_details (snat_static_mapping_t * m,
rmp =
vl_msg_api_alloc (sizeof (*rmp) +
(vec_len (m->locals) * sizeof (nat44_lb_addr_port_t)));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_LB_STATIC_MAPPING_DETAILS + sm->msg_id_base);
@@ -1825,7 +1825,7 @@ static void
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT44_FORWARDING_IS_ENABLED_REPLY + sm->msg_id_base);
rmp->context = mp->context;
@@ -1982,7 +1982,7 @@ send_reply:
REPLY_MACRO2 (VL_API_NAT_DET_REVERSE_REPLY,
({
rmp->is_nat44 = 1;
- memset (rmp->in_addr, 0, 16);
+ clib_memset (rmp->in_addr, 0, 16);
clib_memcpy (rmp->in_addr, &in_addr, 4);
}))
/* *INDENT-ON* */
@@ -2008,7 +2008,7 @@ sent_nat_det_map_details (snat_det_map_t * m, vl_api_registration_t * reg,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_MAP_DETAILS + sm->msg_id_base);
rmp->is_nat44 = 1;
clib_memcpy (rmp->in_addr, &m->in_addr, 4);
@@ -2179,7 +2179,7 @@ send_nat_det_session_details (snat_det_session_t * s,
snat_main_t *sm = &snat_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT_DET_SESSION_DETAILS + sm->msg_id_base);
rmp->in_port = s->in_port;
clib_memcpy (rmp->ext_addr, &s->out.ext_host_addr, 4);
@@ -2211,7 +2211,7 @@ vl_api_nat_det_session_dump_t_handler (vl_api_nat_det_session_dump_t * mp)
if (!mp->is_nat44)
return;
- memset (&empty_ses, 0, sizeof (empty_ses));
+ clib_memset (&empty_ses, 0, sizeof (empty_ses));
clib_memcpy (&user_addr, mp->user_addr, 4);
dm = snat_det_map_by_user (sm, &user_addr);
if (!dm)
@@ -2307,7 +2307,7 @@ nat64_api_pool_walk (snat_address_t * a, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_POOL_ADDR_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->address, &(a->addr), 4);
if (a->fib_index != ~0)
@@ -2395,7 +2395,7 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = (nat_interface_is_inside (i)
@@ -2489,7 +2489,7 @@ nat64_api_bib_walk (nat64_db_bib_entry_t * bibe, void *arg)
return -1;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_BIB_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->i_addr, &(bibe->in_addr), 16);
@@ -2556,7 +2556,7 @@ nat64_api_st_walk (nat64_db_st_entry_t * ste, void *arg)
return -1;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_ST_DETAILS + sm->msg_id_base);
rmp->context = ctx->context;
clib_memcpy (rmp->il_addr, &(bibe->in_addr), 16);
@@ -2646,7 +2646,7 @@ nat64_api_prefix_walk (nat64_prefix_t * p, void *arg)
nat64_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT64_PREFIX_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->prefix, &(p->prefix), 16);
rmp->prefix_len = p->plen;
@@ -2887,7 +2887,7 @@ send_dslite_address_details (snat_address_t * ap,
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_DSLITE_ADDRESS_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->ip_address, &(ap->addr), 4);
@@ -3025,7 +3025,7 @@ nat66_api_interface_walk (snat_interface_t * i, void *arg)
nat66_api_walk_ctx_t *ctx = arg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_NAT66_INTERFACE_DETAILS + sm->msg_id_base);
rmp->sw_if_index = ntohl (i->sw_if_index);
rmp->is_inside = nat_interface_is_inside (i);
@@ -3081,7 +3081,7 @@ nat66_api_static_mapping_walk (nat66_static_mapping_t * m, void *arg)
vlib_get_combined_counter (&nm->session_counters, m - nm->sm, &vc);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
ntohs (VL_API_NAT66_STATIC_MAPPING_DETAILS + sm->msg_id_base);
clib_memcpy (rmp->local_ip_address, &m->l_addr, 16);
diff --git a/src/plugins/nat/nat_det.c b/src/plugins/nat/nat_det.c
index 1b00d40b4ae..0ab96dc1026 100644
--- a/src/plugins/nat/nat_det.c
+++ b/src/plugins/nat/nat_det.c
@@ -72,7 +72,7 @@ snat_det_add_map (snat_main_t * sm, ip4_address_t * in_addr, u8 in_plen,
if (is_add)
{
pool_get (sm->det_maps, det_map);
- memset (det_map, 0, sizeof (*det_map));
+ clib_memset (det_map, 0, sizeof (*det_map));
det_map->in_addr.as_u32 = in_cmp.as_u32;
det_map->in_plen = in_plen;
det_map->out_addr.as_u32 = out_cmp.as_u32;
diff --git a/src/plugins/nat/nat_ipfix_logging.c b/src/plugins/nat/nat_ipfix_logging.c
index b2c167096aa..8a3668e2759 100644
--- a/src/plugins/nat/nat_ipfix_logging.c
+++ b/src/plugins/nat/nat_ipfix_logging.c
@@ -1929,7 +1929,7 @@ snat_ipfix_logging_enable_disable (int enable, u32 domain_id, u16 src_port)
silm->enabled = e;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = enable;
a.domain_id = domain_id ? domain_id : 1;
a.src_port = src_port ? src_port : UDP_DST_PORT_ipfix;
diff --git a/src/plugins/nat/nat_test.c b/src/plugins/nat/nat_test.c
index 0a2896b9848..b1de5340b9d 100644
--- a/src/plugins/nat/nat_test.c
+++ b/src/plugins/nat/nat_test.c
@@ -707,7 +707,7 @@ static int api_nat44_user_session_dump(vat_main_t * vam)
/* Use a control ping for synchronization */
M(NAT_CONTROL_PING, mp_ping);
- memset(mp->ip_address, 0, 16);
+ clib_memset(mp->ip_address, 0, 16);
clib_memcpy(mp->ip_address, &addr, 4);
mp->vrf_id = htonl(vrf_id);
S(mp_ping);
diff --git a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
index 9ea5447eba8..f409aa6f2d0 100644
--- a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
+++ b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
@@ -128,7 +128,7 @@ nsh_md2_ioam_encap_transit (vlib_main_t * vm,
uword *t = NULL;
nsh_md2_ioam_main_t *hm = &nsh_md2_ioam_main;
fib_prefix_t key4;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = ip0->dst_address.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
index 1fa1c55b00f..73b57f64e90 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam.c
@@ -100,12 +100,12 @@ nsh_md2_ioam_enable_disable_for_dest (vlib_main_t * vm,
if (is_ipv4)
{
- memset (&fib_prefix, 0, sizeof (fib_prefix_t));
+ clib_memset (&fib_prefix, 0, sizeof (fib_prefix_t));
fib_prefix.fp_len = 32;
fib_prefix.fp_proto = FIB_PROTOCOL_IP4;
#define TRANSIT_UNIT_TEST_HACK 1
#ifdef TRANSIT_UNIT_TEST_HACK
- memset(&dst_addr, 0, sizeof(dst_addr));
+ clib_memset(&dst_addr, 0, sizeof(dst_addr));
dst_addr.ip4.as_u32 = clib_net_to_host_u32(0x14020102);
#endif
fib_prefix.fp_addr = dst_addr;
@@ -226,7 +226,7 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
nsh_md2_ioam_dest_tunnels_t *t1;
fib_prefix_t key4, *key4_copy;
hash_pair_t *hp;
- memset (&key4, 0, sizeof (key4));
+ clib_memset (&key4, 0, sizeof (key4));
key4.fp_proto = FIB_PROTOCOL_IP4;
key4.fp_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
t = hash_get_mem (hm->dst_by_ip4, &key4);
@@ -237,11 +237,11 @@ u32 fib_path_get_resolving_interface (fib_node_index_t path_index);
return 0;
}
pool_get_aligned (hm->dst_tunnels, t1, CLIB_CACHE_LINE_BYTES);
- memset (t1, 0, sizeof (*t1));
+ clib_memset (t1, 0, sizeof (*t1));
t1->fp_proto = FIB_PROTOCOL_IP4;
t1->dst_addr.ip4.as_u32 = fib_prefix.fp_addr.ip4.as_u32;
key4_copy = clib_mem_alloc (sizeof (*key4_copy));
- memset(key4_copy, 0, sizeof(*key4_copy));
+ clib_memset(key4_copy, 0, sizeof(*key4_copy));
clib_memcpy (key4_copy, &key4, sizeof (*key4_copy));
hash_set_mem (hm->dst_by_ip4, key4_copy, t1 - hm->dst_tunnels);
/*
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
index 1baa2365b15..495bb16aab2 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_trace.c
@@ -366,7 +366,7 @@ nsh_md2_ioam_trace_init (vlib_main_t * vm)
gm->unix_time_0 = (u32) time (0); /* Store starting time */
gm->vlib_time_0 = vlib_time_now (vm);
- memset (hm->counters, 0, sizeof (hm->counters));
+ clib_memset (hm->counters, 0, sizeof (hm->counters));
if (nsh_md2_register_option
(clib_host_to_net_u16 (0x9),
diff --git a/src/plugins/nsh/nsh.c b/src/plugins/nsh/nsh.c
index ced898c04df..d9b625cda04 100644
--- a/src/plugins/nsh/nsh.c
+++ b/src/plugins/nsh/nsh.c
@@ -154,7 +154,7 @@ nsh_md2_register_option (u16 class,
pool_get_aligned (nm->nsh_option_mappings, nsh_option,
CLIB_CACHE_LINE_BYTES);
- memset (nsh_option, 0, sizeof (*nsh_option));
+ clib_memset (nsh_option, 0, sizeof (*nsh_option));
nsh_option->option_id = nsh_option - nm->nsh_option_mappings;
key_copy = clib_mem_alloc (sizeof (*key_copy));
@@ -527,7 +527,7 @@ nsh_add_del_map (nsh_add_del_map_args_t * a, u32 * map_indexp)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_mappings, map, CLIB_CACHE_LINE_BYTES);
- memset (map, 0, sizeof (*map));
+ clib_memset (map, 0, sizeof (*map));
/* copy from arg structure */
map->nsp_nsi = a->map.nsp_nsi;
@@ -614,7 +614,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
hash_pair_t *hp;
u32 nsp = 0, nsi = 0;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.transport_type = a->map.next_node;
key.transport_index = a->map.sw_if_index;
@@ -627,7 +627,7 @@ nsh_add_del_proxy_session (nsh_add_del_map_args_t * a)
return -1; //TODO API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_proxy_sessions, proxy, CLIB_CACHE_LINE_BYTES);
- memset (proxy, 0, sizeof (*proxy));
+ clib_memset (proxy, 0, sizeof (*proxy));
/* Nsi needs to minus 1 within NSH-Proxy */
nsp = (a->map.nsp_nsi >> NSH_NSP_SHIFT) & NSH_NSP_MASK;
@@ -783,7 +783,7 @@ nsh_add_del_map_command_fn (vlib_main_t * vm,
return clib_error_return (0,
"must specific action: [encap-gre-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-lisp-gpe-intf <nn> | encap-none <tx_sw_if_index> <rx_sw_if_index>]");
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* set args structure */
a->is_add = is_add;
@@ -933,7 +933,7 @@ nsh_header_rewrite (nsh_entry_t * nsh_entry)
len = MAX_NSH_HEADER_LEN;
}
vec_validate_aligned (rw, len - 1, CLIB_CACHE_LINE_BYTES);
- memset (rw, 0, len);
+ clib_memset (rw, 0, len);
nsh_base = (nsh_base_header_t *) rw;
nsh_base->ver_o_c = nsh_entry->nsh_base.ver_o_c;
@@ -1033,7 +1033,7 @@ nsh_add_del_entry (nsh_add_del_entry_args_t * a, u32 * entry_indexp)
return -1; // TODO VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (nm->nsh_entries, nsh_entry, CLIB_CACHE_LINE_BYTES);
- memset (nsh_entry, 0, sizeof (*nsh_entry));
+ clib_memset (nsh_entry, 0, sizeof (*nsh_entry));
/* copy from arg structure */
#define _(x) nsh_entry->nsh_base.x = a->nsh_entry.nsh_base.x;
@@ -1185,7 +1185,7 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm,
nsp_nsi = (nsp << 8) | nsi;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
if (md_type == 1)
@@ -1318,7 +1318,7 @@ static void send_nsh_entry_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_ENTRY_DETAILS) + nm->msg_id_base);
rmp->ver_o_c = t->nsh_base.ver_o_c;
@@ -1391,7 +1391,7 @@ static void send_nsh_map_details
nsh_main_t *nm = &nsh_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs ((VL_API_NSH_MAP_DETAILS) + nm->msg_id_base);
rmp->nsp_nsi = htonl (t->nsp_nsi);
@@ -1784,7 +1784,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
@@ -1949,7 +1949,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key1, 0, sizeof (key1));
+ clib_memset (&key1, 0, sizeof (key1));
key1.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key1.transport_index = vnet_buffer (b1)->sw_if_index[VLIB_RX];
@@ -2151,7 +2151,7 @@ nsh_input_map (vlib_main_t * vm,
}
else
{
- memset (&key0, 0, sizeof (key0));
+ clib_memset (&key0, 0, sizeof (key0));
key0.transport_type = NSH_NODE_NEXT_ENCAP_VXLAN4;
key0.transport_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
diff --git a/src/plugins/nsh/nsh_test.c b/src/plugins/nsh/nsh_test.c
index 3867289f737..0852956dc3e 100644
--- a/src/plugins/nsh/nsh_test.c
+++ b/src/plugins/nsh/nsh_test.c
@@ -102,7 +102,7 @@ _(NSH_MAP_DETAILS, nsh_map_details)
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
@@ -111,7 +111,7 @@ do { \
do { \
vam->result_ready = 0; \
mp = vl_msg_api_alloc(sizeof(*mp)+(n)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T + sm->msg_id_base); \
mp->client_index = vam->my_client_index; \
} while(0);
diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c
index d73a71857c6..0595767f62f 100644
--- a/src/plugins/pppoe/pppoe.c
+++ b/src/plugins/pppoe/pppoe.c
@@ -273,7 +273,7 @@ int vnet_pppoe_add_del_session
cached_key.raw = ~0;
cached_result.raw = ~0; /* warning be gone */
- memset (&pfx, 0, sizeof (pfx));
+ clib_memset (&pfx, 0, sizeof (pfx));
if (!is_ip6)
{
@@ -320,7 +320,7 @@ int vnet_pppoe_add_del_session
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (pem->sessions, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
clib_memcpy (t->local_mac, hi->hw_address, 6);
@@ -455,7 +455,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&client_ip, 0, sizeof client_ip);
+ clib_memset (&client_ip, 0, sizeof client_ip);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -527,7 +527,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c
index 4c65ec4ebd6..638505c40c0 100644
--- a/src/plugins/pppoe/pppoe_api.c
+++ b/src/plugins/pppoe/pppoe_api.c
@@ -126,7 +126,7 @@ static void send_pppoe_session_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->client_ip);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_PPPOE_SESSION_DETAILS);
if (is_ipv6)
{
diff --git a/src/plugins/pppoe/pppoe_test.c b/src/plugins/pppoe/pppoe_test.c
index a32f1b76fe0..0d085ed3d97 100644
--- a/src/plugins/pppoe/pppoe_test.c
+++ b/src/plugins/pppoe/pppoe_test.c
@@ -143,7 +143,7 @@ api_pppoe_add_del_session (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&client_ip, 0, sizeof client_ip);
+ clib_memset (&client_ip, 0, sizeof client_ip);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/plugins/srv6-ad/ad.c b/src/plugins/srv6-ad/ad.c
index 64bf66d8482..bc55bc1abe4 100644
--- a/src/plugins/srv6-ad/ad.c
+++ b/src/plugins/srv6-ad/ad.c
@@ -354,7 +354,7 @@ unformat_srv6_ad_localsid (unformat_input_t * input, va_list * args)
/* Allocate and initialize memory block for local SID parameters */
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
/* Set local SID parameters */
diff --git a/src/plugins/srv6-am/am.c b/src/plugins/srv6-am/am.c
index 877b1b3c116..ce8b4d9b2ce 100644
--- a/src/plugins/srv6-am/am.c
+++ b/src/plugins/srv6-am/am.c
@@ -141,7 +141,7 @@ unformat_srv6_am_localsid (unformat_input_t * input, va_list * args)
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
/* Set to zero the memory */
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
/* Our brand-new car is ready */
clib_memcpy (&ls_mem->nh_addr.ip6, &nh_addr.ip6,
diff --git a/src/plugins/srv6-as/as.c b/src/plugins/srv6-as/as.c
index e771cb485ef..ea13fc8834e 100644
--- a/src/plugins/srv6-as/as.c
+++ b/src/plugins/srv6-as/as.c
@@ -462,7 +462,7 @@ unformat_srv6_as_localsid (unformat_input_t * input, va_list * args)
/* Allocate and initialize memory block for local SID parameters */
ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
- memset (ls_mem, 0, sizeof *ls_mem);
+ clib_memset (ls_mem, 0, sizeof *ls_mem);
*plugin_mem_p = ls_mem;
/* Set local SID parameters */
diff --git a/src/plugins/stn/stn_api.c b/src/plugins/stn/stn_api.c
index 8f9e2ea41ee..40d4103b1ec 100644
--- a/src/plugins/stn/stn_api.c
+++ b/src/plugins/stn/stn_api.c
@@ -107,7 +107,7 @@ send_stn_rules_details (stn_rule_t * r, vl_api_registration_t * reg,
vl_api_stn_rules_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id =
clib_host_to_net_u16 (VL_API_STN_RULES_DETAILS + stn_main.msg_id_base);
diff --git a/src/plugins/svs/svs_api.c b/src/plugins/svs/svs_api.c
index b6c8117064d..03941fea08e 100644
--- a/src/plugins/svs/svs_api.c
+++ b/src/plugins/svs/svs_api.c
@@ -80,7 +80,7 @@ vl_api_svs_plugin_get_version_t_handler (vl_api_svs_plugin_get_version_t * mp)
}
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id =
ntohs (VL_API_SVS_PLUGIN_GET_VERSION_REPLY + svs_base_msg_id);
rmp->context = mp->context;
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index 1010e370880..52d124eb84e 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -55,7 +55,7 @@ mbedtls_calloc_fn (size_t n, size_t size)
{
void *ptr;
ptr = clib_mem_alloc (n * size);
- memset (ptr, 0, sizeof (*ptr));
+ clib_memset (ptr, 0, sizeof (*ptr));
return ptr;
}
@@ -78,7 +78,7 @@ mbedtls_ctx_alloc (void)
if (!(*ctx))
*ctx = clib_mem_alloc (sizeof (mbedtls_ctx_t));
- memset (*ctx, 0, sizeof (mbedtls_ctx_t));
+ clib_memset (*ctx, 0, sizeof (mbedtls_ctx_t));
(*ctx)->ctx.c_thread_index = thread_index;
(*ctx)->ctx.tls_ctx_engine = TLS_ENGINE_MBEDTLS;
(*ctx)->mbedtls_ctx_index = ctx - tm->ctx_pool[thread_index];
diff --git a/src/plugins/tlsopenssl/tls_async.c b/src/plugins/tlsopenssl/tls_async.c
index a05996b39b1..8931ef5374f 100644
--- a/src/plugins/tlsopenssl/tls_async.c
+++ b/src/plugins/tlsopenssl/tls_async.c
@@ -240,7 +240,7 @@ openssl_evt_alloc (void)
if (!(*evt))
*evt = clib_mem_alloc (sizeof (openssl_evt_t));
- memset (*evt, 0, sizeof (openssl_evt_t));
+ clib_memset (*evt, 0, sizeof (openssl_evt_t));
(*evt)->event_index = evt - tm->evt_pool[thread_index];
return ((*evt)->event_index);
}
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index b8757a9ffb7..7994cc5d981 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -40,7 +40,7 @@ openssl_ctx_alloc (void)
if (!(*ctx))
*ctx = clib_mem_alloc (sizeof (openssl_ctx_t));
- memset (*ctx, 0, sizeof (openssl_ctx_t));
+ clib_memset (*ctx, 0, sizeof (openssl_ctx_t));
(*ctx)->ctx.c_thread_index = thread_index;
(*ctx)->ctx.tls_ctx_engine = TLS_ENGINE_OPENSSL;
(*ctx)->ctx.app_session_handle = SESSION_INVALID_HANDLE;
@@ -87,7 +87,7 @@ openssl_listen_ctx_alloc (void)
pool_get (om->lctx_pool, lctx);
- memset (lctx, 0, sizeof (openssl_listen_ctx_t));
+ clib_memset (lctx, 0, sizeof (openssl_listen_ctx_t));
lctx->openssl_lctx_index = lctx - om->lctx_pool;
return lctx->openssl_lctx_index;
}
diff --git a/src/plugins/unittest/CMakeLists.txt b/src/plugins/unittest/CMakeLists.txt
index f790a23a60e..2dfa8379c52 100644
--- a/src/plugins/unittest/CMakeLists.txt
+++ b/src/plugins/unittest/CMakeLists.txt
@@ -16,4 +16,5 @@ add_vpp_plugin(unittest
unittest.c
tcp_test.c
bihash_test.c
+ string_test.c
)
diff --git a/src/plugins/unittest/string_test.c b/src/plugins/unittest/string_test.c
new file mode 100644
index 00000000000..a5caa9094f0
--- /dev/null
+++ b/src/plugins/unittest/string_test.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <vlib/vlib.h>
+#include <vppinfra/string.h>
+
+static int
+test_clib_memset (vlib_main_t * vm, unformat_input_t * input)
+{
+ u8 dst[64];
+ int i;
+ errno_t err;
+
+ vlib_cli_output (vm, "Test memset_s...");
+
+ err = memset_s (dst, ARRAY_LEN (dst), 0xfe, ARRAY_LEN (dst));
+
+ if (err != EOK)
+ return -1;
+
+ for (i = 0; i < ARRAY_LEN (dst); i++)
+ if (dst[i] != 0xFE)
+ return -1;
+
+ err = memset_s (dst, ARRAY_LEN (dst), 0xfa, ARRAY_LEN (dst) + 1);
+
+ if (err == EOK)
+ return -1;
+
+ return 0;
+}
+
+static int
+test_memcpy (vlib_main_t * vm, unformat_input_t * input)
+{
+ char src[64], dst[64];
+ int i;
+ errno_t err;
+
+ vlib_cli_output (vm, "Test memcpy_s...");
+
+ for (i = 0; i < ARRAY_LEN (src); i++)
+ src[i] = i + 1;
+
+ /* Typical case */
+ err = memcpy_s (dst, sizeof (dst), src, sizeof (src));
+
+ if (err != EOK)
+ return -1;
+
+ /* This better not fail but check anyhow */
+ for (i = 0; i < ARRAY_LEN (dst); i++)
+ if (src[i] != dst[i])
+ return -1;
+
+ /* Size fail */
+ err = memcpy_s (dst + 1, sizeof (dst) - 1, src, sizeof (src));
+
+ if (err == EOK)
+ return -1;
+
+ /* overlap fail */
+ err = memcpy_s (dst, sizeof (dst), dst + 1, sizeof (dst) - 1);
+
+ if (err == EOK)
+ return -1;
+
+ /* Zero length copy */
+ err = memcpy_s (0, sizeof (dst), src, 0);
+
+ if (err != EOK)
+ return -1;
+
+ /* OK, seems to work */
+ return 0;
+}
+
+static clib_error_t *
+string_test_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd_arg)
+{
+ int res = 0;
+ u8 t_memcpy = 0;
+ u8 t_clib_memset = 0;
+ u8 specific_test;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "memcpy_s"))
+ t_memcpy = 1;
+ else if (unformat (input, "memset_s"))
+ t_clib_memset = 1;
+ break;
+ }
+
+ specific_test = t_memcpy + t_clib_memset;
+
+ if (specific_test == 0)
+ {
+ res = test_memcpy (vm, input);
+ res += test_clib_memset (vm, input);
+ goto done;
+ }
+
+ if (t_memcpy)
+ res = test_memcpy (vm, input);
+ else if (t_clib_memset)
+ res = test_clib_memset (vm, input);
+
+done:
+ if (res)
+ vlib_cli_output (vm, "String unit test(s) failed...");
+ else
+ vlib_cli_output (vm, "String unit test(s) OK...");
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (string_test_command, static) =
+{
+ .path = "test string",
+ .short_help = "string library tests",
+ .function = string_test_command_fn,
+};
+/* *INDENT-ON* */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c
index d06578771c0..3bde8054901 100644
--- a/src/plugins/unittest/tcp_test.c
+++ b/src/plugins/unittest/tcp_test.c
@@ -83,7 +83,7 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input)
return tcp_test_scoreboard_replay (vm, input);
}
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->snd_una = 0;
tc->snd_una_max = 1000;
@@ -458,7 +458,7 @@ tcp_test_sack_tx (vlib_main_t * vm, unformat_input_t * input)
}
}
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
/*
* Add odd sack block pairs
@@ -740,7 +740,7 @@ fifo_prepare (u32 fifo_size)
f = svm_fifo_create (fifo_size);
/* Paint fifo data vector with -1's */
- memset (f->data, 0xFF, fifo_size);
+ clib_memset (f->data, 0xFF, fifo_size);
return f;
}
@@ -1647,11 +1647,11 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
* Allocate fake session and connection 1
*/
pool_get (smm->sessions[0], s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->session_index = sidx = s - smm->sessions[0];
pool_get (tm->connections[0], tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->connection.c_index = tc - tm->connections[0];
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
@@ -1668,11 +1668,11 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
* Allocate fake session and connection 2
*/
pool_get (session_manager_main.sessions[0], s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->session_index = s - smm->sessions[0];
pool_get (tm->connections[0], tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->connection.c_index = tc - tm->connections[0];
tc->connection.s_index = s->session_index;
s->connection_index = tc->connection.c_index;
@@ -1769,7 +1769,7 @@ tcp_test_session (vlib_main_t * vm, unformat_input_t * input)
remote_port = clib_host_to_net_u16 (11234);
pool_get (tm->connections[0], tc0);
- memset (tc0, 0, sizeof (*tc0));
+ clib_memset (tc0, 0, sizeof (*tc0));
tc0->state = TCP_STATE_ESTABLISHED;
tc0->rcv_las = 1;
diff --git a/src/plugins/vmxnet3/cli.c b/src/plugins/vmxnet3/cli.c
index 170f9ad7f5b..1a97dc0d0fa 100644
--- a/src/plugins/vmxnet3/cli.c
+++ b/src/plugins/vmxnet3/cli.c
@@ -38,7 +38,7 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "%U", unformat_vlib_pci_addr, &args.addr))
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index 375224142f9..e34b3e69a27 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -153,7 +153,7 @@ vmxnet3_provision_driver_shared (vlib_main_t * vm, vmxnet3_device_t * vd)
if (error)
return error;
- memset (vd->dma, 0, sizeof (*vd->dma));
+ clib_memset (vd->dma, 0, sizeof (*vd->dma));
q = &vd->dma->queues;
q->tx.cfg.desc_address = vmxnet3_dma_addr (vm, vd, txq->tx_desc);
@@ -229,7 +229,7 @@ vmxnet3_rxq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
vec_validate_aligned (vd->rxqs, qid, CLIB_CACHE_LINE_BYTES);
rxq = vec_elt_at_index (vd->rxqs, qid);
- memset (rxq, 0, sizeof (*rxq));
+ clib_memset (rxq, 0, sizeof (*rxq));
rxq->size = qsz;
for (rid = 0; rid < VMXNET3_RX_RING_SIZE; rid++)
{
@@ -239,14 +239,14 @@ vmxnet3_rxq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
512);
if (error)
return error;
- memset (rxq->rx_desc[rid], 0, qsz * sizeof (*rxq->rx_desc[rid]));
+ clib_memset (rxq->rx_desc[rid], 0, qsz * sizeof (*rxq->rx_desc[rid]));
}
rxq->rx_comp = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*rxq->rx_comp),
512);
if (error)
return error;
- memset (rxq->rx_comp, 0, qsz * sizeof (*rxq->rx_comp));
+ clib_memset (rxq->rx_comp, 0, qsz * sizeof (*rxq->rx_comp));
for (rid = 0; rid < VMXNET3_RX_RING_SIZE; rid++)
{
vmxnet3_rx_ring *ring;
@@ -280,20 +280,20 @@ vmxnet3_txq_init (vlib_main_t * vm, vmxnet3_device_t * vd, u16 qid, u16 qsz)
vec_validate_aligned (vd->txqs, qid, CLIB_CACHE_LINE_BYTES);
txq = vec_elt_at_index (vd->txqs, qid);
- memset (txq, 0, sizeof (*txq));
+ clib_memset (txq, 0, sizeof (*txq));
txq->size = qsz;
txq->tx_desc = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*txq->tx_desc),
512);
if (error)
return error;
- memset (txq->tx_desc, 0, qsz * sizeof (*txq->tx_desc));
+ clib_memset (txq->tx_desc, 0, qsz * sizeof (*txq->tx_desc));
txq->tx_comp = vlib_physmem_alloc_aligned (vm, vmxm->physmem_region, &error,
qsz * sizeof (*txq->tx_comp),
512);
if (error)
return error;
- memset (txq->tx_comp, 0, qsz * sizeof (*txq->tx_comp));
+ clib_memset (txq->tx_comp, 0, qsz * sizeof (*txq->tx_comp));
vec_validate_aligned (txq->tx_ring.bufs, txq->size, CLIB_CACHE_LINE_BYTES);
txq->tx_ring.gen = VMXNET3_TXF_GEN;
txq->tx_comp_ring.gen = VMXNET3_TXCF_GEN;
@@ -663,7 +663,7 @@ vmxnet3_delete_if (vlib_main_t * vm, vmxnet3_device_t * vd)
vlib_physmem_free (vm, vmxm->physmem_region, vd->dma);
clib_error_free (vd->error);
- memset (vd, 0, sizeof (*vd));
+ clib_memset (vd, 0, sizeof (*vd));
pool_put (vmxm->devices, vd);
}
diff --git a/src/plugins/vmxnet3/vmxnet3_api.c b/src/plugins/vmxnet3/vmxnet3_api.c
index e0c2cfa6cf0..b41866be117 100644
--- a/src/plugins/vmxnet3/vmxnet3_api.c
+++ b/src/plugins/vmxnet3/vmxnet3_api.c
@@ -65,7 +65,7 @@ vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp)
vmxnet3_create_if_args_t args;
int rv;
- memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
+ clib_memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
args.enable_elog = ntohl (mp->enable_elog);
args.addr.as_u32 = ntohl (mp->pci_addr);
@@ -125,7 +125,7 @@ send_vmxnet3_details (vl_api_registration_t * reg, vmxnet3_device_t * vd,
hwif = vnet_get_sup_hw_interface (vnm, swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_VMXNET3_DETAILS + vmxm->msg_id_base);
mp->context = context;
diff --git a/src/plugins/vmxnet3/vmxnet3_test.c b/src/plugins/vmxnet3/vmxnet3_test.c
index 1b5fd5b7c9a..53097f02d63 100644
--- a/src/plugins/vmxnet3/vmxnet3_test.c
+++ b/src/plugins/vmxnet3/vmxnet3_test.c
@@ -104,7 +104,7 @@ api_vmxnet3_create (vat_main_t * vam)
int ret;
u32 x[4];
- memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
+ clib_memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/svm/queue.c b/src/svm/queue.c
index 6a578fb4d6b..6972f14cd33 100644
--- a/src/svm/queue.c
+++ b/src/svm/queue.c
@@ -37,15 +37,15 @@ svm_queue_init (void *base, int nels, int elsize)
pthread_condattr_t cattr;
q = (svm_queue_t *) base;
- memset (q, 0, sizeof (*q));
+ clib_memset (q, 0, sizeof (*q));
q->elsize = elsize;
q->maxsize = nels;
q->producer_evtfd = -1;
q->consumer_evtfd = -1;
- memset (&attr, 0, sizeof (attr));
- memset (&cattr, 0, sizeof (cattr));
+ clib_memset (&attr, 0, sizeof (attr));
+ clib_memset (&cattr, 0, sizeof (cattr));
if (pthread_mutexattr_init (&attr))
clib_unix_warning ("mutexattr_init");
@@ -75,7 +75,7 @@ svm_queue_alloc_and_init (int nels, int elsize, int consumer_pid)
q = clib_mem_alloc_aligned (sizeof (svm_queue_t)
+ nels * elsize, CLIB_CACHE_LINE_BYTES);
- memset (q, 0, sizeof (*q));
+ clib_memset (q, 0, sizeof (*q));
q = svm_queue_init (q, nels, elsize);
q->consumer_pid = consumer_pid;
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index 7fa9b258729..2d9d1b3159f 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -381,7 +381,7 @@ ssvm_master_init_private (ssvm_private_t * ssvm)
sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
ssvm->sh = sh;
- memset (sh, 0, sizeof (*sh));
+ clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
sh->type = SSVM_SEGMENT_PRIVATE;
diff --git a/src/svm/svm.c b/src/svm/svm.c
index 681ac4a8926..4aefd20da86 100644
--- a/src/svm/svm.c
+++ b/src/svm/svm.c
@@ -495,7 +495,7 @@ svm_region_init_mapped_region (svm_map_region_args_t * a, svm_region_t * rp)
ASSERT (rp);
int rv;
- memset (rp, 0, sizeof (*rp));
+ clib_memset (rp, 0, sizeof (*rp));
if (pthread_mutexattr_init (&attr))
clib_unix_warning ("mutexattr_init");
@@ -866,7 +866,7 @@ svm_region_init (void)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = 0;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
@@ -883,7 +883,7 @@ svm_region_init_chroot (const char *root_path)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
@@ -900,7 +900,7 @@ svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid)
{
svm_map_region_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = svm_get_global_region_base_va ();
diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c
index aa523c6b55c..46ce32bbbd8 100644
--- a/src/svm/svm_fifo.c
+++ b/src/svm/svm_fifo.c
@@ -109,7 +109,7 @@ svm_fifo_replay (u8 * s, svm_fifo_t * f, u8 no_read, u8 verbose)
#endif
dummy_fifo = svm_fifo_create (f->nitems);
- memset (f->data, 0xFF, f->nitems);
+ clib_memset (f->data, 0xFF, f->nitems);
vec_validate (data, f->nitems);
for (i = 0; i < vec_len (data); i++)
@@ -209,7 +209,7 @@ svm_fifo_create (u32 data_size_in_bytes)
if (f == 0)
return 0;
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
@@ -480,7 +480,7 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
first_copy_bytes = ((nitems - f->tail) < total_copy_bytes)
? (nitems - f->tail) : total_copy_bytes;
- clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here, first_copy_bytes);
f->tail += first_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
@@ -488,8 +488,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
- second_copy_bytes);
+ _clib_memcpy (&f->data[f->tail], copy_from_here + first_copy_bytes,
+ second_copy_bytes);
f->tail += second_copy_bytes;
f->tail = (f->tail == nitems) ? 0 : f->tail;
}
@@ -566,7 +566,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
first_copy_bytes = ((nitems - normalized_offset) < total_copy_bytes)
? (nitems - normalized_offset) : total_copy_bytes;
- clib_memcpy (&f->data[normalized_offset], copy_from_here, first_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset], copy_from_here,
+ first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
@@ -577,8 +578,8 @@ CLIB_MARCH_FN (svm_fifo_enqueue_with_offset, int, svm_fifo_t * f,
ASSERT (normalized_offset == 0);
- clib_memcpy (&f->data[normalized_offset],
- copy_from_here + first_copy_bytes, second_copy_bytes);
+ _clib_memcpy (&f->data[normalized_offset],
+ copy_from_here + first_copy_bytes, second_copy_bytes);
}
return (0);
@@ -602,11 +603,11 @@ svm_fifo_overwrite_head (svm_fifo_t * f, u8 * data, u32 len)
first_chunk = f->nitems - f->head;
ASSERT (len <= f->nitems);
if (len <= first_chunk)
- clib_memcpy (&f->data[f->head], data, len);
+ _clib_memcpy (&f->data[f->head], data, len);
else
{
- clib_memcpy (&f->data[f->head], data, first_chunk);
- clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
+ _clib_memcpy (&f->data[f->head], data, first_chunk);
+ _clib_memcpy (&f->data[0], data + first_chunk, len - first_chunk);
}
}
#endif
@@ -632,7 +633,7 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
/* Number of bytes in first copy segment */
first_copy_bytes = ((nitems - f->head) < total_copy_bytes)
? (nitems - f->head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[f->head], first_copy_bytes);
f->head += first_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
@@ -640,8 +641,8 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes,
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes,
- &f->data[f->head], second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes,
+ &f->data[f->head], second_copy_bytes);
f->head += second_copy_bytes;
f->head = (f->head == nitems) ? 0 : f->head;
}
@@ -699,14 +700,14 @@ CLIB_MARCH_FN (svm_fifo_peek, int, svm_fifo_t * f, u32 relative_offset,
first_copy_bytes =
((nitems - real_head) < total_copy_bytes) ?
(nitems - real_head) : total_copy_bytes;
- clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
+ _clib_memcpy (copy_here, &f->data[real_head], first_copy_bytes);
/* Number of bytes in second copy segment, if any */
second_copy_bytes = total_copy_bytes - first_copy_bytes;
if (second_copy_bytes)
{
- clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
- second_copy_bytes);
+ _clib_memcpy (copy_here + first_copy_bytes, &f->data[0],
+ second_copy_bytes);
}
}
return total_copy_bytes;
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c
index dcfc0dffb80..a42225c8345 100644
--- a/src/svm/svm_fifo_segment.c
+++ b/src/svm/svm_fifo_segment.c
@@ -190,7 +190,7 @@ svm_fifo_segment_init (svm_fifo_segment_private_t * s)
oldheap = ssvm_push_heap (sh);
fsh = clib_mem_alloc (sizeof (*fsh));
- memset (fsh, 0, sizeof (*fsh));
+ clib_memset (fsh, 0, sizeof (*fsh));
s->h = sh->opaque[0] = fsh;
ssvm_pop_heap (oldheap);
@@ -211,7 +211,7 @@ svm_fifo_segment_create (svm_fifo_segment_create_args_t * a)
/* Allocate a fresh segment */
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->ssvm.ssvm_size = a->segment_size;
s->ssvm.i_am_master = 1;
@@ -247,7 +247,7 @@ svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a)
u32 pagesize = clib_mem_get_page_size ();
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
rnd_size = (a->segment_size + (pagesize - 1)) & ~pagesize;
@@ -278,7 +278,7 @@ svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a)
sh = clib_mem_alloc_aligned (sizeof (*sh), CLIB_CACHE_LINE_BYTES);
s->ssvm.sh = sh;
- memset (sh, 0, sizeof (*sh));
+ clib_memset (sh, 0, sizeof (*sh));
sh->heap = heap;
svm_fifo_segment_init (s);
@@ -299,7 +299,7 @@ svm_fifo_segment_attach (svm_fifo_segment_create_args_t * a)
/* Allocate a fresh segment */
pool_get (sm->segments, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->ssvm.ssvm_size = a->segment_size;
s->ssvm.my_pid = getpid ();
@@ -329,7 +329,7 @@ svm_fifo_segment_delete (svm_fifo_segment_private_t * s)
svm_fifo_segment_main_t *sm = &svm_fifo_segment_main;
ssvm_delete (&s->ssvm);
- memset (s, 0xfe, sizeof (*s));
+ clib_memset (s, 0xfe, sizeof (*s));
pool_put (sm->segments, s);
}
@@ -387,7 +387,7 @@ svm_fifo_segment_alloc_fifo (svm_fifo_segment_private_t * s,
{
fsh->free_fifos[freelist_index] = f->next;
/* (re)initialize the fifo, as in svm_fifo_create */
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
f->nitems = data_size_in_bytes;
f->ooos_list_head = OOO_SEGMENT_INVALID_INDEX;
f->ct_session_index = SVM_FIFO_INVALID_SESSION_INDEX;
diff --git a/src/svm/svmdb.c b/src/svm/svmdb.c
index 03aa1f17494..f2aea5a0d49 100644
--- a/src/svm/svmdb.c
+++ b/src/svm/svmdb.c
@@ -325,7 +325,7 @@ local_set_variable_nolock (svmdb_client_t * client,
{
svmdb_value_t *newvalue;
pool_get (shm->values, newvalue);
- memset (newvalue, 0, sizeof (*newvalue));
+ clib_memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = elsize;
vec_alloc (newvalue->value, vec_len (val) * elsize);
clib_memcpy (newvalue->value, val, vec_len (val) * elsize);
@@ -651,7 +651,7 @@ svmdb_local_find_or_add_vec_variable (svmdb_client_t * client,
h = shm->namespaces[SVMDB_NAMESPACE_VEC];
pool_get (shm->values, newvalue);
- memset (newvalue, 0, sizeof (*newvalue));
+ clib_memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = 1;
vec_alloc (newvalue->value, nbytes);
_vec_len (newvalue->value) = nbytes;
diff --git a/src/svm/svmdbtool.c b/src/svm/svmdbtool.c
index a0af15fcbbf..d50ca7be95c 100644
--- a/src/svm/svmdbtool.c
+++ b/src/svm/svmdbtool.c
@@ -55,7 +55,7 @@ map_arg_setup (char *chroot_path)
svmdbtool_main_t *sm = &svmdbtool_main;
svmdb_map_args_t *ma = &sm->map_args;
- memset (ma, 0, sizeof (*ma));
+ clib_memset (ma, 0, sizeof (*ma));
ma->root_path = chroot_path;
ma->size = sm->size;
ma->uid = sm->uid;
@@ -269,7 +269,7 @@ test_reg (char *chroot_path, u8 * vbl)
ma = map_arg_setup (chroot_path);
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = sigaction_handler;
sa.sa_flags = SA_SIGINFO;
if (sigaction (SIGUSR2, &sa, 0) < 0)
@@ -278,7 +278,7 @@ test_reg (char *chroot_path, u8 * vbl)
return;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
c = svmdb_map (ma);
diff --git a/src/svm/svmtool.c b/src/svm/svmtool.c
index 63577d97fd9..6d1a2b1da49 100644
--- a/src/svm/svmtool.c
+++ b/src/svm/svmtool.c
@@ -190,7 +190,7 @@ svm_map_region_nolock (svm_map_region_args_t * a)
{
clib_warning ("rp->mutex LOCKED by pid %d, tag %d, cleared...",
rp->mutex_owner_pid, rp->mutex_owner_tag);
- memset (&rp->mutex, 0, sizeof (rp->mutex));
+ clib_memset (&rp->mutex, 0, sizeof (rp->mutex));
}
else
@@ -339,7 +339,7 @@ subregion_repair (char *chroot_path)
for (i = 0; i < vec_len (svm_names); i++)
{
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.root_path = chroot_path;
a.name = (char *) svm_names[i];
fformat (stdout, "Checking %s region...\n", a.name);
@@ -422,7 +422,7 @@ repair (char *chroot_path, int crash_root_region)
{
clib_warning ("root_rp->mutex LOCKED by pid %d, tag %d, cleared...",
root_rp->mutex_owner_pid, root_rp->mutex_owner_tag);
- memset (&root_rp->mutex, 0, sizeof (root_rp->mutex));
+ clib_memset (&root_rp->mutex, 0, sizeof (root_rp->mutex));
goto out;
}
else
diff --git a/src/svm/test_svm_fifo1.c b/src/svm/test_svm_fifo1.c
index d5b2c98dfc3..243f8b61673 100644
--- a/src/svm/test_svm_fifo1.c
+++ b/src/svm/test_svm_fifo1.c
@@ -26,7 +26,7 @@ hello_world (int verbose)
u8 *retrieved_data = 0;
clib_error_t *error = 0;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -79,7 +79,7 @@ master (int verbose)
u8 *retrieved_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -115,7 +115,7 @@ mempig (int verbose)
int rv;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -173,7 +173,7 @@ offset (int verbose)
u32 *recovered_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
a->segment_size = 256 << 10;
@@ -234,7 +234,7 @@ slave (int verbose)
u8 *retrieved_data = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
diff --git a/src/svm/test_svm_message_queue.c b/src/svm/test_svm_message_queue.c
index 9441c593ef2..d51252769b5 100644
--- a/src/svm/test_svm_message_queue.c
+++ b/src/svm/test_svm_message_queue.c
@@ -35,7 +35,7 @@ test1 (int verbose)
void *oldheap;
int i;
- memset (ssvm, 0, sizeof (*ssvm));
+ clib_memset (ssvm, 0, sizeof (*ssvm));
ssvm->ssvm_size = 1 << 20;
ssvm->i_am_master = 1;
diff --git a/src/tests/vnet/lisp-cp/test_cp_serdes.c b/src/tests/vnet/lisp-cp/test_cp_serdes.c
index 8e8c8455f7d..11d29d03a5f 100644
--- a/src/tests/vnet/lisp-cp/test_cp_serdes.c
+++ b/src/tests/vnet/lisp-cp/test_cp_serdes.c
@@ -69,7 +69,7 @@ static clib_error_t * test_lisp_msg_push_ecm ()
int lp = 0x15, rp = 0x14;
b = clib_mem_alloc (buff_len);
- memset((u8 *)b, 0, buff_len);
+ clib_memset((u8 *)b, 0, buff_len);
b->current_length = buff_len;
b->current_data = sizeof(udp_header_t) + sizeof(ip4_header_t) +
sizeof(ecm_hdr_t) + 1;
@@ -91,7 +91,7 @@ static clib_error_t * test_lisp_msg_push_ecm ()
ip4_header_t * ih = (ip4_header_t *) (lh + 1);
/* clear ip checksum */
- memset((u8 *)ih + 10, 0, 2);
+ clib_memset((u8 *)ih + 10, 0, 2);
u8 expected_ip4_hdr[] = {
0x45, /* version; IHL */
@@ -109,7 +109,7 @@ static clib_error_t * test_lisp_msg_push_ecm ()
udp_header_t * uh = (udp_header_t *) (ih + 1);
/* clear udp checksum */
- memset((u8 *)uh + 6, 0, 2);
+ clib_memset((u8 *)uh + 6, 0, 2);
u8 expected_udp_hdr[] = {
0x00, 0x15, /* src port */
@@ -134,7 +134,7 @@ static clib_error_t * test_lisp_msg_parse_mapping_record ()
u32 buff_len = 500;
b = clib_mem_alloc (buff_len);
- memset((u8 *)b, 0, buff_len);
+ clib_memset((u8 *)b, 0, buff_len);
u8 map_reply_records[] = {
/* 1. record */
@@ -184,8 +184,8 @@ build_map_request (lisp_cp_main_t * lcm, vlib_buffer_t * b,
u8 rloc_probe_set = 0;
u64 nonce = 0;
map_request_hdr_t * h = 0;
- memset (deid, 0, sizeof (deid[0]));
- memset (seid, 0, sizeof (seid[0]));
+ clib_memset (deid, 0, sizeof (deid[0]));
+ clib_memset (seid, 0, sizeof (seid[0]));
gid_address_type (seid) = GID_ADDR_IP_PREFIX;
ip_address_t * ip_addr = &gid_address_ip (seid);
@@ -208,7 +208,7 @@ static void
generate_rlocs (gid_address_t **rlocs, u32 * count)
{
gid_address_t gid_addr_data, * gid_addr = &gid_addr_data;
- memset (gid_addr, 0, sizeof (gid_addr[0]));
+ clib_memset (gid_addr, 0, sizeof (gid_addr[0]));
ip_address_t * addr = &gid_address_ip (gid_addr);
gid_address_type (gid_addr) = GID_ADDR_IP_PREFIX;
@@ -237,7 +237,7 @@ static clib_error_t * test_lisp_msg_parse ()
u32 rloc_count_parse = 0;
u8 * data = clib_mem_alloc(500);
- memset(data, 0, 500);
+ clib_memset(data, 0, 500);
b = (vlib_buffer_t *) data;
generate_rlocs (&rlocs_decode, &rloc_count_parse);
@@ -297,12 +297,12 @@ static clib_error_t * test_lisp_msg_put_mreq_with_lcaf ()
vec_add1 (rlocs, g);
u8 * data = clib_mem_alloc (500);
- memset (data, 0, 500);
+ clib_memset (data, 0, 500);
h = build_map_request (lcm, (vlib_buffer_t *) data, rlocs);
/* clear Nonce to simplify comparison */
- memset ((u8 *)h + 4, 0, 8);
+ clib_memset ((u8 *)h + 4, 0, 8);
u8 expected_data[] =
{
@@ -346,13 +346,13 @@ static clib_error_t * test_lisp_msg_put_mreq ()
u32 rloc_count = 0;
u8 * data = clib_mem_alloc(500);
- memset(data, 0, 500);
+ clib_memset(data, 0, 500);
generate_rlocs (&rlocs, &rloc_count);
h = build_map_request (lcm, (vlib_buffer_t *) data, rlocs);
/* clear Nonce to simplify comparison */
- memset((u8 *)h + 4, 0, 8);
+ clib_memset((u8 *)h + 4, 0, 8);
print_map_request(h);
@@ -441,7 +441,7 @@ test_lisp_map_register ()
mapping_t * records = build_test_map_records ();
u8 * data = clib_mem_alloc(500);
- memset(data, 0, 500);
+ clib_memset(data, 0, 500);
b = (vlib_buffer_t *) data;
lisp_msg_put_map_register (b, records, 1 /* want map notify */,
@@ -450,10 +450,10 @@ test_lisp_map_register ()
free_test_map_records (records);
/* clear Nonce to simplify comparison */
- memset((u8 *)b->data + 4, 0, 8);
+ clib_memset((u8 *)b->data + 4, 0, 8);
/* clear authentication data */
- memset ((u8 *)b->data + 16, 0, 20);
+ clib_memset ((u8 *)b->data + 16, 0, 20);
u8 expected_data[] = {
0x30, 0x00, 0x01, 0x01, /* type; rsvd; want notify; REC count */
@@ -492,7 +492,7 @@ create_buffer (u8 * data, u32 data_len)
vlib_buffer_t *b;
u8 *buf_data = clib_mem_alloc(500);
- memset (buf_data, 0, 500);
+ clib_memset (buf_data, 0, 500);
b = (vlib_buffer_t *)buf_data;
u8 * p = vlib_buffer_put_uninit (b, data_len);
@@ -545,7 +545,7 @@ test_lisp_parse_lcaf ()
u32 buff_len = 500;
b = clib_mem_alloc (buff_len);
- memset ((u8 *)b, 0, buff_len);
+ clib_memset ((u8 *)b, 0, buff_len);
u8 map_reply_records[] =
{
diff --git a/src/tests/vnet/lisp-cp/test_lisp_types.c b/src/tests/vnet/lisp-cp/test_lisp_types.c
index 7c55a9c1cda..ff25a3f087a 100644
--- a/src/tests/vnet/lisp-cp/test_lisp_types.c
+++ b/src/tests/vnet/lisp-cp/test_lisp_types.c
@@ -133,7 +133,7 @@ test_gid_write_nsh (void)
clib_error_t * error = 0;
u8 * b = clib_mem_alloc(500);
- memset(b, 0, 500);
+ clib_memset(b, 0, 500);
gid_address_t g =
{
@@ -168,8 +168,8 @@ test_gid_parse_nsh ()
gid_address_t _gid_addr, * gid_addr = &_gid_addr;
gid_address_t _gid_addr_copy, * copy = &_gid_addr_copy;
- memset (gid_addr, 0, sizeof (gid_addr[0]));
- memset (copy, 0, sizeof (copy[0]));
+ clib_memset (gid_addr, 0, sizeof (gid_addr[0]));
+ clib_memset (copy, 0, sizeof (copy[0]));
u8 data[] =
{
@@ -201,8 +201,8 @@ static clib_error_t * test_gid_parse_lcaf ()
gid_address_t _gid_addr, * gid_addr = &_gid_addr;
gid_address_t _gid_addr_copy, * gid_addr_copy = &_gid_addr_copy;
- memset (gid_addr, 0, sizeof (gid_addr[0]));
- memset (gid_addr_copy, 0, sizeof (gid_addr_copy[0]));
+ clib_memset (gid_addr, 0, sizeof (gid_addr[0]));
+ clib_memset (gid_addr_copy, 0, sizeof (gid_addr_copy[0]));
u8 data[] =
{
@@ -241,8 +241,8 @@ static clib_error_t * test_gid_parse_lcaf_complex ()
gid_address_t _gid_addr, * gid_addr = &_gid_addr;
gid_address_t _gid_addr_copy, * gid_addr_copy = &_gid_addr_copy;
- memset (gid_addr, 0, sizeof (gid_addr[0]));
- memset (gid_addr_copy, 0, sizeof (gid_addr_copy[0]));
+ clib_memset (gid_addr, 0, sizeof (gid_addr[0]));
+ clib_memset (gid_addr_copy, 0, sizeof (gid_addr_copy[0]));
u8 data[] =
{
@@ -335,7 +335,7 @@ static clib_error_t * test_write_mac_in_lcaf (void)
clib_error_t * error = 0;
u8 * b = clib_mem_alloc(500);
- memset(b, 0, 500);
+ clib_memset(b, 0, 500);
gid_address_t g =
{
@@ -373,7 +373,7 @@ static clib_error_t * test_mac_address_write (void)
clib_error_t * error = 0;
u8 * b = clib_mem_alloc(500);
- memset(b, 0, 500);
+ clib_memset(b, 0, 500);
gid_address_t g =
{
@@ -401,7 +401,7 @@ test_src_dst_with_vni_serdes (void)
{
clib_error_t * error = 0;
u8 * b = clib_mem_alloc (500);
- memset (b, 0, 500);
+ clib_memset (b, 0, 500);
fid_address_t src =
{
@@ -472,7 +472,7 @@ test_src_dst_with_vni_serdes (void)
_assert (0 == memcmp (expected_data, b, sizeof (expected_data)));
gid_address_t p;
- memset (&p, 0, sizeof (p));
+ clib_memset (&p, 0, sizeof (p));
_assert (write_len == gid_address_parse (b, &p));
_assert (0 == gid_address_cmp (&g, &p));
done:
@@ -512,7 +512,7 @@ test_src_dst_serdes (void)
clib_error_t * error = 0;
u8 * b = clib_mem_alloc (500);
- memset (b, 0, 500);
+ clib_memset (b, 0, 500);
fid_address_t src =
{
@@ -564,7 +564,7 @@ test_src_dst_serdes (void)
_assert (0 == memcmp (expected_data, b, sizeof (expected_data)));
gid_address_t p;
- memset (&p, 0, sizeof (p));
+ clib_memset (&p, 0, sizeof (p));
_assert (write_len == gid_address_parse (b, &p));
_assert (0 == gid_address_cmp (&g, &p));
done:
@@ -578,7 +578,7 @@ static clib_error_t * test_gid_address_write (void)
ip_prefix_t ippref_data, * ippref = &ippref_data;
u8 * b = clib_mem_alloc(500);
- memset(b, 0, 500);
+ clib_memset(b, 0, 500);
ip_prefix_version (ippref) = IP4;
ip_prefix_len (ippref) = 9;
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 140a198c2f1..1a0df31feec 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -284,7 +284,7 @@ application_send_attach (echo_main_t * em)
vl_api_application_tls_key_add_t *key_mp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_ATTACH);
bmp->client_index = em->my_client_index;
@@ -301,7 +301,7 @@ application_send_attach (echo_main_t * em)
vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
cert_mp = vl_msg_api_alloc (sizeof (*cert_mp) + test_srv_crt_rsa_len);
- memset (cert_mp, 0, sizeof (*cert_mp));
+ clib_memset (cert_mp, 0, sizeof (*cert_mp));
cert_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_CERT_ADD);
cert_mp->client_index = em->my_client_index;
cert_mp->context = ntohl (0xfeedface);
@@ -310,7 +310,7 @@ application_send_attach (echo_main_t * em)
vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & cert_mp);
key_mp = vl_msg_api_alloc (sizeof (*key_mp) + test_srv_key_rsa_len);
- memset (key_mp, 0, sizeof (*key_mp) + test_srv_key_rsa_len);
+ clib_memset (key_mp, 0, sizeof (*key_mp) + test_srv_key_rsa_len);
key_mp->_vl_msg_id = ntohs (VL_API_APPLICATION_TLS_KEY_ADD);
key_mp->client_index = em->my_client_index;
key_mp->context = ntohl (0xfeedface);
@@ -336,7 +336,7 @@ application_detach (echo_main_t * em)
{
vl_api_application_detach_t *bmp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
bmp->client_index = em->my_client_index;
@@ -352,7 +352,7 @@ ssvm_segment_attach (char *name, ssvm_segment_type_t type, int fd)
svm_fifo_segment_create_args_t _a, *a = &_a;
int rv;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = (char *) name;
a->segment_type = type;
@@ -517,7 +517,7 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
svm_fifo_segment_create_args_t _a, *a = &_a;
int rv;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = (char *) mp->segment_name;
a->segment_size = mp->segment_size;
/* Attach to the segment vpp created */
@@ -703,7 +703,7 @@ client_send_connect (echo_main_t * em)
{
vl_api_connect_uri_t *cmp;
cmp = vl_msg_api_alloc (sizeof (*cmp));
- memset (cmp, 0, sizeof (*cmp));
+ clib_memset (cmp, 0, sizeof (*cmp));
cmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI);
cmp->client_index = em->my_client_index;
@@ -717,7 +717,7 @@ client_send_disconnect (echo_main_t * em, session_t * s)
{
vl_api_disconnect_session_t *dmp;
dmp = vl_msg_api_alloc (sizeof (*dmp));
- memset (dmp, 0, sizeof (*dmp));
+ clib_memset (dmp, 0, sizeof (*dmp));
dmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION);
dmp->client_index = em->my_client_index;
dmp->handle = s->vpp_session_handle;
@@ -729,7 +729,7 @@ client_disconnect (echo_main_t * em, session_t * s)
{
client_send_disconnect (em, s);
pool_put (em->sessions, s);
- memset (s, 0xfe, sizeof (*s));
+ clib_memset (s, 0xfe, sizeof (*s));
return 0;
}
@@ -816,7 +816,7 @@ session_connected_handler (session_connected_msg_t * mp)
*/
pool_get (em->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
session_index = session - em->sessions;
rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
@@ -1232,7 +1232,7 @@ server_send_listen (echo_main_t * em)
{
vl_api_bind_uri_t *bmp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_BIND_URI);
bmp->client_index = em->my_client_index;
@@ -1259,7 +1259,7 @@ server_send_unbind (echo_main_t * em)
vl_api_unbind_uri_t *ump;
ump = vl_msg_api_alloc (sizeof (*ump));
- memset (ump, 0, sizeof (*ump));
+ clib_memset (ump, 0, sizeof (*ump));
ump->_vl_msg_id = ntohs (VL_API_UNBIND_URI);
ump->client_index = em->my_client_index;
@@ -1289,7 +1289,7 @@ server_run (echo_main_t * em)
for (i = 0; i < 200000; i++)
{
pool_get (em->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
}
for (i = 0; i < 200000; i++)
pool_put_index (em->sessions, i);
@@ -1395,7 +1395,7 @@ main (int argc, char **argv)
clib_mem_init_thread_safe (0, 256 << 20);
- memset (em, 0, sizeof (*em));
+ clib_memset (em, 0, sizeof (*em));
em->session_index_by_vpp_handles = hash_create (0, sizeof (uword));
em->my_pid = getpid ();
em->configured_segment_size = 1 << 20;
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index 9872eed27ba..9ab77517898 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -302,7 +302,7 @@ application_send_attach (udp_echo_main_t * utm)
{
vl_api_application_attach_t *bmp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_ATTACH);
bmp->client_index = utm->my_client_index;
@@ -325,7 +325,7 @@ application_detach (udp_echo_main_t * utm)
{
vl_api_application_detach_t *bmp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_APPLICATION_DETACH);
bmp->client_index = utm->my_client_index;
@@ -508,7 +508,7 @@ session_accepted_handler (session_accepted_msg_t * mp)
tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
pool_get (utm->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
session_index = session - utm->sessions;
session->session_index = session_index;
@@ -687,7 +687,7 @@ session_bound_handler (session_bound_msg_t * mp)
tx_fifo = uword_to_pointer (mp->tx_fifo, svm_fifo_t *);
pool_get (utm->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
session_index = session - utm->sessions;
rx_fifo->client_session_index = session_index;
@@ -730,7 +730,7 @@ udp_client_send_connect (udp_echo_main_t * utm)
{
vl_api_connect_uri_t *cmp;
cmp = vl_msg_api_alloc (sizeof (*cmp));
- memset (cmp, 0, sizeof (*cmp));
+ clib_memset (cmp, 0, sizeof (*cmp));
cmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI);
cmp->client_index = utm->my_client_index;
@@ -894,7 +894,7 @@ vl_api_bind_uri_reply_t_handler (vl_api_bind_uri_reply_t * mp)
tx_fifo = uword_to_pointer (mp->tx_fifo, svm_fifo_t *);
pool_get (utm->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
session_index = session - utm->sessions;
rx_fifo->client_session_index = session_index;
@@ -919,7 +919,7 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
u8 *seg_name;
int rv;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->segment_name = (char *) mp->segment_name;
a->segment_size = mp->segment_size;
/* Attach to the segment vpp created */
@@ -1154,7 +1154,7 @@ server_unbind (udp_echo_main_t * utm)
vl_api_unbind_uri_t *ump;
ump = vl_msg_api_alloc (sizeof (*ump));
- memset (ump, 0, sizeof (*ump));
+ clib_memset (ump, 0, sizeof (*ump));
ump->_vl_msg_id = ntohs (VL_API_UNBIND_URI);
ump->client_index = utm->my_client_index;
@@ -1168,7 +1168,7 @@ server_bind (udp_echo_main_t * utm)
vl_api_bind_uri_t *bmp;
bmp = vl_msg_api_alloc (sizeof (*bmp));
- memset (bmp, 0, sizeof (*bmp));
+ clib_memset (bmp, 0, sizeof (*bmp));
bmp->_vl_msg_id = ntohs (VL_API_BIND_URI);
bmp->client_index = utm->my_client_index;
@@ -1303,7 +1303,7 @@ main (int argc, char **argv)
for (i = 0; i < 200000; i++)
{
pool_get (utm->sessions, session);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
}
for (i = 0; i < 200000; i++)
pool_put_index (utm->sessions, i);
diff --git a/src/tools/elftool/elftool.c b/src/tools/elftool/elftool.c
index d9d3704b4a3..debd9089027 100644
--- a/src/tools/elftool/elftool.c
+++ b/src/tools/elftool/elftool.c
@@ -100,7 +100,7 @@ static clib_error_t * elf_set_interpreter (elf_main_t * em,
return error;
/* Put in new null terminated string. */
- memset (s->contents, 0, vec_len (s->contents));
+ clib_memset (s->contents, 0, vec_len (s->contents));
clib_memcpy (s->contents, interp, strlen (interp));
return 0;
@@ -375,7 +375,7 @@ int main (int argc, char * argv[])
unformat_input_t i;
clib_error_t * error = 0;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
unformat_init_command_line (&i, argv);
while (unformat_check_input (&i) != UNFORMAT_END_OF_INPUT)
diff --git a/src/tools/g2/view1.c b/src/tools/g2/view1.c
index a4190cb1f27..9c86fcdcec4 100644
--- a/src/tools/g2/view1.c
+++ b/src/tools/g2/view1.c
@@ -1636,7 +1636,7 @@ static void init_track_colors(void)
if (s_color != NULL ) {
gdk_colormap_free_colors(gtk_widget_get_colormap(da),
s_color, g_npids);
- memset(s_color, 0, sizeof(GdkColor) * g_npids);
+ clib_memset(s_color, 0, sizeof(GdkColor) * g_npids);
} else {
/*
* First time through: allocate the array to hold the GCs.
diff --git a/src/tools/perftool/cpel_util.c b/src/tools/perftool/cpel_util.c
index 7ee9b6e2a00..4f5f98a51cc 100644
--- a/src/tools/perftool/cpel_util.c
+++ b/src/tools/perftool/cpel_util.c
@@ -210,7 +210,7 @@ int write_event_defs(FILE *ofp)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&edsh, 0, sizeof(edsh));
+ clib_memset(&edsh, 0, sizeof(edsh));
strcpy(edsh.string_table_name, "FileStrtab");
edsh.number_of_event_definitions = ntohl(vec_len(the_event_definitions));
@@ -274,7 +274,7 @@ int write_events(FILE *ofp, u64 clock_ticks_per_second)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&eh, 0, sizeof(eh));
+ clib_memset(&eh, 0, sizeof(eh));
strcpy(eh.string_table_name, "FileStrtab");
eh.number_of_events = ntohl(number_of_events);
eh.clock_ticks_per_second = ntohl(clock_ticks_per_second);
@@ -322,7 +322,7 @@ int write_track_defs(FILE *ofp)
if (fwrite(&sh, sizeof(sh), 1, ofp) != 1)
return(0);
- memset(&tdsh, 0, sizeof(tdsh));
+ clib_memset(&tdsh, 0, sizeof(tdsh));
strcpy(tdsh.string_table_name, "FileStrtab");
tdsh.number_of_track_definitions = ntohl(vec_len(the_tracks));
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 96cf8026900..efd116dd7a7 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -6360,7 +6360,7 @@ api_create_loopback (vat_main_t * vam)
u32 user_instance = 0;
int ret;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -7998,7 +7998,7 @@ api_tap_connect (vat_main_t * vam)
int ip6_address_set = 0;
int ret;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8087,7 +8087,7 @@ api_tap_modify (vat_main_t * vam)
u8 sw_if_index_set = 0;
int ret;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8204,7 +8204,7 @@ api_tap_create_v2 (vat_main_t * vam)
int ret;
u32 rx_ring_sz = 0, tx_ring_sz = 0;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -8385,7 +8385,7 @@ api_bond_create (vat_main_t * vam)
u8 lb;
u8 mode_is_set = 0;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
lb = BOND_LB_L2;
/* Parse args required to build the message */
@@ -8645,8 +8645,8 @@ api_ip_add_del_route (vat_main_t * vam)
mpls_label_t next_hop_out_label = MPLS_LABEL_INVALID;
mpls_label_t next_hop_via_label = MPLS_LABEL_INVALID;
- memset (&v4_next_hop_address, 0, sizeof (ip4_address_t));
- memset (&v6_next_hop_address, 0, sizeof (ip6_address_t));
+ clib_memset (&v4_next_hop_address, 0, sizeof (ip4_address_t));
+ clib_memset (&v6_next_hop_address, 0, sizeof (ip6_address_t));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -8964,14 +8964,14 @@ api_ip_mroute_add_del (vat_main_t * vam)
}
else if (unformat (i, "%U", unformat_ip4_address, &v4_grp_address))
{
- memset (&v4_src_address, 0, sizeof (v4_src_address));
+ clib_memset (&v4_src_address, 0, sizeof (v4_src_address));
grp_address_length = 32;
address_set = 1;
is_ipv6 = 0;
}
else if (unformat (i, "%U", unformat_ip6_address, &v6_grp_address))
{
- memset (&v6_src_address, 0, sizeof (v6_src_address));
+ clib_memset (&v6_src_address, 0, sizeof (v6_src_address));
grp_address_length = 128;
address_set = 1;
is_ipv6 = 1;
@@ -9923,7 +9923,7 @@ api_ip_neighbor_add_del (vat_main_t * vam)
ip6_address_t v6address;
int ret;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -9986,7 +9986,7 @@ api_ip_neighbor_add_del (vat_main_t * vam)
}
else
{
- /* mp->is_ipv6 = 0; via memset in M macro above */
+ /* mp->is_ipv6 = 0; via clib_memset in M macro above */
clib_memcpy (mp->dst_address, &v4address, sizeof (v4address));
}
@@ -11147,8 +11147,8 @@ api_sr_localsid_add_del (vat_main_t * vam)
u32 fib_table = ~(u32) 0;
ip6_address_t nh_addr6;
ip4_address_t nh_addr4;
- memset (&nh_addr6, 0, sizeof (ip6_address_t));
- memset (&nh_addr4, 0, sizeof (ip4_address_t));
+ clib_memset (&nh_addr6, 0, sizeof (ip6_address_t));
+ clib_memset (&nh_addr4, 0, sizeof (ip4_address_t));
bool nexthop_set = 0;
@@ -11297,7 +11297,7 @@ unformat_tcp_mask (unformat_input_t * input, va_list * args)
tcp = (tcp_header_t *) mask;
-#define _(a) if (a) memset (&tcp->a, 0xff, sizeof (tcp->a));
+#define _(a) if (a) clib_memset (&tcp->a, 0xff, sizeof (tcp->a));
foreach_tcp_proto_field;
#undef _
@@ -11338,7 +11338,7 @@ unformat_udp_mask (unformat_input_t * input, va_list * args)
udp = (udp_header_t *) mask;
-#define _(a) if (a) memset (&udp->a, 0xff, sizeof (udp->a));
+#define _(a) if (a) clib_memset (&udp->a, 0xff, sizeof (udp->a));
foreach_udp_proto_field;
#undef _
@@ -11428,7 +11428,7 @@ unformat_ip4_mask (unformat_input_t * input, va_list * args)
ip = (ip4_header_t *) mask;
-#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a));
+#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a));
foreach_ip4_proto_field;
#undef _
@@ -11500,7 +11500,7 @@ unformat_ip6_mask (unformat_input_t * input, va_list * args)
ip = (ip6_header_t *) mask;
-#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a));
+#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a));
foreach_ip6_proto_field;
#undef _
@@ -11596,10 +11596,10 @@ unformat_l2_mask (unformat_input_t * input, va_list * args)
vec_validate (mask, len - 1);
if (dst)
- memset (mask, 0xff, 6);
+ clib_memset (mask, 0xff, 6);
if (src)
- memset (mask + 6, 0xff, 6);
+ clib_memset (mask + 6, 0xff, 6);
if (tag2 || dot1ad)
{
@@ -13385,8 +13385,8 @@ api_vxlan_add_del_tunnel (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -13668,8 +13668,8 @@ api_geneve_add_del_tunnel (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&src, 0, sizeof src);
- memset (&dst, 0, sizeof dst);
+ clib_memset (&src, 0, sizeof src);
+ clib_memset (&dst, 0, sizeof dst);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -13928,10 +13928,10 @@ api_gre_add_del_tunnel (vat_main_t * vam)
u32 instance = ~0;
int ret;
- memset (&src4, 0, sizeof src4);
- memset (&dst4, 0, sizeof dst4);
- memset (&src6, 0, sizeof src6);
- memset (&dst6, 0, sizeof dst6);
+ clib_memset (&src4, 0, sizeof src4);
+ clib_memset (&dst4, 0, sizeof dst4);
+ clib_memset (&src6, 0, sizeof src6);
+ clib_memset (&dst6, 0, sizeof dst6);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -14253,7 +14253,7 @@ api_create_vhost_user_if (vat_main_t * vam)
int ret;
/* Shut up coverity */
- memset (hwaddr, 0, sizeof (hwaddr));
+ clib_memset (hwaddr, 0, sizeof (hwaddr));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -14512,10 +14512,10 @@ api_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
int ret;
/* Can't "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&local4, 0, sizeof local4);
- memset (&remote4, 0, sizeof remote4);
- memset (&local6, 0, sizeof local6);
- memset (&remote6, 0, sizeof remote6);
+ clib_memset (&local4, 0, sizeof local4);
+ clib_memset (&remote4, 0, sizeof remote4);
+ clib_memset (&local6, 0, sizeof local6);
+ clib_memset (&remote6, 0, sizeof remote6);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -16920,7 +16920,7 @@ unformat_lisp_eid_vat (unformat_input_t * input, va_list * args)
{
lisp_eid_vat_t *a = va_arg (*args, lisp_eid_vat_t *);
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
if (unformat (input, "%U/%d", unformat_ip4_address, a->addr, &a->len))
{
@@ -17321,7 +17321,7 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
vl_api_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
int ret;
- memset (&rloc, 0, sizeof (rloc));
+ clib_memset (&rloc, 0, sizeof (rloc));
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -18428,7 +18428,7 @@ api_one_use_petr (vat_main_t * vam)
ip_address_t ip;
int ret;
- memset (&ip, 0, sizeof (ip));
+ clib_memset (&ip, 0, sizeof (ip));
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -18624,7 +18624,7 @@ api_one_add_del_remote_mapping (vat_main_t * vam)
vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
int ret;
- memset (&rloc, 0, sizeof (rloc));
+ clib_memset (&rloc, 0, sizeof (rloc));
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -19218,7 +19218,7 @@ api_one_add_del_map_request_itr_rlocs (vat_main_t * vam)
}
else
{
- memset (mp->locator_set_name, 0, sizeof (mp->locator_set_name));
+ clib_memset (mp->locator_set_name, 0, sizeof (mp->locator_set_name));
}
vec_free (locator_set_name);
@@ -19730,8 +19730,8 @@ api_gpe_add_del_native_fwd_rpath (vat_main_t * vam)
struct in6_addr ip6;
u32 table_id = 0, nh_sw_if_index = ~0;
- memset (&ip4, 0, sizeof (ip4));
- memset (&ip6, 0, sizeof (ip6));
+ clib_memset (&ip4, 0, sizeof (ip4));
+ clib_memset (&ip6, 0, sizeof (ip6));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -19973,7 +19973,7 @@ api_af_packet_create (vat_main_t * vam)
u8 random_hw_addr = 1;
int ret;
- memset (hw_addr, 0, sizeof (hw_addr));
+ clib_memset (hw_addr, 0, sizeof (hw_addr));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -20339,7 +20339,7 @@ api_netmap_create (vat_main_t * vam)
u8 is_master = 0;
int ret;
- memset (hw_addr, 0, sizeof (hw_addr));
+ clib_memset (hw_addr, 0, sizeof (hw_addr));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -21946,8 +21946,8 @@ api_l2_interface_pbb_tag_rewrite (vat_main_t * vam)
int ret;
/* Shut up coverity */
- memset (dmac, 0, sizeof (dmac));
- memset (smac, 0, sizeof (smac));
+ clib_memset (dmac, 0, sizeof (dmac));
+ clib_memset (smac, 0, sizeof (smac));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@ -22325,7 +22325,7 @@ api_p2p_ethernet_add (vat_main_t * vam)
u8 mac_set = 0;
int ret;
- memset (remote_mac, 0, sizeof (remote_mac));
+ clib_memset (remote_mac, 0, sizeof (remote_mac));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
if (unformat (i, "%U", api_unformat_sw_if_index, vam, &parent_if_index))
@@ -22381,7 +22381,7 @@ api_p2p_ethernet_del (vat_main_t * vam)
u8 mac_set = 0;
int ret;
- memset (remote_mac, 0, sizeof (remote_mac));
+ clib_memset (remote_mac, 0, sizeof (remote_mac));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
if (unformat (i, "%U", api_unformat_sw_if_index, vam, &parent_if_index))
@@ -22469,8 +22469,8 @@ api_sw_interface_set_lldp (vat_main_t * vam)
ip6_address_t ip6_addr;
int ret;
- memset (&ip4_addr, 0, sizeof (ip4_addr));
- memset (&ip6_addr, 0, sizeof (ip6_addr));
+ clib_memset (&ip4_addr, 0, sizeof (ip4_addr));
+ clib_memset (&ip6_addr, 0, sizeof (ip6_addr));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vat/json_format.c b/src/vat/json_format.c
index 6f316d972eb..208fdd1442f 100644
--- a/src/vat/json_format.c
+++ b/src/vat/json_format.c
@@ -245,7 +245,7 @@ void
vat_json_print (FILE * ofp, vat_json_node_t * node)
{
vat_print_ctx_t ctx;
- memset (&ctx, 0, sizeof ctx);
+ clib_memset (&ctx, 0, sizeof ctx);
ctx.indent = 0;
ctx.ofp = ofp;
fformat (ofp, "\n");
diff --git a/src/vat/main.c b/src/vat/main.c
index 1287be9bdf0..295ccec2515 100644
--- a/src/vat/main.c
+++ b/src/vat/main.c
@@ -253,7 +253,7 @@ setup_signal_handlers (void)
for (i = 1; i < 32; i++)
{
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = (void *) signal_handler;
sa.sa_flags = SA_SIGINFO;
diff --git a/src/vat/plugin.c b/src/vat/plugin.c
index b94c4fc30d0..5c7045415a8 100644
--- a/src/vat/plugin.c
+++ b/src/vat/plugin.c
@@ -157,7 +157,7 @@ vat_load_new_plugins (plugin_main_t * pm)
_vec_len (pm->plugin_info) = vec_len (pm->plugin_info) - 1;
continue;
}
- memset (pi, 0, sizeof (*pi));
+ clib_memset (pi, 0, sizeof (*pi));
hash_set_mem (pm->plugin_by_name_hash, plugin_name,
pi - pm->plugin_info);
}
diff --git a/src/vat/restart.c b/src/vat/restart.c
index adeee000680..8fe29d89bf0 100644
--- a/src/vat/restart.c
+++ b/src/vat/restart.c
@@ -65,7 +65,7 @@ restart_main_fn (unformat_input_t * i)
/*
* Step 1: look up the current VPP pid in the shared-memory database
*/
- memset (ma, 0, sizeof (*ma));
+ clib_memset (ma, 0, sizeof (*ma));
ma->root_path = (char *) chroot_path;
svmdb_client = svmdb_map (ma);
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 785fa9b8aac..ee76290e25a 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -377,7 +377,7 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm,
pool_get_aligned (vm->buffer_free_list_pool, f, CLIB_CACHE_LINE_BYTES);
- memset (f, 0, sizeof (f[0]));
+ clib_memset (f, 0, sizeof (f[0]));
f->index = f - vm->buffer_free_list_pool;
f->n_data_bytes = vlib_buffer_round_size (n_data_bytes);
f->min_n_buffers_each_alloc = VLIB_FRAME_SIZE;
@@ -439,7 +439,7 @@ del_free_list (vlib_main_t * vm, vlib_buffer_free_list_t * f)
vec_free (f->buffers);
/* Poison it. */
- memset (f, 0xab, sizeof (f[0]));
+ clib_memset (f, 0xab, sizeof (f[0]));
}
/* Add buffer free list. */
@@ -544,7 +544,7 @@ vlib_buffer_fill_free_list_internal (vlib_main_t * vm,
if (CLIB_DEBUG > 0)
vlib_buffer_set_known_state (bi[0], VLIB_BUFFER_KNOWN_FREE);
- memset (b, 0, sizeof (vlib_buffer_t));
+ clib_memset (b, 0, sizeof (vlib_buffer_t));
vlib_buffer_init_for_free_list (b, fl);
if (fl->buffer_init_function)
@@ -709,7 +709,7 @@ vlib_packet_template_init (vlib_main_t * vm,
vlib_worker_thread_barrier_sync (vm);
- memset (t, 0, sizeof (t[0]));
+ clib_memset (t, 0, sizeof (t[0]));
vec_add (t->packet_data, packet_data, n_packet_data_bytes);
t->min_n_buffers_each_alloc = min_n_buffers_each_alloc;
diff --git a/src/vlib/buffer_serialize.c b/src/vlib/buffer_serialize.c
index 48dcce3be90..5696882ae0d 100644
--- a/src/vlib/buffer_serialize.c
+++ b/src/vlib/buffer_serialize.c
@@ -170,7 +170,7 @@ serialize_open_vlib_helper (serialize_main_t * m,
/* Initialize serialize main but save overflow buffer for re-use between calls. */
{
u8 *save = m->stream.overflow_buffer;
- memset (m, 0, sizeof (m[0]));
+ clib_memset (m, 0, sizeof (m[0]));
m->stream.overflow_buffer = save;
if (save)
_vec_len (save) = 0;
diff --git a/src/vlib/error.c b/src/vlib/error.c
index 9fc1e708b63..e6e4f2d5651 100644
--- a/src/vlib/error.c
+++ b/src/vlib/error.c
@@ -199,8 +199,8 @@ vlib_register_errors (vlib_main_t * vm,
em->counters_last_clear + n->error_heap_index,
n_errors * sizeof (em->counters[0]));
else
- memset (em->counters + n->error_heap_index,
- 0, n_errors * sizeof (em->counters[0]));
+ clib_memset (em->counters + n->error_heap_index,
+ 0, n_errors * sizeof (em->counters[0]));
/* Register counter indices in the stat segment directory */
{
@@ -223,7 +223,7 @@ vlib_register_errors (vlib_main_t * vm,
elog_event_type_t t;
uword i;
- memset (&t, 0, sizeof (t));
+ clib_memset (&t, 0, sizeof (t));
for (i = 0; i < n_errors; i++)
{
t.format = (char *) format (0, "%v %s: %%d",
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c
index 69fca9e6098..b55fb5042f7 100644
--- a/src/vlib/linux/pci.c
+++ b/src/vlib/linux/pci.c
@@ -180,7 +180,7 @@ vlib_pci_get_device_info (vlib_main_t * vm, vlib_pci_addr_t * addr,
int fd;
di = clib_mem_alloc (sizeof (vlib_pci_device_info_t));
- memset (di, 0, sizeof (vlib_pci_device_info_t));
+ clib_memset (di, 0, sizeof (vlib_pci_device_info_t));
di->addr.as_u32 = addr->as_u32;
u8 *dev_dir_name = format (0, "%s/%U", sysfs_pci_dev_path,
@@ -212,7 +212,7 @@ vlib_pci_get_device_info (vlib_main_t * vm, vlib_pci_addr_t * addr,
{
static pci_config_header_t all_ones;
if (all_ones.vendor_id == 0)
- memset (&all_ones, ~0, sizeof (all_ones));
+ clib_memset (&all_ones, ~0, sizeof (all_ones));
if (!memcmp (&di->config0.header, &all_ones, sizeof (all_ones)))
{
@@ -451,8 +451,8 @@ vlib_pci_bind_to_uio (vlib_main_t * vm, vlib_pci_addr_t * addr,
if (e->d_name[0] == '.') /* skip . and .. */
continue;
- memset (&ifr, 0, sizeof ifr);
- memset (&drvinfo, 0, sizeof drvinfo);
+ clib_memset (&ifr, 0, sizeof ifr);
+ clib_memset (&drvinfo, 0, sizeof drvinfo);
ifr.ifr_data = (char *) &drvinfo;
strncpy (ifr.ifr_name, e->d_name, sizeof (ifr.ifr_name));
ifr.ifr_name[ARRAY_LEN (ifr.ifr_name) - 1] = '\0';
@@ -469,7 +469,7 @@ vlib_pci_bind_to_uio (vlib_main_t * vm, vlib_pci_addr_t * addr,
if (strcmp ((char *) s, drvinfo.bus_info))
continue;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, e->d_name, sizeof (ifr.ifr_name));
ifr.ifr_name[ARRAY_LEN (ifr.ifr_name) - 1] = '\0';
if (ioctl (fd, SIOCGIFFLAGS, &ifr) < 0)
@@ -1138,7 +1138,7 @@ error:
if (err)
{
pci_log_err (vm, p, "%U", format_clib_error, err);
- memset (p, 0, sizeof (linux_pci_device_t));
+ clib_memset (p, 0, sizeof (linux_pci_device_t));
pool_put (lpm->linux_pci_devices, p);
}
@@ -1205,7 +1205,7 @@ vlib_pci_device_close (vlib_main_t * vm, vlib_pci_dev_handle_t h)
vec_free (p->regions);
close (p->fd);
- memset (p, 0, sizeof (linux_pci_device_t));
+ clib_memset (p, 0, sizeof (linux_pci_device_t));
pool_put (lpm->linux_pci_devices, p);
}
@@ -1244,7 +1244,7 @@ init_device_from_registered (vlib_main_t * vm, vlib_pci_device_info_t * di)
}
/* No driver, close the PCI config-space FD */
- memset (p, 0, sizeof (linux_pci_device_t));
+ clib_memset (p, 0, sizeof (linux_pci_device_t));
pool_put (lpm->linux_pci_devices, p);
}
diff --git a/src/vlib/linux/physmem.c b/src/vlib/linux/physmem.c
index dbc4c549a99..90b0f8cab3d 100755
--- a/src/vlib/linux/physmem.c
+++ b/src/vlib/linux/physmem.c
@@ -219,7 +219,7 @@ unix_physmem_region_alloc (vlib_main_t * vm, char *name, u32 size,
goto done;
error:
- memset (pr, 0, sizeof (*pr));
+ clib_memset (pr, 0, sizeof (*pr));
pool_put (vpm->regions, pr);
done:
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 273ae5256a5..14d89141ff8 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -143,7 +143,7 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index,
/* Poison frame when debugging. */
if (CLIB_DEBUG > 0)
- memset (f, 0xfe, n);
+ clib_memset (f, 0xfe, n);
/* Insert magic number. */
{
diff --git a/src/vlib/node.c b/src/vlib/node.c
index ed474eb5311..c87400d440c 100644
--- a/src/vlib/node.c
+++ b/src/vlib/node.c
@@ -290,7 +290,7 @@ node_elog_init (vlib_main_t * vm, uword ni)
{
elog_event_type_t t;
- memset (&t, 0, sizeof (t));
+ clib_memset (&t, 0, sizeof (t));
/* 2 event types for this node: one when node function is called.
One when it returns. */
@@ -347,7 +347,7 @@ register_node (vlib_main_t * vm, vlib_node_registration_t * r)
ASSERT (r->function != 0);
n = clib_mem_alloc_no_fail (sizeof (n[0]));
- memset (n, 0, sizeof (n[0]));
+ clib_memset (n, 0, sizeof (n[0]));
n->index = vec_len (nm->nodes);
n->node_fn_registrations = r->node_fn_registrations;
@@ -451,7 +451,7 @@ register_node (vlib_main_t * vm, vlib_node_registration_t * r)
clib_panic ("failed to allocate process stack (%d bytes)",
1 << log2_n_stack_bytes);
- memset (p, 0, sizeof (p[0]));
+ clib_memset (p, 0, sizeof (p[0]));
p->log2_n_stack_bytes = log2_n_stack_bytes;
/* Process node's runtime index is really index into process
diff --git a/src/vlib/node.h b/src/vlib/node.h
index fd245d59def..fb2a83bc400 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -444,7 +444,7 @@ typedef struct
always_inline void
vlib_next_frame_init (vlib_next_frame_t * nf)
{
- memset (nf, 0, sizeof (nf[0]));
+ clib_memset (nf, 0, sizeof (nf[0]));
nf->frame_index = ~0;
nf->node_runtime_index = ~0;
}
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h
index a308b87e8ca..3304d0f0d9f 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -1015,7 +1015,7 @@ vlib_signal_one_time_waiting_process (vlib_main_t * vm,
{
vlib_process_signal_one_time_event (vm, p->node_index, p->one_time_event,
/* data */ ~0);
- memset (p, ~0, sizeof (p[0]));
+ clib_memset (p, ~0, sizeof (p[0]));
}
always_inline void
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 7f407e92478..c99458ddaec 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -393,7 +393,7 @@ vlib_frame_queue_alloc (int nelts)
vlib_frame_queue_t *fq;
fq = clib_mem_alloc_aligned (sizeof (*fq), CLIB_CACHE_LINE_BYTES);
- memset (fq, 0, sizeof (*fq));
+ clib_memset (fq, 0, sizeof (*fq));
fq->nelts = nelts;
fq->vector_threshold = 128; // packets
vec_validate_aligned (fq->elts, nelts - 1, CLIB_CACHE_LINE_BYTES);
@@ -775,8 +775,8 @@ start_workers (vlib_main_t * vm)
vm_clone->pending_rpc_requests = 0;
vec_validate (vm_clone->pending_rpc_requests, 0);
_vec_len (vm_clone->pending_rpc_requests) = 0;
- memset (&vm_clone->random_buffer, 0,
- sizeof (vm_clone->random_buffer));
+ clib_memset (&vm_clone->random_buffer, 0,
+ sizeof (vm_clone->random_buffer));
nm = &vlib_mains[0]->node_main;
nm_clone = &vm_clone->node_main;
@@ -812,9 +812,9 @@ start_workers (vlib_main_t * vm)
clib_memcpy (n, nm->nodes[j], sizeof (*n));
/* none of the copied nodes have enqueue rights given out */
n->owner_node_index = VLIB_INVALID_NODE_INDEX;
- memset (&n->stats_total, 0, sizeof (n->stats_total));
- memset (&n->stats_last_clear, 0,
- sizeof (n->stats_last_clear));
+ clib_memset (&n->stats_total, 0, sizeof (n->stats_total));
+ clib_memset (&n->stats_last_clear, 0,
+ sizeof (n->stats_last_clear));
vec_add1 (nm_clone->nodes, n);
n++;
}
@@ -1087,10 +1087,10 @@ vlib_worker_thread_node_refork (void)
if (j >= vec_len (old_nodes_clone))
{
/* new node, set to zero */
- memset (&new_n_clone->stats_total, 0,
- sizeof (new_n_clone->stats_total));
- memset (&new_n_clone->stats_last_clear, 0,
- sizeof (new_n_clone->stats_last_clear));
+ clib_memset (&new_n_clone->stats_total, 0,
+ sizeof (new_n_clone->stats_total));
+ clib_memset (&new_n_clone->stats_last_clear, 0,
+ sizeof (new_n_clone->stats_last_clear));
}
else
{
diff --git a/src/vlib/threads_cli.c b/src/vlib/threads_cli.c
index 86c02479892..65b3e2a5496 100644
--- a/src/vlib/threads_cli.c
+++ b/src/vlib/threads_cli.c
@@ -168,9 +168,9 @@ trace_frame_queue (vlib_main_t * vm, unformat_input_t * input,
fqt = &fqm->frame_queue_traces[fqix];
fqh = &fqm->frame_queue_histogram[fqix];
- memset (fqt->n_vectors, 0xff, sizeof (fqt->n_vectors));
+ clib_memset (fqt->n_vectors, 0xff, sizeof (fqt->n_vectors));
fqt->written = 0;
- memset (fqh, 0, sizeof (*fqh));
+ clib_memset (fqh, 0, sizeof (*fqh));
fqm->vlib_frame_queues[fqix]->trace = enable;
}
diff --git a/src/vlib/unix/cj.c b/src/vlib/unix/cj.c
index 7757146c7a7..7238dbfac38 100644
--- a/src/vlib/unix/cj.c
+++ b/src/vlib/unix/cj.c
@@ -97,7 +97,7 @@ cj_config (vlib_main_t * vm, unformat_input_t * input)
cjm->num_records = max_pow2 (cjm->num_records);
vec_validate (cjm->records, cjm->num_records - 1);
- memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
+ clib_memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
cjm->tail = ~0;
cjm->enable = enable;
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index 2fe33cc54fb..56afbc2089b 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2728,7 +2728,7 @@ unix_cli_file_add (unix_cli_main_t * cm, char *name, int fd)
}
pool_get (cm->cli_file_pool, cf);
- memset (cf, 0, sizeof (*cf));
+ clib_memset (cf, 0, sizeof (*cf));
template.read_function = unix_cli_read_ready;
template.write_function = unix_cli_write_ready;
@@ -2918,7 +2918,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
if (isatty (STDIN_FILENO) && um->cli_line_mode == 0)
{
/* Capture terminal resize events */
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_handler = unix_cli_resize_interrupt;
if (sigaction (SIGWINCH, &sa, 0) < 0)
clib_panic ("sigaction");
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 24208617fa4..45b12cd5b77 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -172,7 +172,7 @@ setup_signal_handlers (unix_main_t * um)
for (i = 1; i < 32; i++)
{
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = (void *) unix_signal_handler;
sa.sa_flags = SA_SIGINFO;
diff --git a/src/vlib/unix/mc_socket.c b/src/vlib/unix/mc_socket.c
index 1da19a5e773..c820981dae0 100644
--- a/src/vlib/unix/mc_socket.c
+++ b/src/vlib/unix/mc_socket.c
@@ -85,7 +85,7 @@ sendmsg_helper (mc_socket_main_t * msm,
struct msghdr h;
word n_bytes, n_bytes_tx, n_retries;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
h.msg_name = tx_addr;
h.msg_namelen = sizeof (tx_addr[0]);
@@ -146,7 +146,7 @@ tx_ack (void *transport, mc_peer_id_t dest_peer_id, u32 buffer_index)
vlib_main_t *vm = msm->mc_main.vlib_main;
clib_error_t *error;
- memset (&tx_addr, 0, sizeof (tx_addr));
+ clib_memset (&tx_addr, 0, sizeof (tx_addr));
tx_addr.sin_family = AF_INET;
tx_addr.sin_addr.s_addr = mc_socket_peer_id_get_address (dest_peer_id);
tx_addr.sin_port = mc_socket_peer_id_get_port (dest_peer_id);
@@ -197,7 +197,7 @@ recvmsg_helper (mc_socket_main_t * msm,
{
struct msghdr h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
if (rx_addr)
{
h.msg_name = rx_addr;
@@ -570,7 +570,7 @@ catchup_listen_read_ready (clib_file_t * uf)
clib_file_t template = { 0 };
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (c[0]));
+ clib_memset (c, 0, sizeof (c[0]));
client_len = sizeof (client_addr);
@@ -632,7 +632,7 @@ find_and_bind_to_free_port (word sock, word port)
{
struct sockaddr_in a;
- memset (&a, 0, sizeof (a)); /* Warnings be gone */
+ clib_memset (&a, 0, sizeof (a)); /* Warnings be gone */
a.sin_family = PF_INET;
a.sin_addr.s_addr = INADDR_ANY;
@@ -672,7 +672,7 @@ setup_mutlicast_socket (mc_socket_main_t * msm,
0)
return clib_error_return_unix (0, "%s setsockopt SO_REUSEADDR", type);
- memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
+ clib_memset (&ms->tx_addr, 0, sizeof (ms->tx_addr));
ms->tx_addr.sin_family = AF_INET;
ms->tx_addr.sin_addr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
@@ -682,7 +682,7 @@ setup_mutlicast_socket (mc_socket_main_t * msm,
sizeof (ms->tx_addr)) < 0)
return clib_error_return_unix (0, "%s bind", type);
- memset (&mcast_req, 0, sizeof (mcast_req));
+ clib_memset (&mcast_req, 0, sizeof (mcast_req));
mcast_req.imr_multiaddr.s_addr =
htonl (msm->multicast_tx_ip4_address_host_byte_order);
mcast_req.imr_interface.s_addr = msm->if_ip4_address_net_byte_order;
@@ -852,7 +852,7 @@ catchup_request_fun (void *transport_main,
int one = 1;
pool_get (msm->catchups, c);
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->socket = socket (AF_INET, SOCK_STREAM, 0);
if (c->socket < 0)
@@ -867,7 +867,7 @@ catchup_request_fun (void *transport_main,
return 0;
}
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = mc_socket_peer_id_get_address (catchup_peer_id);
addr.sin_port = mc_socket_peer_id_get_port (catchup_peer_id);
diff --git a/src/vlibapi/api_helper_macros.h b/src/vlibapi/api_helper_macros.h
index 626d8d4fc95..e3241706431 100644
--- a/src/vlibapi/api_helper_macros.h
+++ b/src/vlibapi/api_helper_macros.h
@@ -94,7 +94,7 @@ do { \
if (!rmp) \
return; \
\
- memset (rmp, 0, sizeof (*rmp)); \
+ clib_memset (rmp, 0, sizeof (*rmp)); \
rv = VNET_API_ERROR_TABLE_TOO_BIG; \
is_error = 1; \
} \
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 2c1d4e78289..44b09ee4f73 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -360,7 +360,7 @@ vl_msg_api_trace_configure (api_main_t * am, vl_api_trace_which_t which,
vl_msg_api_trace_free (am, which);
}
- memset (tp, 0, sizeof (*tp));
+ clib_memset (tp, 0, sizeof (*tp));
if (clib_arch_is_big_endian)
{
@@ -709,7 +709,7 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->id = id;
c->name = name;
@@ -730,7 +730,7 @@ vl_msg_api_clean_handlers (int msg_id)
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->id = msg_id;
vl_msg_api_config (c);
diff --git a/src/vlibapi/vat_helper_macros.h b/src/vlibapi/vat_helper_macros.h
index 52fdcb1cb5a..5bc67729d4a 100644
--- a/src/vlibapi/vat_helper_macros.h
+++ b/src/vlibapi/vat_helper_macros.h
@@ -28,7 +28,7 @@ do { \
mp = vl_socket_client_msg_alloc (sizeof(*mp)); \
else \
mp = vl_msg_api_alloc_as_if_client(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T+__plugin_msg_base); \
mp->client_index = vam->my_client_index; \
} while(0);
@@ -42,7 +42,7 @@ do { \
mp = vl_socket_client_msg_alloc (sizeof(*mp)); \
else \
mp = vl_msg_api_alloc_as_if_client(sizeof(*mp)); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T+__plugin_msg_base); \
mp->client_index = vam->my_client_index; \
if (scm) \
@@ -57,7 +57,7 @@ do { \
mp = vl_socket_client_msg_alloc (sizeof(*mp)); \
else \
mp = vl_msg_api_alloc_as_if_client(sizeof(*mp) + n); \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T+__plugin_msg_base); \
mp->client_index = vam->my_client_index; \
} while(0);
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index 1f5da4c786e..a444ec785a7 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -127,7 +127,7 @@ vl_api_memclnt_create_internal (char *name, svm_queue_t * q)
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
- memset (regp, 0, sizeof (*regp));
+ clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
regp->vlib_rp = svm;
@@ -194,7 +194,7 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
- memset (regp, 0, sizeof (*regp));
+ clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
regp->vlib_rp = svm;
@@ -346,7 +346,7 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
oldheap = svm_push_data_heap (svm);
vec_free (regp->name);
/* Poison the old registration */
- memset (regp, 0xF1, sizeof (*regp));
+ clib_memset (regp, 0xF1, sizeof (*regp));
clib_mem_free (regp);
pthread_mutex_unlock (&svm->mutex);
svm_pop_heap (oldheap);
@@ -400,7 +400,7 @@ vl_api_memclnt_keepalive_t_handler (vl_api_memclnt_keepalive_t * mp)
shmem_hdr = am->shmem_hdr;
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_MEMCLNT_KEEPALIVE_REPLY);
rmp->context = mp->context;
vl_msg_api_send_shmem (shmem_hdr->vl_input_queue, (u8 *) & rmp);
@@ -425,7 +425,7 @@ vl_mem_api_init (const char *region_name)
vl_shmem_hdr_t *shm;
vlib_main_t *vm = vlib_get_main ();
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
if ((rv = vl_map_shmem (region_name, 1 /* is_vlib */ )) < 0)
return rv;
@@ -513,7 +513,7 @@ send_memclnt_keepalive (vl_api_registration_t * regp, f64 now)
am->shmem_hdr = regp->shmem_hdr;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MEMCLNT_KEEPALIVE);
mp->context = mp->client_index =
vl_msg_api_handle_from_index_and_epoch
@@ -658,7 +658,7 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
else
{
/* Poison the old registration */
- memset (*regpp, 0xF3, sizeof (**regpp));
+ clib_memset (*regpp, 0xF3, sizeof (**regpp));
clib_mem_free (*regpp);
}
/* no dangling references, please */
@@ -899,7 +899,7 @@ vlibmemory_init (vlib_main_t * vm)
svm_map_region_args_t _a, *a = &_a;
clib_error_t *error;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->root_path = am->root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = (am->global_baseva != 0) ?
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index 07eb83eaa7c..239cbfee36f 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -209,7 +209,7 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
am->vl_input_queue = vl_input_queue;
mp = vl_msg_api_alloc (sizeof (vl_api_memclnt_create_t));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MEMCLNT_CREATE);
mp->ctx_quota = ctx_quota;
mp->input_queue = (uword) vl_input_queue;
@@ -287,7 +287,7 @@ vl_client_disconnect (void)
vl_input_queue = am->vl_input_queue;
mp = vl_msg_api_alloc (sizeof (vl_api_memclnt_delete_t));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MEMCLNT_DELETE);
mp->index = am->my_client_index;
mp->handle = (uword) am->my_registration;
@@ -346,7 +346,7 @@ vl_api_memclnt_keepalive_t_handler (vl_api_memclnt_keepalive_t * mp)
shmem_hdr = am->shmem_hdr;
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_MEMCLNT_KEEPALIVE_REPLY);
rmp->context = mp->context;
vl_msg_api_send_shmem (shmem_hdr->vl_input_queue, (u8 *) & rmp);
@@ -481,7 +481,7 @@ disconnect_from_vlib_internal (u8 do_unmap)
if (do_unmap)
vl_client_api_unmap ();
}
- memset (mm, 0, sizeof (*mm));
+ clib_memset (mm, 0, sizeof (*mm));
}
void
@@ -520,7 +520,7 @@ vl_client_get_first_plugin_msg_id (const char *plugin_name)
if (strlen (plugin_name) + 1 > sizeof (mp->name))
return (rv);
- memset (&clib_time, 0, sizeof (clib_time));
+ clib_memset (&clib_time, 0, sizeof (clib_time));
clib_time_init (&clib_time);
/* Push this plugin's first_msg_id_reply handler */
@@ -535,7 +535,7 @@ vl_client_get_first_plugin_msg_id (const char *plugin_name)
if (!am->my_registration)
{
mp = vl_socket_client_msg_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GET_FIRST_MSG_ID);
mp->client_index = am->my_client_index;
strncpy ((char *) mp->name, plugin_name, sizeof (mp->name) - 1);
@@ -560,7 +560,7 @@ vl_client_get_first_plugin_msg_id (const char *plugin_name)
else
{
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_GET_FIRST_MSG_ID);
mp->client_index = am->my_client_index;
strncpy ((char *) mp->name, plugin_name, sizeof (mp->name) - 1);
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 084d0b77b62..0604b0a1cdf 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -518,7 +518,7 @@ vl_map_shmem (const char *region_name, int is_vlib)
struct timespec ts, tsrem;
char *vpe_api_region_suffix = "-vpe-api";
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
if (strstr (region_name, vpe_api_region_suffix))
{
@@ -590,7 +590,7 @@ vl_map_shmem (const char *region_name, int is_vlib)
ts = tsrem;
}
/* Mutex buggered, "fix" it */
- memset (&q->mutex, 0, sizeof (q->mutex));
+ clib_memset (&q->mutex, 0, sizeof (q->mutex));
clib_warning ("forcibly release main input queue mutex");
mutex_ok:
diff --git a/src/vlibmemory/socket_api.c b/src/vlibmemory/socket_api.c
index f3cd169d2c0..3cf2a1cfe74 100644
--- a/src/vlibmemory/socket_api.c
+++ b/src/vlibmemory/socket_api.c
@@ -381,7 +381,7 @@ socksvr_file_add (clib_file_main_t * fm, int fd)
clib_file_t template = { 0 };
pool_get (socket_main.registration_pool, rp);
- memset (rp, 0, sizeof (*rp));
+ clib_memset (rp, 0, sizeof (*rp));
template.read_function = vl_socket_read_ready;
template.write_function = vl_socket_write_ready;
@@ -506,7 +506,7 @@ vl_sock_api_send_fd_msg (int socket_fd, int fds[], int n_fds)
mh.msg_iov = iov;
mh.msg_iovlen = 1;
- memset (&ctl, 0, sizeof (ctl));
+ clib_memset (&ctl, 0, sizeof (ctl));
mh.msg_control = ctl;
mh.msg_controllen = sizeof (ctl);
cmsg = CMSG_FIRSTHDR (&mh);
@@ -609,7 +609,7 @@ vl_api_sock_init_shm_t_handler (vl_api_sock_init_shm_t * mp)
* Set up a memfd segment of the requested size wherein the
* shmem data structures will be initialized
*/
- memset (memfd, 0, sizeof (*memfd));
+ clib_memset (memfd, 0, sizeof (*memfd));
memfd->ssvm_size = mp->requested_size;
memfd->requested_va = 0ULL;
memfd->i_am_master = 1;
@@ -624,7 +624,7 @@ vl_api_sock_init_shm_t_handler (vl_api_sock_init_shm_t * mp)
/*
* Create a plausible svm_region in the memfd backed segment
*/
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->baseva = memfd->sh->ssvm_va + MMAP_PAGESIZE;
a->size = memfd->ssvm_size - MMAP_PAGESIZE;
/* $$$$ might want a different config parameter */
@@ -729,7 +729,7 @@ vl_sock_api_init (vlib_main_t * vm)
return error;
pool_get (sm->registration_pool, rp);
- memset (rp, 0, sizeof (*rp));
+ clib_memset (rp, 0, sizeof (*rp));
rp->registration_type = REGISTRATION_TYPE_SOCKET_LISTEN;
diff --git a/src/vlibmemory/socket_client.c b/src/vlibmemory/socket_client.c
index c04b804eb21..febb737ac2d 100644
--- a/src/vlibmemory/socket_client.c
+++ b/src/vlibmemory/socket_client.c
@@ -214,7 +214,7 @@ vl_sock_api_recv_fd_msg (int socket_fd, int fds[], int n_fds, u32 wait)
mh.msg_control = ctl;
mh.msg_controllen = sizeof (ctl);
- memset (ctl, 0, sizeof (ctl));
+ clib_memset (ctl, 0, sizeof (ctl));
if (wait != ~0)
{
@@ -282,7 +282,7 @@ static void vl_api_sock_init_shm_reply_t_handler
return;
}
- memset (memfd, 0, sizeof (*memfd));
+ clib_memset (memfd, 0, sizeof (*memfd));
memfd->fd = my_fd;
/* Note: this closes memfd.fd */
@@ -404,7 +404,7 @@ vl_socket_client_init_shm (vl_api_shm_elem_config_t * config)
mp = vl_socket_client_msg_alloc (sizeof (*mp) +
vec_len (config) * sizeof (u64));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_SOCK_INIT_SHM);
mp->client_index = clib_host_to_net_u32 (scm->client_index);
mp->requested_size = 64 << 20;
diff --git a/src/vlibmemory/vlib_api.c b/src/vlibmemory/vlib_api.c
index 15a0ba82f12..b72f1335c29 100644
--- a/src/vlibmemory/vlib_api.c
+++ b/src/vlibmemory/vlib_api.c
@@ -143,7 +143,7 @@ vl_api_api_versions_t_handler (vl_api_api_versions_t * mp)
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id = ntohs (VL_API_API_VERSIONS_REPLY);
/* fill in the message */
@@ -178,7 +178,7 @@ vlib_api_init (void)
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
#define _(N,n) do { \
c->id = VL_API_##N; \
@@ -213,7 +213,7 @@ send_one_plugin_msg_ids_msg (u8 * name, u16 first_msg_id, u16 last_msg_id)
svm_queue_t *q;
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_TRACE_PLUGIN_MSG_IDS);
strncpy ((char *) mp->plugin_name, (char *) name,
@@ -620,7 +620,7 @@ vl_api_rpc_call_main_thread_inline (void *fp, u8 * data, u32 data_length,
/* Otherwise, actually do an RPC */
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp) + data_length);
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
clib_memcpy (mp->data, data, data_length);
mp->_vl_msg_id = ntohs (VL_API_RPC_CALL);
mp->function = pointer_to_uword (fp);
diff --git a/src/vlibmemory/vlib_api_cli.c b/src/vlibmemory/vlib_api_cli.c
index d6eca598d75..69c4f92df4a 100644
--- a/src/vlibmemory/vlib_api_cli.c
+++ b/src/vlibmemory/vlib_api_cli.c
@@ -535,7 +535,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename,
/* Copy the buffer (from the read-only mmap'ed file) */
vec_validate (tmpbuf, size - 1 + sizeof (uword));
clib_memcpy (tmpbuf + sizeof (uword), msg, size);
- memset (tmpbuf, 0xf, sizeof (uword));
+ clib_memset (tmpbuf, 0xf, sizeof (uword));
/*
* Endian swap if needed. All msg data is supposed to be
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c
index a06a12210bc..8740bb41465 100644
--- a/src/vnet/adj/adj.c
+++ b/src/vnet/adj/adj.c
@@ -50,7 +50,7 @@ adj_poison (ip_adjacency_t * adj)
{
if (CLIB_DEBUG > 0)
{
- memset (adj, 0xfe, sizeof (adj[0]));
+ clib_memset (adj, 0xfe, sizeof (adj[0]));
}
}
@@ -80,7 +80,7 @@ adj_alloc (fib_protocol_t proto)
adj->ia_delegates = NULL;
/* lest it become a midchain in the future */
- memset(&adj->sub_type.midchain.next_dpo, 0,
+ clib_memset(&adj->sub_type.midchain.next_dpo, 0,
sizeof(adj->sub_type.midchain.next_dpo));
return (adj);
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 3b1eb4962d0..ff535295b4b 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -59,7 +59,7 @@ adj_nbr_insert (fib_protocol_t nh_proto,
adj_nbr_tables[nh_proto][sw_if_index] =
clib_mem_alloc_aligned(sizeof(BVT(clib_bihash)),
CLIB_CACHE_LINE_BYTES);
- memset(adj_nbr_tables[nh_proto][sw_if_index],
+ clib_memset(adj_nbr_tables[nh_proto][sw_if_index],
0,
sizeof(BVT(clib_bihash)));
diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h
index 0d4b0b9fd28..42b982e1bf4 100644
--- a/src/vnet/adj/rewrite.h
+++ b/src/vnet/adj/rewrite.h
@@ -115,24 +115,24 @@ struct { \
always_inline void
vnet_rewrite_clear_data_internal (vnet_rewrite_header_t * rw, int max_size)
{
- /* Sanity check values carefully for this memset operation */
+ /* Sanity check values carefully for this clib_memset operation */
ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE));
rw->data_bytes = 0;
- memset (rw->data, 0xfe, max_size);
+ clib_memset (rw->data, 0xfe, max_size);
}
always_inline void
vnet_rewrite_set_data_internal (vnet_rewrite_header_t * rw,
int max_size, void *data, int data_bytes)
{
- /* Sanity check values carefully for this memset operation */
+ /* Sanity check values carefully for this clib_memset operation */
ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE));
ASSERT ((data_bytes >= 0) && (data_bytes < max_size));
rw->data_bytes = data_bytes;
clib_memcpy (rw->data + max_size - data_bytes, data, data_bytes);
- memset (rw->data, 0xfe, max_size - data_bytes);
+ clib_memset (rw->data, 0xfe, max_size - data_bytes);
}
#define vnet_rewrite_set_data(rw,data,data_bytes) \
diff --git a/src/vnet/bfd/bfd_api.c b/src/vnet/bfd/bfd_api.c
index fcd66950114..bb852256ad7 100644
--- a/src/vnet/bfd/bfd_api.c
+++ b/src/vnet/bfd/bfd_api.c
@@ -67,9 +67,9 @@ pub_sub_handler (bfd_events, BFD_EVENTS);
#define BFD_UDP_API_PARAM_COMMON_CODE \
ip46_address_t local_addr; \
- memset (&local_addr, 0, sizeof (local_addr)); \
+ clib_memset (&local_addr, 0, sizeof (local_addr)); \
ip46_address_t peer_addr; \
- memset (&peer_addr, 0, sizeof (peer_addr)); \
+ clib_memset (&peer_addr, 0, sizeof (peer_addr)); \
if (mp->is_ipv6) \
{ \
clib_memcpy (&local_addr.ip6, mp->local_addr, sizeof (local_addr.ip6)); \
@@ -151,7 +151,7 @@ send_bfd_udp_session_details (vl_api_registration_t * reg, u32 context,
}
vl_api_bfd_udp_session_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_BFD_UDP_SESSION_DETAILS);
mp->context = context;
mp->state = bs->local_state;
@@ -286,7 +286,7 @@ vl_api_bfd_auth_keys_dump_t_handler (vl_api_bfd_auth_keys_dump_t * mp)
/* *INDENT-OFF* */
pool_foreach (key, bfd_main.auth_keys, ({
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_BFD_AUTH_KEYS_DETAILS);
rmp->context = mp->context;
rmp->conf_key_id = clib_host_to_net_u32 (key->conf_key_id);
diff --git a/src/vnet/bfd/bfd_main.c b/src/vnet/bfd/bfd_main.c
index bd2addf3b0f..ea584130d58 100644
--- a/src/vnet/bfd/bfd_main.c
+++ b/src/vnet/bfd/bfd_main.c
@@ -774,7 +774,7 @@ bfd_add_sha1_auth_section (vlib_buffer_t * b, bfd_session_t * bs)
b->current_length += sizeof (*auth);
pkt->pkt.head.length += sizeof (*auth);
bfd_pkt_set_auth_present (&pkt->pkt);
- memset (auth, 0, sizeof (*auth));
+ clib_memset (auth, 0, sizeof (*auth));
auth->type_len.type = bs->auth.curr_key->auth_type;
/*
* only meticulous authentication types require incrementing seq number
@@ -860,7 +860,7 @@ bfd_init_control_frame (bfd_main_t * bm, bfd_session_t * bs,
bfd_pkt_t *pkt = vlib_buffer_get_current (b);
u32 bfd_length = 0;
bfd_length = sizeof (bfd_pkt_t);
- memset (pkt, 0, sizeof (*pkt));
+ clib_memset (pkt, 0, sizeof (*pkt));
bfd_pkt_set_version (pkt, 1);
bfd_pkt_set_diag_code (pkt, bs->local_diag);
bfd_pkt_set_state (pkt, bs->local_state);
@@ -908,10 +908,10 @@ bfd_send_echo (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
ASSERT (b->current_data == 0);
- memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
+ clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
bfd_echo_pkt_t *pkt = vlib_buffer_get_current (b);
- memset (pkt, 0, sizeof (*pkt));
+ clib_memset (pkt, 0, sizeof (*pkt));
pkt->discriminator = bs->local_discr;
pkt->expire_time_clocks =
now + bs->echo_transmit_interval_clocks * bs->local_detect_mult;
@@ -982,7 +982,7 @@ bfd_send_periodic (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
ASSERT (b->current_data == 0);
- memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
+ clib_memset (vnet_buffer (b), 0, sizeof (*vnet_buffer (b)));
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
bfd_init_control_frame (bm, bs, b);
switch (bs->poll_state)
@@ -1315,7 +1315,7 @@ bfd_main_init (vlib_main_t * vm)
bm->random_seed = random_default_seed ();
bm->vlib_main = vm;
bm->vnet_main = vnet_get_main ();
- memset (&bm->wheel, 0, sizeof (bm->wheel));
+ clib_memset (&bm->wheel, 0, sizeof (bm->wheel));
bm->cpu_cps = vm->clib_time.clocks_per_second;
BFD_DBG ("cps is %.2f", bm->cpu_cps);
bm->default_desired_min_tx_clocks =
@@ -1343,7 +1343,7 @@ bfd_get_session (bfd_main_t * bm, bfd_transport_e t)
bfd_lock (bm);
pool_get (bm->sessions, result);
- memset (result, 0, sizeof (*result));
+ clib_memset (result, 0, sizeof (*result));
result->bs_idx = result - bm->sessions;
result->transport = t;
const unsigned limit = 1000;
@@ -2207,7 +2207,7 @@ bfd_auth_set_key (u32 conf_key_id, u8 auth_type, u8 key_len,
auth_key - bm->auth_keys);
}
auth_key->auth_type = auth_type;
- memset (auth_key->key, 0, sizeof (auth_key->key));
+ clib_memset (auth_key->key, 0, sizeof (auth_key->key));
clib_memcpy (auth_key->key, key_data, key_len);
return 0;
#else
@@ -2238,7 +2238,7 @@ bfd_auth_del_key (u32 conf_key_id)
return VNET_API_ERROR_BFD_EINUSE;
}
hash_unset (bm->auth_key_by_conf_key_id, conf_key_id);
- memset (auth_key, 0, sizeof (*auth_key));
+ clib_memset (auth_key, 0, sizeof (*auth_key));
pool_put (bm->auth_keys, auth_key);
}
else
diff --git a/src/vnet/bfd/bfd_udp.c b/src/vnet/bfd/bfd_udp.c
index ab530edcd7d..0da19bdb630 100644
--- a/src/vnet/bfd/bfd_udp.c
+++ b/src/vnet/bfd/bfd_udp.c
@@ -261,7 +261,7 @@ bfd_add_udp4_transport (vlib_main_t * vm, u32 bi, const bfd_session_t * bs,
ip4_udp_headers *headers = NULL;
vlib_buffer_advance (b, -sizeof (*headers));
headers = vlib_buffer_get_current (b);
- memset (headers, 0, sizeof (*headers));
+ clib_memset (headers, 0, sizeof (*headers));
headers->ip4.ip_version_and_header_length = 0x45;
headers->ip4.ttl = 255;
headers->ip4.protocol = IP_PROTOCOL_UDP;
@@ -316,7 +316,7 @@ bfd_add_udp6_transport (vlib_main_t * vm, u32 bi, const bfd_session_t * bs,
ip6_udp_headers *headers = NULL;
vlib_buffer_advance (b, -sizeof (*headers));
headers = vlib_buffer_get_current (b);
- memset (headers, 0, sizeof (*headers));
+ clib_memset (headers, 0, sizeof (*headers));
headers->ip6.ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (0x6 << 28);
headers->ip6.hop_limit = 255;
@@ -448,7 +448,7 @@ bfd_udp_key_init (bfd_udp_key_t * key, u32 sw_if_index,
const ip46_address_t * local_addr,
const ip46_address_t * peer_addr)
{
- memset (key, 0, sizeof (*key));
+ clib_memset (key, 0, sizeof (*key));
key->sw_if_index = sw_if_index;
key->local_addr.as_u64[0] = local_addr->as_u64[0];
key->local_addr.as_u64[1] = local_addr->as_u64[1];
@@ -476,7 +476,7 @@ bfd_udp_add_session_internal (bfd_udp_main_t * bum, u32 sw_if_index,
return VNET_API_ERROR_BFD_EAGAIN;
}
bfd_udp_session_t *bus = &bs->udp;
- memset (bus, 0, sizeof (*bus));
+ clib_memset (bus, 0, sizeof (*bus));
bfd_udp_key_t *key = &bus->key;
bfd_udp_key_init (key, sw_if_index, local_addr, peer_addr);
const bfd_session_t *tmp = bfd_lookup_session (bum, key);
@@ -1002,7 +1002,7 @@ bfd_udp4_scan (vlib_main_t * vm, vlib_node_runtime_t * rt,
else
{
bfd_udp_key_t key;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
key.local_addr.ip4.as_u32 = ip4->dst_address.as_u32;
key.peer_addr.ip4.as_u32 = ip4->src_address.as_u32;
@@ -1144,7 +1144,7 @@ bfd_udp6_scan (vlib_main_t * vm, vlib_node_runtime_t * rt,
else
{
bfd_udp_key_t key;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
key.local_addr.ip6.as_u64[0] = ip6->dst_address.as_u64[0];
key.local_addr.ip6.as_u64[1] = ip6->dst_address.as_u64[1];
@@ -1239,7 +1239,7 @@ bfd_udp_input (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
b0->current_data = 0;
b0->current_length = 0;
- memset (vnet_buffer (b0), 0, sizeof (*vnet_buffer (b0)));
+ clib_memset (vnet_buffer (b0), 0, sizeof (*vnet_buffer (b0)));
bfd_init_final_control_frame (vm, b0, bfd_udp_main.bfd_main, bs,
0);
if (is_ipv6)
diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c
index 2e8fc626baa..b4bde3a97eb 100644
--- a/src/vnet/bier/bier_api.c
+++ b/src/vnet/bier/bier_api.c
@@ -123,7 +123,7 @@ send_bier_table_details (vl_api_registration_t * reg,
mp = vl_msg_api_alloc(sizeof(*mp));
if (!mp)
return;
- memset(mp, 0, sizeof(*mp));
+ clib_memset(mp, 0, sizeof(*mp));
mp->_vl_msg_id = ntohs(VL_API_BIER_TABLE_DETAILS);
mp->context = context;
@@ -254,7 +254,7 @@ send_bier_route_details (const bier_table_t *bt,
if (!mp)
return;
- memset(mp, 0, m_size);
+ clib_memset(mp, 0, m_size);
mp->_vl_msg_id = ntohs(VL_API_BIER_ROUTE_DETAILS);
mp->context = ctx->context;
@@ -373,7 +373,7 @@ send_bier_imp_details (vl_api_registration_t * reg,
mp = vl_msg_api_alloc(sizeof(*mp) + n_bytes);
if (!mp)
return;
- memset(mp, 0, sizeof(*mp)+n_bytes);
+ clib_memset(mp, 0, sizeof(*mp)+n_bytes);
mp->_vl_msg_id = ntohs(VL_API_BIER_IMP_DETAILS);
mp->context = context;
@@ -440,7 +440,7 @@ send_bier_disp_table_details (vl_api_registration_t * reg,
mp = vl_msg_api_alloc(sizeof(*mp));
if (!mp)
return;
- memset(mp, 0, sizeof(*mp));
+ clib_memset(mp, 0, sizeof(*mp));
mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_TABLE_DETAILS);
mp->context = context;
@@ -616,7 +616,7 @@ send_bier_disp_entry_details (const bier_disp_table_t *bdt,
if (!mp)
return;
- memset(mp, 0, m_size);
+ clib_memset(mp, 0, m_size);
mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_ENTRY_DETAILS);
mp->context = ctx->context;
diff --git a/src/vnet/bier/bier_bift_table.c b/src/vnet/bier/bier_bift_table.c
index cf0d552f192..76e29dc9e52 100644
--- a/src/vnet/bier/bier_bift_table.c
+++ b/src/vnet/bier/bier_bift_table.c
@@ -54,7 +54,7 @@ bier_bift_table_entry_add (bier_bift_id_t id,
*/
bier_bift_table = clib_mem_alloc_aligned(sizeof(*bier_bift_table),
CLIB_CACHE_LINE_BYTES);
- memset(bier_bift_table, 0, sizeof(*bier_bift_table));
+ clib_memset(bier_bift_table, 0, sizeof(*bier_bift_table));
for (ii = 0; ii < BIER_BIFT_N_ENTRIES; ii++)
{
diff --git a/src/vnet/bier/bier_disp_table.c b/src/vnet/bier/bier_disp_table.c
index 68edb088400..cf9f0538df7 100644
--- a/src/vnet/bier/bier_disp_table.c
+++ b/src/vnet/bier/bier_disp_table.c
@@ -75,7 +75,7 @@ bier_disp_table_add_or_lock (u32 table_id)
/**
* Set the result for each entry in the DB to be invalid
*/
- memset(bdt->bdt_db, 0xff, sizeof(bdt->bdt_db));
+ clib_memset(bdt->bdt_db, 0xff, sizeof(bdt->bdt_db));
}
else
{
diff --git a/src/vnet/bier/bier_fmask.c b/src/vnet/bier/bier_fmask.c
index 3370d5a88e8..1ca8a2e1df9 100644
--- a/src/vnet/bier/bier_fmask.c
+++ b/src/vnet/bier/bier_fmask.c
@@ -54,7 +54,7 @@ bier_fmask_bits_init (bier_fmask_bits_t *bits,
{
bits->bfmb_refs = clib_mem_alloc(sizeof(bits->bfmb_refs[0]) *
bier_hdr_len_id_to_num_bits(hlid));
- memset(bits->bfmb_refs,
+ clib_memset(bits->bfmb_refs,
0,
(sizeof(bits->bfmb_refs[0]) *
bier_hdr_len_id_to_num_bits(hlid)));
@@ -70,7 +70,7 @@ bier_fmask_bits_init (bier_fmask_bits_t *bits,
sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) *
bier_hdr_len_id_to_num_buckets(hlid),
CLIB_CACHE_LINE_BYTES);
- memset(bits->bfmb_input_reset_string.bbs_buckets,
+ clib_memset(bits->bfmb_input_reset_string.bbs_buckets,
0,
sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) *
bier_hdr_len_id_to_num_buckets(hlid));
@@ -171,7 +171,7 @@ bier_fmask_init (bier_fmask_t *bfm,
fib_route_path_t *rpaths;
mpls_label_t olabel;
- memset(bfm, 0, sizeof(*bfm));
+ clib_memset(bfm, 0, sizeof(*bfm));
bfm->bfm_id = clib_mem_alloc(sizeof(*bfm->bfm_id));
@@ -411,7 +411,7 @@ bier_fmask_encode (index_t bfmi,
bfm = bier_fmask_get(bfmi);
*btid = *bier_table_get_id(bfm->bfm_id->bfmi_bti);
- memset(rpath, 0, sizeof(*rpath));
+ clib_memset(rpath, 0, sizeof(*rpath));
rpath->rpath.frp_sw_if_index = ~0;
diff --git a/src/vnet/bier/bier_fmask_db.c b/src/vnet/bier/bier_fmask_db.c
index 59e2973b589..0ee1e5d6bf8 100644
--- a/src/vnet/bier/bier_fmask_db.c
+++ b/src/vnet/bier/bier_fmask_db.c
@@ -60,7 +60,7 @@ bier_fmask_db_mk_key (index_t bti,
* Depending on what the ID is there may be padding.
* This key will be memcmp'd in the mhash, so make sure it's all 0
*/
- memset(key, 0, sizeof(*key));
+ clib_memset(key, 0, sizeof(*key));
/*
* Pick the attributes from the path that make the FMask unique
diff --git a/src/vnet/bier/bier_hdr_inlines.h b/src/vnet/bier/bier_hdr_inlines.h
index d58926e97ef..81e196d4c0b 100644
--- a/src/vnet/bier/bier_hdr_inlines.h
+++ b/src/vnet/bier/bier_hdr_inlines.h
@@ -175,7 +175,7 @@ bier_hdr_get_proto_id (const bier_hdr_t *bier_hdr)
static inline void
bier_hdr_clear (bier_hdr_t *bier_hdr)
{
- memset(&bier_hdr->bh_bit_string, 0,
+ clib_memset(&bier_hdr->bh_bit_string, 0,
bier_hdr_len_id_to_num_buckets(
bier_hdr_get_len_id(bier_hdr)));
}
diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c
index 06160f60aab..d15ee595b64 100644
--- a/src/vnet/bier/bier_test.c
+++ b/src/vnet/bier/bier_test.c
@@ -742,7 +742,7 @@ bier_test_mpls_imp (void)
*/
bier_bit_string_t bbs_256;
u8 buckets[BIER_HDR_BUCKETS_256];
- memset(buckets, 0x5, BIER_HDR_BUCKETS_256);
+ clib_memset(buckets, 0x5, BIER_HDR_BUCKETS_256);
res = 0;
bier_bit_string_init(&bbs_256, BIER_HDR_LEN_256, buckets);
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c
index 02536e966a1..691697cf4fe 100644
--- a/src/vnet/bonding/bond_api.c
+++ b/src/vnet/bonding/bond_api.c
@@ -59,7 +59,7 @@ bond_send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -104,7 +104,7 @@ vl_api_bond_create_t_handler (vl_api_bond_create_t * mp)
unix_shared_memory_queue_t *q;
bond_create_if_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
if (mp->use_custom_mac)
{
@@ -139,7 +139,7 @@ vl_api_bond_enslave_t_handler (vl_api_bond_enslave_t * mp)
unix_shared_memory_queue_t *q;
bond_enslave_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->group = ntohl (mp->bond_sw_if_index);
ap->slave = ntohl (mp->sw_if_index);
@@ -168,7 +168,7 @@ vl_api_bond_detach_slave_t_handler (vl_api_bond_detach_slave_t * mp)
unix_shared_memory_queue_t *q;
bond_detach_slave_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->slave = ntohl (mp->sw_if_index);
bond_detach_slave (vm, ap);
@@ -194,7 +194,7 @@ bond_send_sw_interface_details (vpe_api_main_t * am,
vl_api_sw_interface_bond_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_BOND_DETAILS);
mp->sw_if_index = htonl (bond_if->sw_if_index);
clib_memcpy (mp->interface_name, bond_if->interface_name,
@@ -243,7 +243,7 @@ bond_send_sw_interface_slave_details (vpe_api_main_t * am,
vl_api_sw_interface_slave_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_SLAVE_DETAILS);
mp->sw_if_index = htonl (slave_if->sw_if_index);
clib_memcpy (mp->interface_name, slave_if->interface_name,
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index ae046e640db..14c52f70b0b 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -91,7 +91,7 @@ bond_dump_ifs (bond_interface_details_t ** out_bondifs)
/* *INDENT-OFF* */
pool_foreach (bif, bm->interfaces,
vec_add2(r_bondifs, bondif, 1);
- memset (bondif, 0, sizeof (*bondif));
+ clib_memset (bondif, 0, sizeof (*bondif));
bondif->sw_if_index = bif->sw_if_index;
hi = vnet_get_hw_interface (vnm, bif->hw_if_index);
clib_memcpy(bondif->interface_name, hi->name,
@@ -129,7 +129,7 @@ bond_dump_slave_ifs (slave_interface_details_t ** out_slaveifs,
vec_foreach (sw_if_index, bif->slaves)
{
vec_add2 (r_slaveifs, slaveif, 1);
- memset (slaveif, 0, sizeof (*slaveif));
+ clib_memset (slaveif, 0, sizeof (*slaveif));
sif = bond_get_slave_by_sw_if_index (*sw_if_index);
if (sif)
{
@@ -231,7 +231,7 @@ bond_delete_if (vlib_main_t * vm, u32 sw_if_index)
clib_bitmap_free (bif->port_number_bitmap);
hash_unset (bm->bond_by_sw_if_index, bif->sw_if_index);
- memset (bif, 0, sizeof (*bif));
+ clib_memset (bif, 0, sizeof (*bif));
pool_put (bm->interfaces, bif);
return 0;
@@ -264,7 +264,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
return;
}
pool_get (bm->interfaces, bif);
- memset (bif, 0, sizeof (*bif));
+ clib_memset (bif, 0, sizeof (*bif));
bif->dev_instance = bif - bm->interfaces;
bif->lb = args->lb;
bif->mode = args->mode;
@@ -449,7 +449,7 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
return;
}
pool_get (bm->neighbors, sif);
- memset (sif, 0, sizeof (*sif));
+ clib_memset (sif, 0, sizeof (*sif));
sw = pool_elt_at_index (im->sw_interfaces, args->slave);
sif->port_enabled = sw->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP;
sif->sw_if_index = sw->sw_if_index;
diff --git a/src/vnet/classify/classify_api.c b/src/vnet/classify/classify_api.c
index 6397b10fbd6..08defd4ecdd 100644
--- a/src/vnet/classify/classify_api.c
+++ b/src/vnet/classify/classify_api.c
@@ -213,7 +213,7 @@ send_policer_classify_details (u32 sw_if_index,
vl_api_policer_classify_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
@@ -395,7 +395,7 @@ send_classify_session_details (vl_api_registration_t * reg,
vl_api_classify_session_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
rmp->context = context;
rmp->table_id = ntohl (table_id);
@@ -489,7 +489,7 @@ send_flow_classify_details (u32 sw_if_index,
vl_api_flow_classify_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index 52cabbc7f42..36f967a38ac 100644
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -128,7 +128,7 @@ vnet_classify_new_table (vnet_classify_main_t * cm,
nbuckets = 1 << (max_log2 (nbuckets));
pool_get_aligned (cm->tables, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
vec_validate_aligned (t->mask, match_n_vectors - 1, sizeof (u32x4));
clib_memcpy (t->mask, mask, match_n_vectors * sizeof (u32x4));
@@ -211,7 +211,7 @@ vnet_classify_entry_alloc (vnet_classify_table_t * t, u32 log2_pages)
initialize:
ASSERT (rv);
- memset (rv, 0xff, required_length);
+ clib_memset (rv, 0xff, required_length);
return rv;
}
@@ -536,8 +536,8 @@ vnet_classify_add_del (vnet_classify_table_t * t,
(v->key, add_v->key, t->match_n_vectors * sizeof (u32x4)))
{
vnet_classify_entry_release_resource (v);
- memset (v, 0xff, sizeof (vnet_classify_entry_t) +
- t->match_n_vectors * sizeof (u32x4));
+ clib_memset (v, 0xff, sizeof (vnet_classify_entry_t) +
+ t->match_n_vectors * sizeof (u32x4));
v->flags |= VNET_CLASSIFY_ENTRY_FREE;
CLIB_MEMORY_BARRIER ();
@@ -845,7 +845,7 @@ unformat_tcp_mask (unformat_input_t * input, va_list * args)
tcp = (tcp_header_t *) mask;
-#define _(a) if (a) memset (&tcp->a, 0xff, sizeof (tcp->a));
+#define _(a) if (a) clib_memset (&tcp->a, 0xff, sizeof (tcp->a));
foreach_tcp_proto_field;
#undef _
@@ -886,7 +886,7 @@ unformat_udp_mask (unformat_input_t * input, va_list * args)
udp = (udp_header_t *) mask;
-#define _(a) if (a) memset (&udp->a, 0xff, sizeof (udp->a));
+#define _(a) if (a) clib_memset (&udp->a, 0xff, sizeof (udp->a));
foreach_udp_proto_field;
#undef _
@@ -981,7 +981,7 @@ unformat_ip4_mask (unformat_input_t * input, va_list * args)
ip = (ip4_header_t *) mask;
-#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a));
+#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a));
foreach_ip4_proto_field;
#undef _
@@ -1053,7 +1053,7 @@ unformat_ip6_mask (unformat_input_t * input, va_list * args)
ip = (ip6_header_t *) mask;
-#define _(a) if (a) memset (&ip->a, 0xff, sizeof (ip->a));
+#define _(a) if (a) clib_memset (&ip->a, 0xff, sizeof (ip->a));
foreach_ip6_proto_field;
#undef _
@@ -1149,10 +1149,10 @@ unformat_l2_mask (unformat_input_t * input, va_list * args)
vec_validate (mask, len - 1);
if (dst)
- memset (mask, 0xff, 6);
+ clib_memset (mask, 0xff, 6);
if (src)
- memset (mask + 6, 0xff, 6);
+ clib_memset (mask + 6, 0xff, 6);
if (tag2 || dot1ad)
{
@@ -2501,7 +2501,7 @@ test_classify_churn (test_classify_main_t * tm)
data = (classify_data_or_mask_t *) dp;
/* Mask on src address */
- memset (&mask->ip.src_address, 0xff, 4);
+ clib_memset (&mask->ip.src_address, 0xff, 4);
tmp = clib_host_to_net_u32 (tm->src.as_u32);
diff --git a/src/vnet/config.c b/src/vnet/config.c
index 26b0cad6055..9beda4a5706 100644
--- a/src/vnet/config.c
+++ b/src/vnet/config.c
@@ -167,7 +167,7 @@ vnet_config_init (vlib_main_t * vm,
vlib_node_t *n;
u32 i;
- memset (cm, 0, sizeof (cm[0]));
+ clib_memset (cm, 0, sizeof (cm[0]));
cm->config_string_hash =
hash_create_vec (0,
diff --git a/src/vnet/cop/cop.c b/src/vnet/cop/cop.c
index 465d6c97a2a..700bd7348ed 100644
--- a/src/vnet/cop/cop.c
+++ b/src/vnet/cop/cop.c
@@ -27,7 +27,7 @@ cop_sw_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
int address_family;
u32 ci, default_next;
- memset (data, 0, sizeof(*data));
+ clib_memset (data, 0, sizeof(*data));
/*
* Ignore local interface, pg interfaces. $$$ need a #define for the
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index f1a7b6ad21c..e58f2782765 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -143,7 +143,7 @@ create_packet_v2_sock (int host_if_index, tpacket_req_t * rx_req,
}
/* bind before rx ring is cfged so we don't receive packets from other interfaces */
- memset (&sll, 0, sizeof (sll));
+ clib_memset (&sll, 0, sizeof (sll));
sll.sll_family = PF_PACKET;
sll.sll_protocol = htons (ETH_P_ALL);
sll.sll_ifindex = host_if_index;
@@ -350,7 +350,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
if (error)
{
- memset (apif, 0, sizeof (*apif));
+ clib_memset (apif, 0, sizeof (*apif));
pool_put (apm->interfaces, apif);
vlib_log_err (apm->log_class, "Unable to register interface: %U",
format_clib_error, error);
@@ -502,7 +502,7 @@ af_packet_init (vlib_main_t * vm)
af_packet_main_t *apm = &af_packet_main;
vlib_thread_main_t *tm = vlib_get_thread_main ();
- memset (apm, 0, sizeof (af_packet_main_t));
+ clib_memset (apm, 0, sizeof (af_packet_main_t));
mhash_init_vec_string (&apm->if_index_by_host_if_name, sizeof (uword));
diff --git a/src/vnet/devices/af_packet/af_packet_api.c b/src/vnet/devices/af_packet/af_packet_api.c
index 3e03b5917fe..3dc18b1e96a 100644
--- a/src/vnet/devices/af_packet/af_packet_api.c
+++ b/src/vnet/devices/af_packet/af_packet_api.c
@@ -111,7 +111,7 @@ af_packet_send_details (vpe_api_main_t * am,
{
vl_api_af_packet_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_AF_PACKET_DETAILS);
mp->sw_if_index = htonl (af_packet_if->sw_if_index);
clib_memcpy (mp->host_if_name, af_packet_if->host_if_name,
diff --git a/src/vnet/devices/netlink.c b/src/vnet/devices/netlink.c
index 1d44f287bdc..a954fef74fd 100644
--- a/src/vnet/devices/netlink.c
+++ b/src/vnet/devices/netlink.c
@@ -38,7 +38,7 @@ vnet_netlink_msg_init (vnet_netlink_msg_t * m, u16 type, u16 flags,
{
struct nlmsghdr *nh;
u8 *p;
- memset (m, 0, sizeof (vnet_netlink_msg_t));
+ clib_memset (m, 0, sizeof (vnet_netlink_msg_t));
vec_add2 (m->data, p, NLMSG_SPACE (msg_len));
ASSERT (m->data == p);
diff --git a/src/vnet/devices/netmap/netmap.c b/src/vnet/devices/netmap/netmap.c
index 25a3af73451..03d96216bb0 100644
--- a/src/vnet/devices/netmap/netmap.c
+++ b/src/vnet/devices/netmap/netmap.c
@@ -80,7 +80,7 @@ close_netmap_if (netmap_main_t * nm, netmap_if_t * nif)
vec_free (nif->host_if_name);
vec_free (nif->req);
- memset (nif, 0, sizeof (*nif));
+ clib_memset (nif, 0, sizeof (*nif));
pool_put (nm->interfaces, nif);
}
@@ -280,7 +280,7 @@ netmap_init (vlib_main_t * vm)
vlib_thread_registration_t *tr;
uword *p;
- memset (nm, 0, sizeof (netmap_main_t));
+ clib_memset (nm, 0, sizeof (netmap_main_t));
nm->input_cpu_first_index = 0;
nm->input_cpu_count = 1;
diff --git a/src/vnet/devices/pipe/pipe.c b/src/vnet/devices/pipe/pipe.c
index 6154a66f5c4..8b30f4705d6 100644
--- a/src/vnet/devices/pipe/pipe.c
+++ b/src/vnet/devices/pipe/pipe.c
@@ -527,7 +527,7 @@ pipe_create_sub_interface (vnet_hw_interface_t * hi,
{
vnet_sw_interface_t template;
- memset (&template, 0, sizeof (template));
+ clib_memset (&template, 0, sizeof (template));
template.type = VNET_SW_INTERFACE_TYPE_PIPE;
template.flood_class = VNET_FLOOD_CLASS_NORMAL;
template.sup_sw_if_index = hi->sw_if_index;
@@ -557,7 +557,7 @@ vnet_create_pipe_interface (u8 is_specified,
ASSERT (parent_sw_if_index);
- memset (address, 0, sizeof (address));
+ clib_memset (address, 0, sizeof (address));
/*
* Allocate a pipe instance. Either select one dynamically
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index d3ed2af18fd..3bbdd05cd4d 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -115,7 +115,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
return;
}
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
pool_get (vim->interfaces, vif);
vif->dev_instance = vif - vim->interfaces;
vif->tap_fd = -1;
@@ -317,7 +317,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
/* Set vhost memory table */
i = sizeof (struct vhost_memory) + sizeof (struct vhost_memory_region);
vhost_mem = clib_mem_alloc (i);
- memset (vhost_mem, 0, i);
+ clib_memset (vhost_mem, 0, i);
vhost_mem->nregions = 1;
vhost_mem->regions[0].memory_size = (1ULL << 47) - 4096;
_IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem);
@@ -405,7 +405,7 @@ error:
close (vif->fd);
vec_foreach_index (i, vif->vrings) virtio_vring_free (vm, vif, i);
vec_free (vif->vrings);
- memset (vif, 0, sizeof (virtio_if_t));
+ clib_memset (vif, 0, sizeof (virtio_if_t));
pool_put (vim->interfaces, vif);
done:
@@ -449,7 +449,7 @@ tap_delete_if (vlib_main_t * vm, u32 sw_if_index)
tm->tap_ids = clib_bitmap_set (tm->tap_ids, vif->id, 0);
clib_spinlock_free (&vif->lockp);
- memset (vif, 0, sizeof (*vif));
+ clib_memset (vif, 0, sizeof (*vif));
pool_put (mm->interfaces, vif);
return 0;
@@ -468,7 +468,7 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
/* *INDENT-OFF* */
pool_foreach (vif, mm->interfaces,
vec_add2(r_tapids, tapid, 1);
- memset (tapid, 0, sizeof (*tapid));
+ clib_memset (tapid, 0, sizeof (*tapid));
tapid->id = vif->id;
tapid->sw_if_index = vif->sw_if_index;
hi = vnet_get_hw_interface (vnm, vif->hw_if_index);
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index f0c980a64fa..e70d63f914f 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -58,7 +58,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
vl_api_registration_t *reg;
tap_create_if_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->id = ntohl (mp->id);
if (!mp->use_random_mac)
@@ -142,7 +142,7 @@ tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -190,7 +190,7 @@ tap_send_sw_interface_details (vpe_api_main_t * am,
{
vl_api_sw_interface_tap_v2_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_TAP_V2_DETAILS);
mp->id = htonl (tap_if->id);
mp->sw_if_index = htonl (tap_if->sw_if_index);
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index c7efe6519cd..9b01b9183c8 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -132,7 +132,7 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_vring_t * vring, u32 bi,
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
struct virtio_net_hdr_v1 *hdr = vlib_buffer_get_current (b) - hdr_sz;
- memset (hdr, 0, hdr_sz);
+ clib_memset (hdr, 0, hdr_sz);
if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0))
{
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index 1342030a651..9725a91027d 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -307,7 +307,7 @@ static_always_inline void
vhost_user_vring_init (vhost_user_intf_t * vui, u32 qid)
{
vhost_user_vring_t *vring = &vui->vrings[qid];
- memset (vring, 0, sizeof (*vring));
+ clib_memset (vring, 0, sizeof (*vring));
vring->kickfd_idx = ~0;
vring->callfd_idx = ~0;
vring->errfd = -1;
@@ -394,8 +394,8 @@ vhost_user_socket_read (clib_file_t * uf)
char control[CMSG_SPACE (VHOST_MEMORY_MAX_NREGIONS * sizeof (int))];
- memset (&mh, 0, sizeof (mh));
- memset (control, 0, sizeof (control));
+ clib_memset (&mh, 0, sizeof (mh));
+ clib_memset (control, 0, sizeof (control));
for (i = 0; i < VHOST_MEMORY_MAX_NREGIONS; i++)
fds[i] = -1;
@@ -1419,7 +1419,7 @@ vhost_user_vui_init (vnet_main_t * vnm,
{
vui->vring_locks[q] = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES,
CLIB_CACHE_LINE_BYTES);
- memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) vui->vring_locks[q], 0, CLIB_CACHE_LINE_BYTES);
}
vec_validate (vui->per_cpu_tx_qid,
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 016ccbd2687..b8d89a07cbc 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -58,7 +58,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -165,7 +165,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am,
vl_api_sw_interface_vhost_user_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_VHOST_USER_DETAILS);
mp->sw_if_index = ntohl (vui->sw_if_index);
mp->virtio_net_hdr_sz = ntohl (vui->virtio_net_hdr_sz);
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 26140484d2e..291d687ab6a 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -101,7 +101,7 @@ vhost_user_rx_trace (vhost_trace_t * t,
virtio_net_hdr_mrg_rxbuf_t *hdr;
u32 hint = 0;
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->device_index = vui - vum->vhost_user_interfaces;
t->qid = qid;
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index dab8fa5fb3b..820594999c8 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -155,7 +155,7 @@ vhost_user_tx_trace (vhost_trace_t * t,
vring_desc_t *hdr_desc = 0;
u32 hint = 0;
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->device_index = vui - vum->vhost_user_interfaces;
t->qid = qid;
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 072e8a755b0..17de781921d 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -85,19 +85,19 @@ virtio_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 idx, u16 sz)
i = sizeof (struct vring_desc) * sz;
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->desc = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->desc, 0, i);
+ clib_memset (vring->desc, 0, i);
i = sizeof (struct vring_avail) + sz * sizeof (vring->avail->ring[0]);
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->avail = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->avail, 0, i);
+ clib_memset (vring->avail, 0, i);
// tell kernel that we don't need interrupt
vring->avail->flags = VIRTIO_RING_FLAG_MASK_INT;
i = sizeof (struct vring_used) + sz * sizeof (struct vring_used_elem);
i = round_pow2 (i, CLIB_CACHE_LINE_BYTES);
vring->used = clib_mem_alloc_aligned (i, CLIB_CACHE_LINE_BYTES);
- memset (vring->used, 0, i);
+ clib_memset (vring->used, 0, i);
ASSERT (vring->buffers == 0);
vec_validate_aligned (vring->buffers, sz, CLIB_CACHE_LINE_BYTES);
diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
index 98f212334f6..32333054fa3 100644
--- a/src/vnet/dhcp/client.c
+++ b/src/vnet/dhcp/client.c
@@ -422,7 +422,7 @@ send_dhcp_pkt (dhcp_client_main_t * dcm, dhcp_client_t * c,
dhcp = (dhcp_header_t *) (udp + 1);
/* $$$ optimize, maybe */
- memset (ip, 0, sizeof (*ip) + sizeof (*udp) + sizeof (*dhcp));
+ clib_memset (ip, 0, sizeof (*ip) + sizeof (*udp) + sizeof (*dhcp));
ip->ip_version_and_header_length = 0x45;
ip->ttl = 128;
@@ -908,7 +908,7 @@ dhcp_client_add_del (dhcp_client_add_del_args_t * a)
if (a->is_add)
{
pool_get (dcm->clients, c);
- memset (c, 0, sizeof (*c));
+ clib_memset (c, 0, sizeof (*c));
c->state = DHCP_DISCOVER;
c->sw_if_index = a->sw_if_index;
c->client_index = a->client_index;
@@ -984,7 +984,7 @@ dhcp_client_config (u32 is_add,
dhcp_client_add_del_args_t _a, *a = &_a;
int rv;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->sw_if_index = sw_if_index;
a->client_index = client_index;
@@ -1106,7 +1106,7 @@ dhcp_client_set_command_fn (vlib_main_t * vm,
if (sw_if_index_set == 0)
return clib_error_return (0, "interface not specified");
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->sw_if_index = sw_if_index;
a->hostname = hostname;
diff --git a/src/vnet/dhcp/dhcp4_proxy_node.c b/src/vnet/dhcp/dhcp4_proxy_node.c
index 6b15c51b38f..97ed3b5920a 100644
--- a/src/vnet/dhcp/dhcp4_proxy_node.c
+++ b/src/vnet/dhcp/dhcp4_proxy_node.c
@@ -685,7 +685,7 @@ dhcp_proxy_to_client_input (vlib_main_t * vm,
hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index);
ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance);
clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
- memset (mac0->dst_address, 0xff, sizeof (mac0->dst_address));
+ clib_memset (mac0->dst_address, 0xff, sizeof (mac0->dst_address));
mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ?
clib_net_to_host_u16 (0x8100) : clib_net_to_host_u16 (0x0800);
@@ -818,8 +818,8 @@ dhcp4_proxy_set_command_fn (vlib_main_t * vm,
int is_del = 0;
int set_src = 0, set_server = 0;
- memset (&server_addr, 0, sizeof (server_addr));
- memset (&src_addr, 0, sizeof (src_addr));
+ clib_memset (&server_addr, 0, sizeof (server_addr));
+ clib_memset (&src_addr, 0, sizeof (src_addr));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vnet/dhcp/dhcp6_client_common_dp.c b/src/vnet/dhcp/dhcp6_client_common_dp.c
index 1a3c7bcb278..a6ed42de578 100644
--- a/src/vnet/dhcp/dhcp6_client_common_dp.c
+++ b/src/vnet/dhcp/dhcp6_client_common_dp.c
@@ -192,7 +192,7 @@ dhcpv6_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
ntohs (ip0->payload_length) - dhcpv6_ip6_palyoad_offset -
sizeof (*dhcpv60);
- memset (&report, 0, sizeof (report));
+ clib_memset (&report, 0, sizeof (report));
sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX];
if (sw_if_index >= vec_len (icm->client_state_by_sw_if_index))
diff --git a/src/vnet/dhcp/dhcp6_ia_na_client_dp.c b/src/vnet/dhcp/dhcp6_ia_na_client_dp.c
index 60641227700..11abfccea76 100644
--- a/src/vnet/dhcp/dhcp6_ia_na_client_dp.c
+++ b/src/vnet/dhcp/dhcp6_ia_na_client_dp.c
@@ -516,7 +516,7 @@ dhcp6_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
vec_len (events[i].addresses) *
sizeof (vl_api_dhcp6_address_info_t);
vl_api_dhcp6_reply_event_t *event = clib_mem_alloc (event_size);
- memset (event, 0, event_size);
+ clib_memset (event, 0, event_size);
event->sw_if_index = htonl (events[i].body.sw_if_index);
event->server_index = htonl (events[i].body.server_index);
diff --git a/src/vnet/dhcp/dhcp6_pd_client_cp.c b/src/vnet/dhcp/dhcp6_pd_client_cp.c
index 33813789e70..9663a5718ec 100644
--- a/src/vnet/dhcp/dhcp6_pd_client_cp.c
+++ b/src/vnet/dhcp/dhcp6_pd_client_cp.c
@@ -1257,7 +1257,7 @@ dhcp6_pd_client_enable_disable (u32 sw_if_index, const u8 * prefix_group,
vec_free (prefix_list);
- memset (client_state, 0, sizeof (*client_state));
+ clib_memset (client_state, 0, sizeof (*client_state));
}
return 0;
diff --git a/src/vnet/dhcp/dhcp6_pd_client_dp.c b/src/vnet/dhcp/dhcp6_pd_client_dp.c
index 009de4a4431..9fb6096b8d5 100644
--- a/src/vnet/dhcp/dhcp6_pd_client_dp.c
+++ b/src/vnet/dhcp/dhcp6_pd_client_dp.c
@@ -523,7 +523,7 @@ dhcp6_pd_reply_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
sizeof (vl_api_dhcp6_pd_prefix_info_t);
vl_api_dhcp6_pd_reply_event_t *event =
clib_mem_alloc (event_size);
- memset (event, 0, event_size);
+ clib_memset (event, 0, event_size);
event->sw_if_index = htonl (events[i].body.sw_if_index);
event->server_index = htonl (events[i].body.server_index);
diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c
index 7d157ad35a1..34454d6bd56 100644
--- a/src/vnet/dhcp/dhcp6_proxy_node.c
+++ b/src/vnet/dhcp/dhcp6_proxy_node.c
@@ -389,7 +389,7 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
sizeof (*r1) + sizeof (*fwd_opt) +
sizeof (*u1) + sizeof (*id1) + u1->length);
- memset (ip1, 0, sizeof (*ip1));
+ clib_memset (ip1, 0, sizeof (*ip1));
ip1->ip_version_traffic_class_and_flow_label = 0x60;
ip1->payload_length = u1->length;
ip1->protocol = PROTO_UDP;
@@ -739,7 +739,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm,
}
len = clib_net_to_host_u16 (r0->length);
- memset (ip1, 0, sizeof (*ip1));
+ clib_memset (ip1, 0, sizeof (*ip1));
copy_ip6_address (&ip1->dst_address, &client_address);
u1->checksum = 0;
u1->src_port = clib_net_to_host_u16 (UDP_DST_PORT_dhcpv6_to_server);
@@ -767,7 +767,7 @@ dhcpv6_proxy_to_client_input (vlib_main_t * vm,
hi0 = vnet_get_sup_hw_interface (vnm, original_sw_if_index);
ei0 = pool_elt_at_index (em->interfaces, hi0->hw_instance);
clib_memcpy (mac0->src_address, ei0->address, sizeof (ei0->address));
- memset (&mac0->dst_address, 0xff, sizeof (mac0->dst_address));
+ clib_memset (&mac0->dst_address, 0xff, sizeof (mac0->dst_address));
mac0->type = (si0->type == VNET_SW_INTERFACE_TYPE_SUB) ?
clib_net_to_host_u16 (0x8100) : clib_net_to_host_u16 (0x86dd);
diff --git a/src/vnet/dhcp/dhcp_api.c b/src/vnet/dhcp/dhcp_api.c
index 59ab6dcbba5..cd30e1d2f94 100644
--- a/src/vnet/dhcp/dhcp_api.c
+++ b/src/vnet/dhcp/dhcp_api.c
@@ -148,7 +148,7 @@ dhcp_send_details (fib_protocol_t proto,
mp = vl_msg_api_alloc (n);
if (!mp)
return;
- memset (mp, 0, n);
+ clib_memset (mp, 0, n);
mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_DETAILS);
mp->context = context;
mp->count = count;
@@ -324,7 +324,7 @@ send_dhcp_client_entry (const dhcp_client_t * client, void *arg)
ctx = arg;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_DHCP_CLIENT_DETAILS);
mp->context = ctx->context;
diff --git a/src/vnet/dhcp/dhcp_proxy.c b/src/vnet/dhcp/dhcp_proxy.c
index 88cdcacd62b..9a69041bc1d 100644
--- a/src/vnet/dhcp/dhcp_proxy.c
+++ b/src/vnet/dhcp/dhcp_proxy.c
@@ -198,7 +198,7 @@ dhcp_proxy_server_add (fib_protocol_t proto,
rx_fib_index, ~0);
pool_get (dpm->dhcp_servers[proto], proxy);
- memset (proxy, 0, sizeof (*proxy));
+ clib_memset (proxy, 0, sizeof (*proxy));
new = 1;
dpm->dhcp_server_index_by_rx_fib_index[proto][rx_fib_index] =
diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c
index eff854933c4..54b75aa1708 100644
--- a/src/vnet/dns/dns.c
+++ b/src/vnet/dns/dns.c
@@ -278,9 +278,9 @@ found_src_address:
vnet_buffer (b)->sw_if_index[VLIB_TX] = 0; /* default VRF for now */
ip = vlib_buffer_get_current (b);
- memset (ip, 0, sizeof (*ip));
+ clib_memset (ip, 0, sizeof (*ip));
udp = (udp_header_t *) (ip + 1);
- memset (udp, 0, sizeof (*udp));
+ clib_memset (udp, 0, sizeof (*udp));
dns_request = (u8 *) (udp + 1);
@@ -384,9 +384,9 @@ found_src_address:
VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_LOCALLY_ORIGINATED;
ip = vlib_buffer_get_current (b);
- memset (ip, 0, sizeof (*ip));
+ clib_memset (ip, 0, sizeof (*ip));
udp = (udp_header_t *) (ip + 1);
- memset (udp, 0, sizeof (*udp));
+ clib_memset (udp, 0, sizeof (*udp));
dns_request = (u8 *) (udp + 1);
@@ -768,7 +768,7 @@ dns_add_static_entry (dns_main_t * dm, u8 * name, u8 * dns_reply_data)
}
pool_get (dm->entries, ep);
- memset (ep, 0, sizeof (*ep));
+ clib_memset (ep, 0, sizeof (*ep));
/* Note: consumes the name vector */
ep->name = name;
@@ -887,7 +887,7 @@ re_resolve:
/* add new hash table entry */
pool_get (dm->entries, ep);
- memset (ep, 0, sizeof (*ep));
+ clib_memset (ep, 0, sizeof (*ep));
ep->name = format (0, "%s%c", name, 0);
_vec_len (ep->name) = vec_len (ep->name) - 1;
@@ -1063,7 +1063,7 @@ found_last_request:
/* Need to recompute ep post pool-get */
ep = pool_elt_at_index (dm->entries, ep_index);
- memset (next_ep, 0, sizeof (*next_ep));
+ clib_memset (next_ep, 0, sizeof (*next_ep));
next_ep->name = vec_dup (cname);
vec_add1 (next_ep->name, 0);
_vec_len (next_ep->name) -= 1;
@@ -2592,7 +2592,7 @@ test_dns_fmt_command_fn (vlib_main_t * vm,
vlib_cli_output (vm, "%U", format_dns_reply, dns_reply_data, verbose);
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rv = vnet_dns_response_to_reply (dns_reply_data, rmp, 0 /* ttl-ptr */ );
@@ -2758,7 +2758,7 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr,
if (pr->request_type == DNS_PEER_PENDING_NAME_TO_IP)
{
/* Quick and dirty way to dig up the A-record address. $$ FIXME */
- memset (rnr, 0, sizeof (*rnr));
+ clib_memset (rnr, 0, sizeof (*rnr));
if (vnet_dns_response_to_reply (ep->dns_response, rnr, &ttl))
{
/* clib_warning ("response_to_reply failed..."); */
@@ -2772,7 +2772,7 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr,
}
else if (pr->request_type == DNS_PEER_PENDING_IP_TO_NAME)
{
- memset (rir, 0, sizeof (*rir));
+ clib_memset (rir, 0, sizeof (*rir));
if (vnet_dns_response_to_name (ep->dns_response, rir, &ttl))
{
/* clib_warning ("response_to_name failed..."); */
@@ -2859,7 +2859,7 @@ found_src_address:
ip = vlib_buffer_get_current (b0);
udp = (udp_header_t *) (ip + 1);
dns_response = (u8 *) (udp + 1);
- memset (ip, 0, sizeof (*ip) + sizeof (*udp));
+ clib_memset (ip, 0, sizeof (*ip) + sizeof (*udp));
/*
* Start with the variadic portion of the exercise.
diff --git a/src/vnet/dpo/classify_dpo.c b/src/vnet/dpo/classify_dpo.c
index 9e7886c9edd..08fab83f2ee 100644
--- a/src/vnet/dpo/classify_dpo.c
+++ b/src/vnet/dpo/classify_dpo.c
@@ -28,7 +28,7 @@ classify_dpo_alloc (void)
classify_dpo_t *cd;
pool_get_aligned(classify_dpo_pool, cd, CLIB_CACHE_LINE_BYTES);
- memset(cd, 0, sizeof(*cd));
+ clib_memset(cd, 0, sizeof(*cd));
return (cd);
}
diff --git a/src/vnet/dpo/l3_proxy_dpo.c b/src/vnet/dpo/l3_proxy_dpo.c
index ea3db7151d0..41156301a0e 100644
--- a/src/vnet/dpo/l3_proxy_dpo.c
+++ b/src/vnet/dpo/l3_proxy_dpo.c
@@ -31,7 +31,7 @@ l3_proxy_dpo_alloc (void)
l3_proxy_dpo_t *l3p;
pool_get_aligned(l3_proxy_dpo_pool, l3p, CLIB_CACHE_LINE_BYTES);
- memset(l3p, 0, sizeof(*l3p));
+ clib_memset(l3p, 0, sizeof(*l3p));
return (l3p);
}
diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c
index 6b77f477fae..1abfab1cb01 100644
--- a/src/vnet/dpo/load_balance.c
+++ b/src/vnet/dpo/load_balance.c
@@ -94,7 +94,7 @@ load_balance_alloc_i (void)
load_balance_t *lb;
pool_get_aligned(load_balance_pool, lb, CLIB_CACHE_LINE_BYTES);
- memset(lb, 0, sizeof(*lb));
+ clib_memset(lb, 0, sizeof(*lb));
lb->lb_map = INDEX_INVALID;
lb->lb_urpf = INDEX_INVALID;
diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c
index 8f9bd366c4a..bf5d1fb2943 100644
--- a/src/vnet/dpo/load_balance_map.c
+++ b/src/vnet/dpo/load_balance_map.c
@@ -389,7 +389,7 @@ load_balance_map_alloc (const load_balance_path_t *paths)
u32 ii;
pool_get_aligned(load_balance_map_pool, lbm, CLIB_CACHE_LINE_BYTES);
- memset(lbm, 0, sizeof(*lbm));
+ clib_memset(lbm, 0, sizeof(*lbm));
vec_validate(lbm->lbm_paths, vec_len(paths)-1);
diff --git a/src/vnet/dpo/mpls_disposition.c b/src/vnet/dpo/mpls_disposition.c
index 66f74f9b29f..c2c9065f787 100644
--- a/src/vnet/dpo/mpls_disposition.c
+++ b/src/vnet/dpo/mpls_disposition.c
@@ -29,7 +29,7 @@ mpls_disp_dpo_alloc (void)
mpls_disp_dpo_t *mdd;
pool_get_aligned(mpls_disp_dpo_pool, mdd, CLIB_CACHE_LINE_BYTES);
- memset(mdd, 0, sizeof(*mdd));
+ clib_memset(mdd, 0, sizeof(*mdd));
dpo_reset(&mdd->mdd_dpo);
diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c
index bee155b9035..c3710aefe28 100644
--- a/src/vnet/dpo/mpls_label_dpo.c
+++ b/src/vnet/dpo/mpls_label_dpo.c
@@ -40,7 +40,7 @@ mpls_label_dpo_alloc (void)
mpls_label_dpo_t *mld;
pool_get_aligned(mpls_label_dpo_pool, mld, CLIB_CACHE_LINE_BYTES);
- memset(mld, 0, sizeof(*mld));
+ clib_memset(mld, 0, sizeof(*mld));
dpo_reset(&mld->mld_dpo);
diff --git a/src/vnet/dpo/receive_dpo.c b/src/vnet/dpo/receive_dpo.c
index 83e33ed8cf0..30ddceeb23e 100644
--- a/src/vnet/dpo/receive_dpo.c
+++ b/src/vnet/dpo/receive_dpo.c
@@ -31,7 +31,7 @@ receive_dpo_alloc (void)
receive_dpo_t *rd;
pool_get_aligned(receive_dpo_pool, rd, CLIB_CACHE_LINE_BYTES);
- memset(rd, 0, sizeof(*rd));
+ clib_memset(rd, 0, sizeof(*rd));
return (rd);
}
diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c
index 443df66e238..c9d86f39832 100644
--- a/src/vnet/dpo/replicate_dpo.c
+++ b/src/vnet/dpo/replicate_dpo.c
@@ -90,7 +90,7 @@ replicate_alloc_i (void)
replicate_t *rep;
pool_get_aligned(replicate_pool, rep, CLIB_CACHE_LINE_BYTES);
- memset(rep, 0, sizeof(*rep));
+ clib_memset(rep, 0, sizeof(*rep));
vlib_validate_combined_counter(&(replicate_main.repm_counters),
replicate_get_index(rep));
diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c
index e0d1295f69d..2cb137c53b3 100644
--- a/src/vnet/ethernet/interface.c
+++ b/src/vnet/ethernet/interface.c
@@ -152,7 +152,7 @@ ethernet_build_rewrite (vnet_main_t * vnm,
if (dst_address)
clib_memcpy (h->dst_address, dst_address, sizeof (h->dst_address));
else
- memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */
+ clib_memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */
}
if (PREDICT_FALSE (!is_p2p) && sub_sw->sub.eth.flags.one_tag)
@@ -750,7 +750,7 @@ vnet_create_loopback_interface (u32 * sw_if_indexp, u8 * mac_address,
*sw_if_indexp = (u32) ~ 0;
- memset (address, 0, sizeof (address));
+ clib_memset (address, 0, sizeof (address));
/*
* Allocate a loopback instance. Either select on dynamically
@@ -822,7 +822,7 @@ create_simulated_ethernet_interfaces (vlib_main_t * vm,
u8 is_specified = 0;
u32 user_instance = 0;
- memset (mac_address, 0, sizeof (mac_address));
+ clib_memset (mac_address, 0, sizeof (mac_address));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c
index 3c832eb01fb..d46b9e23b04 100644
--- a/src/vnet/fib/fib_api.c
+++ b/src/vnet/fib/fib_api.c
@@ -49,7 +49,7 @@ fib_path_api_parse (const vl_api_fib_path_t *in,
path_flags = FIB_ROUTE_PATH_FLAG_NONE;
next_hop_via_label = ntohl (in->via_label);
- memset(out, 0, sizeof(*out));
+ clib_memset(out, 0, sizeof(*out));
out->frp_sw_if_index = ~0;
out->frp_proto = in->afi;
@@ -207,7 +207,7 @@ void
fib_api_path_encode (const fib_route_path_encode_t * api_rpath,
vl_api_fib_path_t *out)
{
- memset (out, 0, sizeof (*out));
+ clib_memset (out, 0, sizeof (*out));
switch (api_rpath->dpo.dpoi_type)
{
case DPO_RECEIVE:
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index e522db44570..feb304bea36 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -107,7 +107,7 @@ fib_entry_ae_add_or_lock (fib_node_index_t connected)
fed = fib_entry_delegate_find_or_add(entry,
FIB_ENTRY_DELEGATE_ATTACHED_EXPORT);
pool_get(fib_ae_export_pool, export);
- memset(export, 0, sizeof(*export));
+ clib_memset(export, 0, sizeof(*export));
fed->fd_index = (export - fib_ae_export_pool);
export->faee_ei = connected;
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 7de521336b8..eaedc504d48 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -601,7 +601,7 @@ fib_entry_alloc (u32 fib_index,
fib_prefix_t *fep;
pool_get(fib_entry_pool, fib_entry);
- memset(fib_entry, 0, sizeof(*fib_entry));
+ clib_memset(fib_entry, 0, sizeof(*fib_entry));
fib_node_init(&fib_entry->fe_node,
FIB_NODE_TYPE_ENTRY);
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index e37d47482db..baf8275d181 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -1256,7 +1256,7 @@ fib_path_create (fib_node_index_t pl_index,
fib_path_t *path;
pool_get(fib_path_pool, path);
- memset(path, 0, sizeof(*path));
+ clib_memset(path, 0, sizeof(*path));
fib_node_init(&path->fp_node,
FIB_NODE_TYPE_PATH);
@@ -1397,7 +1397,7 @@ fib_path_create_special (fib_node_index_t pl_index,
fib_path_t *path;
pool_get(fib_path_pool, path);
- memset(path, 0, sizeof(*path));
+ clib_memset(path, 0, sizeof(*path));
fib_node_init(&path->fp_node,
FIB_NODE_TYPE_PATH);
@@ -1456,7 +1456,7 @@ fib_path_copy (fib_node_index_t path_index,
path->fp_oper_flags = FIB_PATH_OPER_FLAG_NONE;
path->fp_pl_index = path_list_index;
path->fp_via_fib = FIB_NODE_INDEX_INVALID;
- memset(&path->fp_dpo, 0, sizeof(path->fp_dpo));
+ clib_memset(&path->fp_dpo, 0, sizeof(path->fp_dpo));
dpo_reset(&path->fp_dpo);
return (fib_path_get_index(path));
diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c
index 4655c687427..568886af143 100644
--- a/src/vnet/fib/fib_path_list.c
+++ b/src/vnet/fib/fib_path_list.c
@@ -542,7 +542,7 @@ fib_path_list_alloc (fib_node_index_t *path_list_index)
fib_path_list_t *path_list;
pool_get(fib_path_list_pool, path_list);
- memset(path_list, 0, sizeof(*path_list));
+ clib_memset(path_list, 0, sizeof(*path_list));
fib_node_init(&path_list->fpl_node,
FIB_NODE_TYPE_PATH_LIST);
diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c
index 25606438491..7f0f13079ee 100644
--- a/src/vnet/fib/fib_types.c
+++ b/src/vnet/fib/fib_types.c
@@ -440,7 +440,7 @@ unformat_fib_route_path (unformat_input_t * input, va_list * args)
vnet_main_t *vnm;
vnm = vnet_get_main ();
- memset(rpath, 0, sizeof(*rpath));
+ clib_memset(rpath, 0, sizeof(*rpath));
rpath->frp_weight = 1;
rpath->frp_sw_if_index = ~0;
diff --git a/src/vnet/fib/fib_urpf_list.c b/src/vnet/fib/fib_urpf_list.c
index d5a406e6191..a895729e91a 100644
--- a/src/vnet/fib/fib_urpf_list.c
+++ b/src/vnet/fib/fib_urpf_list.c
@@ -57,7 +57,7 @@ fib_urpf_list_alloc_and_lock (void)
fib_urpf_list_t *urpf;
pool_get(fib_urpf_list_pool, urpf);
- memset(urpf, 0, sizeof(*urpf));
+ clib_memset(urpf, 0, sizeof(*urpf));
urpf->furpf_locks++;
diff --git a/src/vnet/fib/fib_walk.c b/src/vnet/fib/fib_walk.c
index 6a64d554f98..64c2527b7b6 100644
--- a/src/vnet/fib/fib_walk.c
+++ b/src/vnet/fib/fib_walk.c
@@ -1181,11 +1181,11 @@ fib_walk_clear (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- memset(fib_walk_hist_vists_per_walk, 0, sizeof(fib_walk_hist_vists_per_walk));
- memset(fib_walk_history, 0, sizeof(fib_walk_history));
- memset(fib_walk_work_time_taken, 0, sizeof(fib_walk_work_time_taken));
- memset(fib_walk_work_nodes_visited, 0, sizeof(fib_walk_work_nodes_visited));
- memset(fib_walk_sleep_lengths, 0, sizeof(fib_walk_sleep_lengths));
+ clib_memset(fib_walk_hist_vists_per_walk, 0, sizeof(fib_walk_hist_vists_per_walk));
+ clib_memset(fib_walk_history, 0, sizeof(fib_walk_history));
+ clib_memset(fib_walk_work_time_taken, 0, sizeof(fib_walk_work_time_taken));
+ clib_memset(fib_walk_work_nodes_visited, 0, sizeof(fib_walk_work_nodes_visited));
+ clib_memset(fib_walk_sleep_lengths, 0, sizeof(fib_walk_sleep_lengths));
return (NULL);
}
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index d8d983dd9c1..9ad1842dd1a 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -109,7 +109,7 @@ ip4_create_fib_with_table_id (u32 table_id,
void *old_heap;
pool_get(ip4_main.fibs, fib_table);
- memset(fib_table, 0, sizeof(*fib_table));
+ clib_memset(fib_table, 0, sizeof(*fib_table));
old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap);
pool_get_aligned(ip4_main.v4_fibs, v4_fib, CLIB_CACHE_LINE_BYTES);
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 22b47579d3e..7375b56ee51 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -63,8 +63,8 @@ create_fib_with_table_id (u32 table_id,
pool_get(ip6_main.fibs, fib_table);
pool_get_aligned(ip6_main.v6_fibs, v6_fib, CLIB_CACHE_LINE_BYTES);
- memset(fib_table, 0, sizeof(*fib_table));
- memset(v6_fib, 0, sizeof(*v6_fib));
+ clib_memset(fib_table, 0, sizeof(*fib_table));
+ clib_memset(v6_fib, 0, sizeof(*v6_fib));
ASSERT((fib_table - ip6_main.fibs) ==
(v6_fib - ip6_main.v6_fibs));
@@ -690,7 +690,7 @@ ip6_show_fib (vlib_main_t * vm,
vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
- memset (ca, 0, sizeof(*ca));
+ clib_memset (ca, 0, sizeof(*ca));
ca->fib_index = fib->index;
BV(clib_bihash_foreach_key_value_pair)
diff --git a/src/vnet/fib/mpls_fib.c b/src/vnet/fib/mpls_fib.c
index 223a0ddd753..6670c99233f 100644
--- a/src/vnet/fib/mpls_fib.c
+++ b/src/vnet/fib/mpls_fib.c
@@ -98,7 +98,7 @@ mpls_fib_create_with_table_id (u32 table_id,
ASSERT((fib_table - mpls_main.fibs) ==
(mf - mpls_main.mpls_fibs));
- memset(fib_table, 0, sizeof(*fib_table));
+ clib_memset(fib_table, 0, sizeof(*fib_table));
fib_table->ft_proto = FIB_PROTOCOL_MPLS;
fib_table->ft_index = (fib_table - mpls_main.fibs);
diff --git a/src/vnet/flow/flow.c b/src/vnet/flow/flow.c
index c4f57a21965..485a845e5ee 100644
--- a/src/vnet/flow/flow.c
+++ b/src/vnet/flow/flow.c
@@ -82,7 +82,7 @@ vnet_flow_del (vnet_main_t * vnm, u32 flow_index)
/* *INDENT-ON* */
hash_free (f->private_data);
- memset (f, 0, sizeof (*f));
+ clib_memset (f, 0, sizeof (*f));
pool_put (fm->global_flow_pool, f);
return 0;
}
diff --git a/src/vnet/flow/flow_cli.c b/src/vnet/flow/flow_cli.c
index 27f2d386279..0e10c90f55b 100644
--- a/src/vnet/flow/flow_cli.c
+++ b/src/vnet/flow/flow_cli.c
@@ -278,7 +278,7 @@ test_flow (vlib_main_t * vm, unformat_input_t * input,
int rv;
u8 prot;
- memset (&flow, 0, sizeof (vnet_flow_t));
+ clib_memset (&flow, 0, sizeof (vnet_flow_t));
flow.index = ~0;
flow.actions = 0;
flow.ip4_n_tuple.protocol = ~0;
diff --git a/src/vnet/geneve/decap.c b/src/vnet/geneve/decap.c
index f525fa323a6..93f2a8548c1 100644
--- a/src/vnet/geneve/decap.c
+++ b/src/vnet/geneve/decap.c
@@ -88,7 +88,7 @@ geneve_input (vlib_main_t * vm,
if (is_ip4)
last_key4.as_u64 = ~0;
else
- memset (&last_key6, 0xff, sizeof (last_key6));
+ clib_memset (&last_key6, 0xff, sizeof (last_key6));
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c
index ac097f915cb..c53a67a1abd 100644
--- a/src/vnet/geneve/geneve.c
+++ b/src/vnet/geneve/geneve.c
@@ -395,7 +395,7 @@ int vnet_geneve_add_del_tunnel
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (vxm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* copy from arg structure */
#define _(x) t->x = a->x;
@@ -670,8 +670,8 @@ geneve_add_del_tunnel_command_fn (vlib_main_t * vm,
clib_error_t *error = NULL;
/* Cant "universally zero init" (={0}) due to GCC bug 53119 */
- memset (&local, 0, sizeof local);
- memset (&remote, 0, sizeof remote);
+ clib_memset (&local, 0, sizeof local);
+ clib_memset (&remote, 0, sizeof remote);
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -807,7 +807,7 @@ geneve_add_del_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/vnet/geneve/geneve_api.c b/src/vnet/geneve/geneve_api.c
index 9d0830c1ce5..6aa9fa43db2 100644
--- a/src/vnet/geneve/geneve_api.c
+++ b/src/vnet/geneve/geneve_api.c
@@ -121,7 +121,7 @@ static void send_geneve_tunnel_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->remote);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_GENEVE_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index 070c78e8984..449968c1be0 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -597,7 +597,7 @@ gre_init (vlib_main_t * vm)
ip_main_t *im = &ip_main;
ip_protocol_info_t *pi;
- memset (gm, 0, sizeof (gm[0]));
+ clib_memset (gm, 0, sizeof (gm[0]));
gm->vlib_main = vm;
gm->vnet_main = vnet_get_main ();
diff --git a/src/vnet/gre/gre_api.c b/src/vnet/gre/gre_api.c
index 63d4ca4695b..c5658b52660 100644
--- a/src/vnet/gre/gre_api.c
+++ b/src/vnet/gre/gre_api.c
@@ -63,7 +63,7 @@ static void vl_api_gre_add_del_tunnel_t_handler
rv = VNET_API_ERROR_SAME_SRC_DST;
goto out;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = mp->is_add;
a->tunnel_type = mp->tunnel_type;
@@ -103,7 +103,7 @@ static void send_gre_tunnel_details
fib_table_t *ft;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = htons (VL_API_GRE_TUNNEL_DETAILS);
if (!is_ipv6)
{
diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c
index 181a908022b..6be934af56c 100644
--- a/src/vnet/gre/interface.c
+++ b/src/vnet/gre/interface.c
@@ -281,7 +281,7 @@ vnet_gre_tunnel_add (vnet_gre_add_del_tunnel_args_t * a,
return VNET_API_ERROR_IF_ALREADY_EXISTS;
pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* Reconcile the real dev_instance and a possible requested instance */
u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
@@ -606,7 +606,7 @@ create_gre_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->outer_fib_id = outer_fib_id;
a->tunnel_type = t_type;
diff --git a/src/vnet/gre/node.c b/src/vnet/gre/node.c
index 056d00b23b0..89109bbc053 100644
--- a/src/vnet/gre/node.c
+++ b/src/vnet/gre/node.c
@@ -82,11 +82,11 @@ gre_input (vlib_main_t * vm,
vnet_interface_main_t *im = &gm->vnet_main->interface_main;
if (!is_ipv6)
- memset (&cached_tunnel_key.gtk_v4, 0xff,
- sizeof (cached_tunnel_key.gtk_v4));
+ clib_memset (&cached_tunnel_key.gtk_v4, 0xff,
+ sizeof (cached_tunnel_key.gtk_v4));
else
- memset (&cached_tunnel_key.gtk_v6, 0xff,
- sizeof (cached_tunnel_key.gtk_v6));
+ clib_memset (&cached_tunnel_key.gtk_v6, 0xff,
+ sizeof (cached_tunnel_key.gtk_v6));
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/hdlc/hdlc.c b/src/vnet/hdlc/hdlc.c
index 5f7609d24a6..fa1e7cd5eaf 100644
--- a/src/vnet/hdlc/hdlc.c
+++ b/src/vnet/hdlc/hdlc.c
@@ -229,7 +229,7 @@ hdlc_init (vlib_main_t * vm)
{
hdlc_main_t *pm = &hdlc_main;
- memset (pm, 0, sizeof (pm[0]));
+ clib_memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
pm->protocol_info_by_name = hash_create_string (0, sizeof (uword));
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 45a265ccdae..dba5a667b22 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -718,7 +718,7 @@ vnet_register_interface (vnet_main_t * vnm,
char *tx_node_name = NULL, *output_node_name = NULL;
pool_get (im->hw_interfaces, hw);
- memset (hw, 0, sizeof (*hw));
+ clib_memset (hw, 0, sizeof (*hw));
hw_index = hw - im->hw_interfaces;
hw->hw_if_index = hw_index;
@@ -831,7 +831,7 @@ vnet_register_interface (vnet_main_t * vnm,
.is_deleted = 0,
};
- memset (&r, 0, sizeof (r));
+ clib_memset (&r, 0, sizeof (r));
r.type = VLIB_NODE_TYPE_INTERNAL;
r.runtime_data = &rt;
r.runtime_data_bytes = sizeof (rt);
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 644babef894..c27f3e87975 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -194,7 +194,7 @@ send_sw_interface_details (vpe_api_main_t * am,
vnet_get_sup_hw_interface (am->vnet_main, swif->sw_if_index);
vl_api_sw_interface_details_t *mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DETAILS);
mp->sw_if_index = ntohl (swif->sw_if_index);
mp->sup_sw_if_index = ntohl (swif->sup_sw_if_index);
@@ -268,7 +268,7 @@ send_sw_interface_details (vpe_api_main_t * am,
u16 outer_tag = 0;
u16 b_vlanid = 0;
u32 i_sid = 0;
- memset (&eth_hdr, 0, sizeof (eth_hdr));
+ clib_memset (&eth_hdr, 0, sizeof (eth_hdr));
if (!l2pbb_get (am->vlib_main, am->vnet_main, swif->sw_if_index,
&vtr_op, &outer_tag, &eth_hdr, &b_vlanid, &i_sid))
@@ -556,7 +556,7 @@ send_sw_interface_get_table_reply (vl_api_registration_t * reg,
vl_api_sw_interface_get_table_reply_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_GET_TABLE_REPLY);
mp->context = context;
mp->retval = htonl (retval);
@@ -719,7 +719,7 @@ send_sw_interface_event (vpe_api_main_t * am,
vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm,
swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (swif->sw_if_index);
mp->client_index = reg->client_index;
@@ -967,7 +967,7 @@ send_interface_rx_placement_details (vpe_api_main_t * am,
{
vl_api_sw_interface_rx_placement_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_RX_PLACEMENT_DETAILS);
mp->sw_if_index = htonl (sw_if_index);
@@ -1127,7 +1127,7 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp)
goto out;
}
- memset (&template, 0, sizeof (template));
+ clib_memset (&template, 0, sizeof (template));
template.type = VNET_SW_INTERFACE_TYPE_SUB;
template.sup_sw_if_index = hi->sw_if_index;
template.sub.id = id;
@@ -1207,7 +1207,7 @@ vl_api_create_subif_t_handler (vl_api_create_subif_t * mp)
goto out;
}
- memset (&template, 0, sizeof (template));
+ clib_memset (&template, 0, sizeof (template));
template.type = VNET_SW_INTERFACE_TYPE_SUB;
template.sup_sw_if_index = sw_if_index;
template.sub.id = sub_id;
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 360898ea0fb..b11d35e9efa 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -687,7 +687,7 @@ create_sub_interfaces (vlib_main_t * vm,
goto done;
}
- memset (&template, 0, sizeof (template));
+ clib_memset (&template, 0, sizeof (template));
template.sub.eth.raw_flags = 0;
if (unformat (input, "%d default", &id_min))
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 89ce274a6cc..f8585647c81 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -1157,7 +1157,7 @@ pcap_drop_trace_command_fn (vlib_main_t * vm,
if (im->pcap_filename == 0)
im->pcap_filename = format (0, "/tmp/drop.pcap%c", 0);
- memset (&im->pcap_main, 0, sizeof (im->pcap_main));
+ clib_memset (&im->pcap_main, 0, sizeof (im->pcap_main));
im->pcap_main.file_name = (char *) im->pcap_filename;
im->pcap_main.n_packets_to_capture = 100;
if (im->pcap_pkts_to_capture)
diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c
index a4808f23271..3626e96305b 100644
--- a/src/vnet/ip/icmp4.c
+++ b/src/vnet/ip/icmp4.c
@@ -766,8 +766,9 @@ icmp4_init (vlib_main_t * vm)
foreach_icmp4_code;
#undef _
- memset (cm->ip4_input_next_index_by_type,
- ICMP_INPUT_NEXT_ERROR, sizeof (cm->ip4_input_next_index_by_type));
+ clib_memset (cm->ip4_input_next_index_by_type,
+ ICMP_INPUT_NEXT_ERROR,
+ sizeof (cm->ip4_input_next_index_by_type));
ip4_icmp_register_type (vm, ICMP4_echo_request,
ip4_icmp_echo_request_node.index);
diff --git a/src/vnet/ip/icmp6.c b/src/vnet/ip/icmp6.c
index 4252ac7ad59..37deb762d51 100644
--- a/src/vnet/ip/icmp6.c
+++ b/src/vnet/ip/icmp6.c
@@ -786,24 +786,25 @@ icmp6_init (vlib_main_t * vm)
foreach_icmp6_code;
#undef _
- memset (cm->input_next_index_by_type,
- ICMP_INPUT_NEXT_DROP, sizeof (cm->input_next_index_by_type));
- memset (cm->max_valid_code_by_type, 0, sizeof (cm->max_valid_code_by_type));
+ clib_memset (cm->input_next_index_by_type,
+ ICMP_INPUT_NEXT_DROP, sizeof (cm->input_next_index_by_type));
+ clib_memset (cm->max_valid_code_by_type, 0,
+ sizeof (cm->max_valid_code_by_type));
#define _(a,n,t) cm->max_valid_code_by_type[ICMP6_##a] = clib_max (cm->max_valid_code_by_type[ICMP6_##a], n);
foreach_icmp6_code;
#undef _
- memset (cm->min_valid_hop_limit_by_type, 0,
- sizeof (cm->min_valid_hop_limit_by_type));
+ clib_memset (cm->min_valid_hop_limit_by_type, 0,
+ sizeof (cm->min_valid_hop_limit_by_type));
cm->min_valid_hop_limit_by_type[ICMP6_router_solicitation] = 255;
cm->min_valid_hop_limit_by_type[ICMP6_router_advertisement] = 255;
cm->min_valid_hop_limit_by_type[ICMP6_neighbor_solicitation] = 255;
cm->min_valid_hop_limit_by_type[ICMP6_neighbor_advertisement] = 255;
cm->min_valid_hop_limit_by_type[ICMP6_redirect] = 255;
- memset (cm->min_valid_length_by_type, sizeof (icmp46_header_t),
- sizeof (cm->min_valid_length_by_type));
+ clib_memset (cm->min_valid_length_by_type, sizeof (icmp46_header_t),
+ sizeof (cm->min_valid_length_by_type));
cm->min_valid_length_by_type[ICMP6_router_solicitation] =
sizeof (icmp6_neighbor_discovery_header_t);
cm->min_valid_length_by_type[ICMP6_router_advertisement] =
diff --git a/src/vnet/ip/ip4_format.c b/src/vnet/ip/ip4_format.c
index 0a2d7d293d5..5399e44d93a 100644
--- a/src/vnet/ip/ip4_format.c
+++ b/src/vnet/ip/ip4_format.c
@@ -213,7 +213,7 @@ unformat_ip4_header (unformat_input_t * input, va_list * args)
ip = p;
}
- memset (ip, 0, sizeof (ip[0]));
+ clib_memset (ip, 0, sizeof (ip[0]));
ip->ip_version_and_header_length = IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS;
if (!unformat (input, "%U: %U -> %U",
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 23e90df8b8a..192f301eb76 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -943,11 +943,11 @@ ip4_lookup_init (vlib_main_t * vm)
{
ethernet_arp_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/* Set target ethernet address to all zeros. */
- memset (h.ip4_over_ethernet[1].ethernet, 0,
- sizeof (h.ip4_over_ethernet[1].ethernet));
+ clib_memset (h.ip4_over_ethernet[1].ethernet, 0,
+ sizeof (h.ip4_over_ethernet[1].ethernet));
#define _16(f,v) h.f = clib_host_to_net_u16 (v);
#define _8(f,v) h.f = v;
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c
index e6425ca703a..02ce12a5ff9 100755
--- a/src/vnet/ip/ip4_mtrie.c
+++ b/src/vnet/ip/ip4_mtrie.c
@@ -146,7 +146,7 @@ ip4_fib_mtrie_leaf_set_next_ply_index (u32 i)
*/ \
p->n_non_empty_leafs = (prefix_len > ply_base_len ? \
ARRAY_LEN (p->leaves) : 0); \
- memset (p->dst_address_bits_of_leaves, prefix_len, \
+ clib_memset (p->dst_address_bits_of_leaves, prefix_len, \
sizeof (p->dst_address_bits_of_leaves)); \
p->dst_address_bits_base = ply_base_len; \
\
@@ -165,8 +165,8 @@ static void
ply_16_init (ip4_fib_mtrie_16_ply_t * p,
ip4_fib_mtrie_leaf_t init, uword prefix_len)
{
- memset (p->dst_address_bits_of_leaves, prefix_len,
- sizeof (p->dst_address_bits_of_leaves));
+ clib_memset (p->dst_address_bits_of_leaves, prefix_len,
+ sizeof (p->dst_address_bits_of_leaves));
PLY_INIT_LEAVES (p);
}
diff --git a/src/vnet/ip/ip4_pg.c b/src/vnet/ip/ip4_pg.c
index 9697a3b9c89..d89424496f0 100644
--- a/src/vnet/ip/ip4_pg.c
+++ b/src/vnet/ip/ip4_pg.c
@@ -344,7 +344,7 @@ found:
/* See if header is all fixed and specified except for
checksum field. */
- memset (&cmp_mask, ~0, sizeof (cmp_mask));
+ clib_memset (&cmp_mask, ~0, sizeof (cmp_mask));
cmp_mask.checksum = 0;
pg_edit_group_get_fixed_packet_data (s, group_index,
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c
index 3600d7cb9d3..ed4cbcf9f2e 100644
--- a/src/vnet/ip/ip4_punt_drop.c
+++ b/src/vnet/ip/ip4_punt_drop.c
@@ -445,7 +445,7 @@ ip4_punt_redirect_cmd (vlib_main_t * vm,
;
else if (unformat (line_input, "via %U",
unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
else
{
error = unformat_parse_error (line_input);
diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c
index 87fb7643823..42231d0e30d 100644
--- a/src/vnet/ip/ip4_reassembly.c
+++ b/src/vnet/ip/ip4_reassembly.c
@@ -368,7 +368,7 @@ ip4_reass_find_or_create (vlib_main_t * vm, ip4_reass_main_t * rm,
else
{
pool_get (rt->pool, reass);
- memset (reass, 0, sizeof (*reass));
+ clib_memset (reass, 0, sizeof (*reass));
reass->id =
((u64) os_get_thread_index () * 1000000000) + rt->id_counter;
++rt->id_counter;
@@ -1109,7 +1109,7 @@ ip4_reass_set (u32 timeout_ms, u32 max_reassemblies,
if (ip4_reass_main.max_reass_n > 0 && new_nbuckets > old_nbuckets)
{
clib_bihash_16_8_t new_hash;
- memset (&new_hash, 0, sizeof (new_hash));
+ clib_memset (&new_hash, 0, sizeof (new_hash));
ip4_rehash_cb_ctx ctx;
ctx.failure = 0;
ctx.new_hash = &new_hash;
diff --git a/src/vnet/ip/ip4_source_and_port_range_check.c b/src/vnet/ip/ip4_source_and_port_range_check.c
index 1f9a32ea108..fe5c1f24309 100644
--- a/src/vnet/ip/ip4_source_and_port_range_check.c
+++ b/src/vnet/ip/ip4_source_and_port_range_check.c
@@ -903,7 +903,7 @@ protocol_port_range_dpo_alloc (void)
protocol_port_range_dpo_t *ppr_dpo;
pool_get_aligned (ppr_dpo_pool, ppr_dpo, CLIB_CACHE_LINE_BYTES);
- memset (ppr_dpo, 0, sizeof (*ppr_dpo));
+ clib_memset (ppr_dpo, 0, sizeof (*ppr_dpo));
ppr_dpo->n_free_ranges = N_PORT_RANGES_PER_DPO;
diff --git a/src/vnet/ip/ip4_to_ip6.h b/src/vnet/ip/ip4_to_ip6.h
index 9fedcc6fa35..b1905e4154b 100644
--- a/src/vnet/ip/ip4_to_ip6.h
+++ b/src/vnet/ip/ip4_to_ip6.h
@@ -260,8 +260,8 @@ icmp_to_icmp6 (vlib_buffer_t * p, ip4_to_ip6_set_fn_t fn, void *ctx,
-2 * (sizeof (*ip6) - sizeof (*ip4)) -
sizeof (*inner_frag));
ip6 = vlib_buffer_get_current (p);
- clib_memcpy (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4,
- 20 + 8);
+ memmove (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4,
+ 20 + 8);
ip4 =
(ip4_header_t *) u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4));
icmp = (icmp46_header_t *) (ip4 + 1);
@@ -286,8 +286,8 @@ icmp_to_icmp6 (vlib_buffer_t * p, ip4_to_ip6_set_fn_t fn, void *ctx,
{
vlib_buffer_advance (p, -2 * (sizeof (*ip6) - sizeof (*ip4)));
ip6 = vlib_buffer_get_current (p);
- clib_memcpy (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4,
- 20 + 8);
+ memmove (u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4)), ip4,
+ 20 + 8);
ip4 =
(ip4_header_t *) u8_ptr_add (ip6, sizeof (*ip6) - sizeof (*ip4));
icmp = (icmp46_header_t *) u8_ptr_add (ip4, sizeof (*ip4));
diff --git a/src/vnet/ip/ip6_format.c b/src/vnet/ip/ip6_format.c
index b1a8adf58de..4d1793970df 100644
--- a/src/vnet/ip/ip6_format.c
+++ b/src/vnet/ip/ip6_format.c
@@ -235,8 +235,8 @@ unformat_ip6_address_and_mask (unformat_input_t * input, va_list * args)
ip6_address_and_mask_t *am = va_arg (*args, ip6_address_and_mask_t *);
ip6_address_t addr, mask;
- memset (&addr, 0, sizeof (ip6_address_t));
- memset (&mask, 0, sizeof (ip6_address_t));
+ clib_memset (&addr, 0, sizeof (ip6_address_t));
+ clib_memset (&mask, 0, sizeof (ip6_address_t));
if (unformat (input, "any"))
;
@@ -323,7 +323,7 @@ unformat_ip6_header (unformat_input_t * input, va_list * args)
ip = p;
}
- memset (ip, 0, sizeof (ip[0]));
+ clib_memset (ip, 0, sizeof (ip[0]));
ip->ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (6 << 28);
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 9a9a64b54b8..54864ea5d08 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -2514,8 +2514,8 @@ static clib_error_t *
ip6_hop_by_hop_init (vlib_main_t * vm)
{
ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
- memset (hm->options, 0, sizeof (hm->options));
- memset (hm->trace, 0, sizeof (hm->trace));
+ clib_memset (hm->options, 0, sizeof (hm->options));
+ clib_memset (hm->trace, 0, sizeof (hm->trace));
hm->next_override = IP6_LOOKUP_NEXT_POP_HOP_BY_HOP;
return (0);
}
@@ -2649,7 +2649,7 @@ ip6_lookup_init (vlib_main_t * vm)
{
icmp6_neighbor_solicitation_header_t p;
- memset (&p, 0, sizeof (p));
+ clib_memset (&p, 0, sizeof (p));
p.ip.ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (0x6 << 28);
diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c
index 355aba627fb..fbaf0007f19 100644
--- a/src/vnet/ip/ip6_hop_by_hop.c
+++ b/src/vnet/ip/ip6_hop_by_hop.c
@@ -809,9 +809,9 @@ ip6_hop_by_hop_ioam_init (vlib_main_t * vm)
hm->unix_time_0 = (u32) time (0); /* Store starting time */
hm->vlib_time_0 = vlib_time_now (vm);
hm->ioam_flag = IOAM_HBYH_MOD;
- memset (hm->add_options, 0, sizeof (hm->add_options));
- memset (hm->pop_options, 0, sizeof (hm->pop_options));
- memset (hm->options_size, 0, sizeof (hm->options_size));
+ clib_memset (hm->add_options, 0, sizeof (hm->add_options));
+ clib_memset (hm->pop_options, 0, sizeof (hm->pop_options));
+ clib_memset (hm->options_size, 0, sizeof (hm->options_size));
vnet_classify_register_unformat_opaque_index_fn (unformat_opaque_ioam);
diff --git a/src/vnet/ip/ip6_hop_by_hop.h b/src/vnet/ip/ip6_hop_by_hop.h
index 5f12f647dba..6ae2a2e8b51 100644
--- a/src/vnet/ip/ip6_hop_by_hop.h
+++ b/src/vnet/ip/ip6_hop_by_hop.h
@@ -214,7 +214,7 @@ ioam_flow_add (u8 encap, u8 * flow_name)
u8 i;
pool_get (hm->flows, flow);
- memset (flow, 0, sizeof (flow_data_t));
+ clib_memset (flow, 0, sizeof (flow_data_t));
index = flow - hm->flows;
strncpy ((char *) flow->flow_name, (char *) flow_name, 31);
diff --git a/src/vnet/ip/ip6_ll_table.c b/src/vnet/ip/ip6_ll_table.c
index 67d05ed390f..dfcb2708259 100644
--- a/src/vnet/ip/ip6_ll_table.c
+++ b/src/vnet/ip/ip6_ll_table.c
@@ -304,7 +304,7 @@ ip6_ll_show_fib (vlib_main_t * vm,
vlib_cli_output (vm, "%=20s%=16s", "Prefix length", "Count");
- memset (ca, 0, sizeof (*ca));
+ clib_memset (ca, 0, sizeof (*ca));
ca->fib_index = fib_index;
BV (clib_bihash_foreach_key_value_pair)
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index 8466ba70313..369669cc303 100755
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -2653,7 +2653,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
nm->if_radv_pool_index_by_sw_if_index[sw_if_index] = ri;
/* initialize default values (most of which are zero) */
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
a->sw_if_index = sw_if_index;
a->max_radv_interval = DEF_MAX_RADV_INTERVAL;
@@ -2780,7 +2780,7 @@ ip6_neighbor_send_mldpv2_report (u32 sw_if_index)
ip0 = (ip6_header_t *) & rp0->ip;
rh0 = (icmp6_multicast_listener_report_header_t *) & rp0->report_hdr;
- memset (rp0, 0x0, sizeof (icmp6_multicast_listener_report_packet_t));
+ clib_memset (rp0, 0x0, sizeof (icmp6_multicast_listener_report_packet_t));
ip0->ip_version_traffic_class_and_flow_label =
clib_host_to_net_u32 (0x6 << 28);
@@ -2968,7 +2968,7 @@ ip6_neighbor_process_timer_event (vlib_main_t * vm,
h0 = vlib_buffer_get_current (b0);
- memset (h0, 0, sizeof (icmp6_router_solicitation_header_t));
+ clib_memset (h0, 0, sizeof (icmp6_router_solicitation_header_t));
h0->ip.ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (0x6 << 28);
h0->ip.payload_length = clib_host_to_net_u16 (sizeof (icmp6_router_solicitation_header_t)
@@ -3176,8 +3176,8 @@ ip6_discover_neighbor_inline (vlib_main_t * vm,
if (time_now - im->nd_throttle_last_seed_change_time[thread_index] > 1e-3)
{
(void) random_u64 (&im->nd_throttle_seeds[thread_index]);
- memset (im->nd_throttle_bitmaps[thread_index], 0,
- ND_THROTTLE_BITS / BITS (u8));
+ clib_memset (im->nd_throttle_bitmaps[thread_index], 0,
+ ND_THROTTLE_BITS / BITS (u8));
im->nd_throttle_last_seed_change_time[thread_index] = time_now;
}
@@ -3571,7 +3571,7 @@ ip6_neighbor_ra_prefix (vlib_main_t * vm, u32 sw_if_index,
mhash_set (&radv_info->address_to_prefix_index, prefix_addr, pi,
/* old_value */ 0);
- memset (prefix, 0x0, sizeof (ip6_radv_prefix_t));
+ clib_memset (prefix, 0x0, sizeof (ip6_radv_prefix_t));
prefix->prefix_len = prefix_len;
clib_memcpy (&prefix->prefix, prefix_addr, sizeof (ip6_address_t));
@@ -4677,7 +4677,7 @@ ip6_neighbor_init (vlib_main_t * vm)
/* add call backs */
ip6_add_del_interface_address_callback_t cb;
- memset (&cb, 0x0, sizeof (ip6_add_del_interface_address_callback_t));
+ clib_memset (&cb, 0x0, sizeof (ip6_add_del_interface_address_callback_t));
/* when an interface address changes... */
cb.function = ip6_neighbor_add_del_interface_address;
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index ea2fa155b5e..97d33713d3c 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -280,7 +280,7 @@ ip6_address_mask_from_width (ip6_address_t * a, u32 width)
{
int i, byte, bit, bitnum;
ASSERT (width <= 128);
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
for (i = 0; i < width; i++)
{
bitnum = (7 - (i & 7));
diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c
index b8944891cf9..ea8477f81a5 100644
--- a/src/vnet/ip/ip6_punt_drop.c
+++ b/src/vnet/ip/ip6_punt_drop.c
@@ -357,7 +357,7 @@ ip6_punt_redirect_cmd (vlib_main_t * vm,
;
else if (unformat (line_input, "via %U",
unformat_vnet_sw_interface, vnm, &tx_sw_if_index))
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
else
{
error = unformat_parse_error (line_input);
diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c
index e62f9e50588..7f6c5ca4af7 100644
--- a/src/vnet/ip/ip6_reassembly.c
+++ b/src/vnet/ip/ip6_reassembly.c
@@ -402,7 +402,7 @@ ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node,
else
{
pool_get (rt->pool, reass);
- memset (reass, 0, sizeof (*reass));
+ clib_memset (reass, 0, sizeof (*reass));
reass->id =
((u64) os_get_thread_index () * 1000000000) + rt->id_counter;
++rt->id_counter;
@@ -1149,7 +1149,7 @@ ip6_reass_set (u32 timeout_ms, u32 max_reassemblies,
if (ip6_reass_main.max_reass_n > 0 && new_nbuckets > old_nbuckets)
{
clib_bihash_48_8_t new_hash;
- memset (&new_hash, 0, sizeof (new_hash));
+ clib_memset (&new_hash, 0, sizeof (new_hash));
ip6_rehash_cb_ctx ctx;
ctx.failure = 0;
ctx.new_hash = &new_hash;
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 2a342d08599..0d98ba5d597 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -128,7 +128,7 @@ send_ip_neighbor_details (u32 sw_if_index,
vl_api_ip_neighbor_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
@@ -204,7 +204,7 @@ send_ip_fib_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
if (!mp)
return;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
mp->context = context;
@@ -303,7 +303,7 @@ send_ip6_fib_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
if (!mp)
return;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP6_FIB_DETAILS);
mp->context = context;
@@ -418,7 +418,7 @@ send_ip_mfib_details (vl_api_registration_t * reg,
mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
if (!mp)
return;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_MFIB_DETAILS);
mp->context = context;
@@ -512,7 +512,7 @@ send_ip6_mfib_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
if (!mp)
return;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP6_MFIB_DETAILS);
mp->context = context;
@@ -622,7 +622,7 @@ vl_api_ip_punt_redirect_t_handler (vl_api_ip_punt_redirect_t * mp,
{
ip46_address_t nh;
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
if (mp->is_ip6)
{
@@ -998,7 +998,7 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp,
clib_memcpy (&pfx.fp_addr.ip4, mp->dst_address, sizeof (pfx.fp_addr.ip4));
ip46_address_t nh;
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4));
n_labels = mp->next_hop_n_out_labels;
@@ -1072,7 +1072,7 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp,
clib_memcpy (&pfx.fp_addr.ip6, mp->dst_address, sizeof (pfx.fp_addr.ip6));
ip46_address_t nh;
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6));
n_labels = mp->next_hop_n_out_labels;
@@ -1298,7 +1298,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp,
sizeof (pfx.fp_grp_addr.ip4));
clib_memcpy (&pfx.fp_src_addr.ip4, mp->src_address,
sizeof (pfx.fp_src_addr.ip4));
- memset (&nh.ip6, 0, sizeof (nh.ip6));
+ clib_memset (&nh.ip6, 0, sizeof (nh.ip6));
clib_memcpy (&nh.ip4, mp->nh_address, sizeof (nh.ip4));
if (!ip46_address_is_zero (&pfx.fp_src_addr))
pfx.fp_len = 64;
@@ -1361,7 +1361,7 @@ send_ip_details (vpe_api_main_t * am,
vl_api_ip_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_DETAILS);
mp->sw_if_index = ntohl (sw_if_index);
@@ -1380,7 +1380,7 @@ send_ip_address_details (vpe_api_main_t * am,
vl_api_ip_address_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_ADDRESS_DETAILS);
if (is_ipv6)
@@ -1463,7 +1463,7 @@ send_ip_unnumbered_details (vpe_api_main_t * am,
vl_api_ip_unnumbered_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_UNNUMBERED_DETAILS);
mp->context = context;
@@ -1682,7 +1682,7 @@ send_ip6nd_proxy_details (vl_api_registration_t * reg,
vl_api_ip6nd_proxy_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP6ND_PROXY_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
@@ -1868,7 +1868,7 @@ vl_mfib_signal_send_one (vl_api_registration_t * reg,
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MFIB_SIGNAL_DETAILS);
mp->context = context;
@@ -1932,7 +1932,7 @@ static void
int rv = 0;
clib_error_t *error;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
ip_set (&args.prefix.fp_addr, mp->ip, mp->is_ip4);
args.prefix.fp_len = mp->plen ? mp->plen : (mp->is_ip4 ? 32 : 128);
args.sw_if_index = clib_net_to_host_u32 (mp->sw_if_index);
@@ -1963,7 +1963,7 @@ ip_container_proxy_send_details (const fib_prefix_t * pfx, u32 sw_if_index,
if (!mp)
return 1;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_CONTAINER_PROXY_DETAILS);
mp->context = ctx->context;
@@ -2416,7 +2416,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
if (reg && vl_api_can_send_msg (vl_reg))
{
vl_api_ip4_arp_event_t * event = vl_msg_api_alloc (sizeof *event);
- memset (event, 0, sizeof *event);
+ clib_memset (event, 0, sizeof *event);
event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT);
event->client_index = reg->client_index;
event->pid = reg->client_pid;
@@ -2455,7 +2455,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
if (vl_reg && vl_api_can_send_msg (vl_reg))
{
vl_api_ip6_nd_event_t * event = vl_msg_api_alloc (sizeof *event);
- memset (event, 0, sizeof *event);
+ clib_memset (event, 0, sizeof *event);
event->_vl_msg_id = htons (VL_API_IP6_ND_EVENT);
event->client_index = reg->client_index;
event->pid = reg->client_pid;
@@ -2493,7 +2493,7 @@ wc_arp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
sizeof (vl_api_ip6_ra_prefix_info_t);
vl_api_ip6_ra_event_t *event =
vl_msg_api_alloc (event_size);
- memset (event, 0, event_size);
+ clib_memset (event, 0, event_size);
event->_vl_msg_id = htons (VL_API_IP6_RA_EVENT);
event->client_index = reg->client_index;
event->pid = reg->client_pid;
@@ -2641,7 +2641,7 @@ vl_api_want_ip4_arp_events_t_handler (vl_api_want_ip4_arp_events_t * mp)
pool_put (am->arp_events, event);
goto reply;
}
- memset (event, 0, sizeof (*event));
+ clib_memset (event, 0, sizeof (*event));
/* Python API expects events to have no context */
event->_vl_msg_id = htons (VL_API_IP4_ARP_EVENT);
@@ -2779,7 +2779,7 @@ vl_api_want_ip6_nd_events_t_handler (vl_api_want_ip6_nd_events_t * mp)
pool_put (am->nd_events, event);
goto reply;
}
- memset (event, 0, sizeof (*event));
+ clib_memset (event, 0, sizeof (*event));
event->_vl_msg_id = ntohs (VL_API_IP6_ND_EVENT);
event->client_index = mp->client_index;
@@ -2959,7 +2959,7 @@ send_proxy_arp_details (const ip4_address_t * lo_addr,
ctx = data;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_DETAILS);
mp->context = ctx->context;
mp->proxy.vrf_id = htonl (fib_index);
@@ -3002,7 +3002,7 @@ send_proxy_arp_intfc_details (vnet_main_t * vnm,
ctx = data;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_DETAILS);
mp->context = ctx->context;
mp->sw_if_index = htonl (si->sw_if_index);
@@ -3303,7 +3303,7 @@ vl_api_ip_reassembly_get_t_handler (vl_api_ip_reassembly_get_t * mp)
return;
vl_api_ip_reassembly_get_reply_t *rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_IP_REASSEMBLY_GET_REPLY);
rmp->context = mp->context;
rmp->retval = 0;
diff --git a/src/vnet/ip/ip_init.c b/src/vnet/ip/ip_init.c
index ddd66c2e817..638cbd167db 100644
--- a/src/vnet/ip/ip_init.c
+++ b/src/vnet/ip/ip_init.c
@@ -47,7 +47,7 @@ ip_main_init (vlib_main_t * vm)
ip_main_t *im = &ip_main;
clib_error_t *error = 0;
- memset (im, 0, sizeof (im[0]));
+ clib_memset (im, 0, sizeof (im[0]));
{
ip_protocol_info_t *pi;
diff --git a/src/vnet/ip/ip_neighbor.c b/src/vnet/ip/ip_neighbor.c
index f5a816d5a18..7d1998d25b8 100644
--- a/src/vnet/ip/ip_neighbor.c
+++ b/src/vnet/ip/ip_neighbor.c
@@ -312,7 +312,7 @@ ip_neighbor_scan_cli (vlib_main_t * vm, unformat_input_t * input,
u32 interval = 0, time = 0, update = 0, delay = 0, stale = 0;
ip_neighbor_scan_arg_t arg;
- memset (&arg, 0, sizeof (arg));
+ clib_memset (&arg, 0, sizeof (arg));
arg.mode = IP_SCAN_V46_NEIGHBORS;
/* Get a line of input. */
diff --git a/src/vnet/ip/ip_types_api.c b/src/vnet/ip/ip_types_api.c
index f173c28c83b..d5a56fa5547 100644
--- a/src/vnet/ip/ip_types_api.c
+++ b/src/vnet/ip/ip_types_api.c
@@ -38,7 +38,7 @@ ip_address_union_decode (const vl_api_address_union_t * in,
switch (clib_net_to_host_u32 (af))
{
case ADDRESS_IP4:
- memset (out, 0, sizeof (*out));
+ clib_memset (out, 0, sizeof (*out));
clib_memcpy (&out->ip4, &in->ip4, sizeof (out->ip4));
type = IP46_TYPE_IP4;
break;
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index 017ca0db39b..9986a709fef 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -137,7 +137,7 @@ ip_interface_address_add_del (ip_lookup_main_t * lm,
u32 hi; /* head index */
pool_get (lm->if_address_pool, a);
- memset (a, ~0, sizeof (a[0]));
+ clib_memset (a, ~0, sizeof (a[0]));
ai = a - lm->if_address_pool;
hi = pi = lm->if_address_pool_index_by_sw_if_index[sw_if_index];
@@ -336,7 +336,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
is_del = 0;
table_id = 0;
count = 1;
- memset (&pfx, 0, sizeof (pfx));
+ clib_memset (&pfx, 0, sizeof (pfx));
/* Get a line of input. */
if (!unformat_user (main_input, unformat_line_input, line_input))
@@ -344,7 +344,7 @@ vnet_ip_route_cmd (vlib_main_t * vm,
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- memset (&rpath, 0, sizeof (rpath));
+ clib_memset (&rpath, 0, sizeof (rpath));
if (unformat (line_input, "table %d", &table_id))
;
@@ -819,8 +819,8 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
vnm = vnet_get_main ();
is_del = 0;
table_id = 0;
- memset (&pfx, 0, sizeof (pfx));
- memset (&rpath, 0, sizeof (rpath));
+ clib_memset (&pfx, 0, sizeof (pfx));
+ clib_memset (&rpath, 0, sizeof (rpath));
rpath.frp_sw_if_index = ~0;
/* Get a line of input. */
@@ -859,27 +859,27 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
unformat_ip4_address,
&pfx.fp_grp_addr.ip4, &pfx.fp_len))
{
- memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4));
+ clib_memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4));
pfx.fp_proto = FIB_PROTOCOL_IP4;
}
else if (unformat (line_input, "%U/%d",
unformat_ip6_address,
&pfx.fp_grp_addr.ip6, &pfx.fp_len))
{
- memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6));
+ clib_memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6));
pfx.fp_proto = FIB_PROTOCOL_IP6;
}
else if (unformat (line_input, "%U",
unformat_ip4_address, &pfx.fp_grp_addr.ip4))
{
- memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4));
+ clib_memset (&pfx.fp_src_addr.ip4, 0, sizeof (pfx.fp_src_addr.ip4));
pfx.fp_proto = FIB_PROTOCOL_IP4;
pfx.fp_len = 32;
}
else if (unformat (line_input, "%U",
unformat_ip6_address, &pfx.fp_grp_addr.ip6))
{
- memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6));
+ clib_memset (&pfx.fp_src_addr.ip6, 0, sizeof (pfx.fp_src_addr.ip6));
pfx.fp_proto = FIB_PROTOCOL_IP6;
pfx.fp_len = 128;
}
@@ -901,12 +901,12 @@ vnet_ip_mroute_cmd (vlib_main_t * vm,
unformat_vnet_sw_interface, vnm,
&rpath.frp_sw_if_index))
{
- memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
+ clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_weight = 1;
}
else if (unformat (line_input, "via local"))
{
- memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
+ clib_memset (&rpath.frp_addr, 0, sizeof (rpath.frp_addr));
rpath.frp_sw_if_index = ~0;
rpath.frp_weight = 1;
rpath.frp_flags |= FIB_ROUTE_PATH_LOCAL;
@@ -1389,7 +1389,7 @@ ip_container_cmd (vlib_main_t * vm,
vnm = vnet_get_main ();
is_del = 0;
sw_if_index = ~0;
- memset (&pfx, 0, sizeof (pfx));
+ clib_memset (&pfx, 0, sizeof (pfx));
/* Get a line of input. */
if (!unformat_user (main_input, unformat_line_input, line_input))
diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c
index f24a43fdece..538a1ac610e 100644
--- a/src/vnet/ip/punt.c
+++ b/src/vnet/ip/punt.c
@@ -270,7 +270,7 @@ punt_socket_register (bool is_ip4, u8 protocol, u16 port,
punt_client_t *v = is_ip4 ? pm->clients_by_dst_port4 :
pm->clients_by_dst_port6;
- memset (&c, 0, sizeof (c));
+ clib_memset (&c, 0, sizeof (c));
memcpy (c.caddr.sun_path, client_pathname, sizeof (c.caddr.sun_path));
c.caddr.sun_family = AF_UNIX;
c.port = port;
@@ -866,7 +866,7 @@ punt_config (vlib_main_t * vm, unformat_input_t * input)
return clib_error_return (0, "socket error");
}
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
addr.sun_family = AF_UNIX;
if (*socket_path == '\0')
{
diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c
index e6446ef7033..5df968414c8 100644
--- a/src/vnet/ipfix-export/flow_api.c
+++ b/src/vnet/ipfix-export/flow_api.c
@@ -158,7 +158,7 @@ vl_api_ipfix_exporter_dump_t_handler (vl_api_ipfix_exporter_dump_t * mp)
return;;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_IPFIX_EXPORTER_DETAILS);
rmp->context = mp->context;
memcpy (rmp->collector_address, frm->ipfix_collector.data,
@@ -219,7 +219,7 @@ static void
return;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_IPFIX_CLASSIFY_STREAM_DETAILS);
rmp->context = mp->context;
rmp->domain_id = htonl (fcm->domain_id);
@@ -255,7 +255,7 @@ static void
goto out;
}
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
table = 0;
int i;
@@ -316,7 +316,7 @@ send_ipfix_classify_table_details (u32 table_index,
ipfix_classify_table_t *table = &fcm->tables[table_index];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IPFIX_CLASSIFY_TABLE_DETAILS);
mp->context = context;
mp->table_id = htonl (table->classify_table_index);
diff --git a/src/vnet/ipfix-export/flow_report_classify.c b/src/vnet/ipfix-export/flow_report_classify.c
index 196cb725ffe..449bf228ce9 100644
--- a/src/vnet/ipfix-export/flow_report_classify.c
+++ b/src/vnet/ipfix-export/flow_report_classify.c
@@ -408,7 +408,7 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm,
if (fcm->src_port == 0)
clib_error_return (0, "call 'set ipfix classify stream' first");
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index 718463d7352..9c58e520623 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -485,7 +485,7 @@ ipip_add_tunnel (ipip_transport_t transport,
return VNET_API_ERROR_IF_ALREADY_EXISTS;
pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* Reconcile the real dev_instance and a possible requested instance */
u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
@@ -590,7 +590,7 @@ ipip_init (vlib_main_t * vm)
{
ipip_main_t *gm = &ipip_main;
- memset (gm, 0, sizeof (gm[0]));
+ clib_memset (gm, 0, sizeof (gm[0]));
gm->vlib_main = vm;
gm->vnet_main = vnet_get_main ();
gm->tunnel_by_key =
diff --git a/src/vnet/ipip/ipip_api.c b/src/vnet/ipip/ipip_api.c
index b3fc0817a85..94ba1bb4623 100644
--- a/src/vnet/ipip/ipip_api.c
+++ b/src/vnet/ipip/ipip_api.c
@@ -110,7 +110,7 @@ send_ipip_tunnel_details (ipip_tunnel_t * t,
fib_table_t *ft;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = htons (VL_API_IPIP_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/vnet/ipip/sixrd.c b/src/vnet/ipip/sixrd.c
index b03572917cc..cc5bfa33d91 100644
--- a/src/vnet/ipip/sixrd.c
+++ b/src/vnet/ipip/sixrd.c
@@ -297,7 +297,7 @@ sixrd_add_tunnel (ip6_address_t * ip6_prefix, u8 ip6_prefix_len,
/* Get tunnel index */
pool_get_aligned (gm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
u32 t_idx = t - gm->tunnels; /* tunnel index (or instance) */
/* Init tunnel struct */
diff --git a/src/vnet/ipsec-gre/interface.c b/src/vnet/ipsec-gre/interface.c
index 7dc8301e96a..700072350ca 100644
--- a/src/vnet/ipsec-gre/interface.c
+++ b/src/vnet/ipsec-gre/interface.c
@@ -105,7 +105,7 @@ vnet_ipsec_gre_add_del_tunnel (vnet_ipsec_gre_add_del_tunnel_args_t * a,
u64 key;
ipsec_add_del_ipsec_gre_tunnel_args_t args;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
args.is_add = a->is_add;
args.local_sa_id = a->lsa;
args.remote_sa_id = a->rsa;
@@ -122,7 +122,7 @@ vnet_ipsec_gre_add_del_tunnel (vnet_ipsec_gre_add_del_tunnel_args_t * a,
return VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (igm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
if (vec_len (igm->free_ipsec_gre_tunnel_hw_if_indices) > 0)
{
@@ -270,7 +270,7 @@ create_ipsec_gre_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->lsa = lsa;
a->rsa = rsa;
diff --git a/src/vnet/ipsec-gre/ipsec_gre.c b/src/vnet/ipsec-gre/ipsec_gre.c
index abf81e05bb9..758807be175 100644
--- a/src/vnet/ipsec-gre/ipsec_gre.c
+++ b/src/vnet/ipsec-gre/ipsec_gre.c
@@ -374,7 +374,7 @@ ipsec_gre_init (vlib_main_t * vm)
ipsec_gre_main_t *igm = &ipsec_gre_main;
clib_error_t *error;
- memset (igm, 0, sizeof (igm[0]));
+ clib_memset (igm, 0, sizeof (igm[0]));
igm->vlib_main = vm;
igm->vnet_main = vnet_get_main ();
diff --git a/src/vnet/ipsec-gre/ipsec_gre_api.c b/src/vnet/ipsec-gre/ipsec_gre_api.c
index c29b9b8816e..3f85c4fc266 100644
--- a/src/vnet/ipsec-gre/ipsec_gre_api.c
+++ b/src/vnet/ipsec-gre/ipsec_gre_api.c
@@ -62,7 +62,7 @@ vl_api_ipsec_gre_add_del_tunnel_t_handler (vl_api_ipsec_gre_add_del_tunnel_t *
goto out;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* ip addresses sent in network byte order */
clib_memcpy (&(a->src), mp->src_address, 4);
@@ -88,7 +88,7 @@ static void send_ipsec_gre_tunnel_details
vl_api_ipsec_gre_tunnel_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_IPSEC_GRE_TUNNEL_DETAILS);
clib_memcpy (rmp->src_address, &(t->tunnel_src), 4);
clib_memcpy (rmp->dst_address, &(t->tunnel_dst), 4);
diff --git a/src/vnet/ipsec/ah_decrypt.c b/src/vnet/ipsec/ah_decrypt.c
index 941368a9695..a69c7d24f47 100644
--- a/src/vnet/ipsec/ah_decrypt.c
+++ b/src/vnet/ipsec/ah_decrypt.c
@@ -179,11 +179,11 @@ ah_decrypt_inline (vlib_main_t * vm,
{
u8 sig[64];
u8 digest[64];
- memset (sig, 0, sizeof (sig));
- memset (digest, 0, sizeof (digest));
+ clib_memset (sig, 0, sizeof (sig));
+ clib_memset (digest, 0, sizeof (digest));
u8 *icv = ah0->auth_data;
memcpy (digest, icv, icv_size);
- memset (icv, 0, icv_size);
+ clib_memset (icv, 0, icv_size);
if (is_ip6)
{
diff --git a/src/vnet/ipsec/ah_encrypt.c b/src/vnet/ipsec/ah_encrypt.c
index 856eab62c91..47f3b3884c0 100644
--- a/src/vnet/ipsec/ah_encrypt.c
+++ b/src/vnet/ipsec/ah_encrypt.c
@@ -212,7 +212,7 @@ ah_encrypt_inline (vlib_main_t * vm,
{
ip_hdr_size = sizeof (ip4_header_t);
oh0 = vlib_buffer_get_current (i_b0);
- memset (oh0, 0, sizeof (ip4_and_ah_header_t));
+ clib_memset (oh0, 0, sizeof (ip4_and_ah_header_t));
if (PREDICT_TRUE (sa0->is_tunnel))
{
@@ -265,11 +265,11 @@ ah_encrypt_inline (vlib_main_t * vm,
}
u8 sig[64];
- memset (sig, 0, sizeof (sig));
+ clib_memset (sig, 0, sizeof (sig));
u8 *digest =
vlib_buffer_get_current (i_b0) + ip_hdr_size +
sizeof (ah_header_t);
- memset (digest, 0, icv_size);
+ clib_memset (digest, 0, icv_size);
unsigned size = hmac_calc (sa0->integ_alg, sa0->integ_key,
sa0->integ_key_len,
diff --git a/src/vnet/ipsec/esp.h b/src/vnet/ipsec/esp.h
index 73d43262e26..50c4d395ff9 100644
--- a/src/vnet/ipsec/esp.h
+++ b/src/vnet/ipsec/esp.h
@@ -259,7 +259,7 @@ ipsec_proto_init ()
ipsec_proto_main_t *em = &ipsec_proto_main;
vlib_thread_main_t *tm = vlib_get_thread_main ();
- memset (em, 0, sizeof (em[0]));
+ clib_memset (em, 0, sizeof (em[0]));
vec_validate (em->ipsec_proto_main_crypto_algs, IPSEC_CRYPTO_N_ALG - 1);
em->ipsec_proto_main_crypto_algs[IPSEC_CRYPTO_ALG_AES_CBC_128].type =
diff --git a/src/vnet/ipsec/esp_decrypt.c b/src/vnet/ipsec/esp_decrypt.c
index bfddb9ece8d..fc45d7ee63d 100644
--- a/src/vnet/ipsec/esp_decrypt.c
+++ b/src/vnet/ipsec/esp_decrypt.c
@@ -213,7 +213,7 @@ esp_decrypt_inline (vlib_main_t * vm,
u8 sig[64];
int icv_size =
em->ipsec_proto_main_integ_algs[sa0->integ_alg].trunc_size;
- memset (sig, 0, sizeof (sig));
+ clib_memset (sig, 0, sizeof (sig));
u8 *icv =
vlib_buffer_get_current (i_b0) + i_b0->current_length -
icv_size;
diff --git a/src/vnet/ipsec/ikev2.c b/src/vnet/ipsec/ikev2.c
index bb6818e311c..ac20d4a9a10 100644
--- a/src/vnet/ipsec/ikev2.c
+++ b/src/vnet/ipsec/ikev2.c
@@ -1488,7 +1488,7 @@ ikev2_create_tunnel_interface (vnet_main_t * vnm, ikev2_sa_t * sa,
return 1;
}
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = 1;
if (sa->is_initiator)
{
@@ -1832,7 +1832,7 @@ ikev2_generate_message (ikev2_sa_t * sa, ike_header_t * ike, void *user)
ikev2_sa_proposal_t *proposals = (ikev2_sa_proposal_t *) user;
ikev2_notify_t notify;
u8 *data = vec_new (u8, 4);
- memset (&notify, 0, sizeof (notify));
+ clib_memset (&notify, 0, sizeof (notify));
notify.protocol_id = IKEV2_PROTOCOL_ESP;
notify.spi = sa->childs[0].i_proposals->spi;
*(u32 *) data = clib_host_to_net_u32 (notify.spi);
@@ -2116,7 +2116,7 @@ ikev2_node_fn (vlib_main_t * vm,
if (ike0->exchange == IKEV2_EXCHANGE_SA_INIT)
{
sa0 = &sa;
- memset (sa0, 0, sizeof (*sa0));
+ clib_memset (sa0, 0, sizeof (*sa0));
if (ike0->flags & IKEV2_HDR_FLAG_INITIATOR)
{
@@ -2691,7 +2691,7 @@ ikev2_add_del_profile (vlib_main_t * vm, u8 * name, int is_add)
return clib_error_return (0, "policy %v already exists", name);
pool_get (km->profiles, p);
- memset (p, 0, sizeof (*p));
+ clib_memset (p, 0, sizeof (*p));
p->name = vec_dup (name);
p->responder.sw_if_index = ~0;
uword index = p - km->profiles;
@@ -2956,7 +2956,7 @@ ikev2_initiate_sa_init (vlib_main_t * vm, u8 * name)
/* Prepare the SA and the IKE payload */
ikev2_sa_t sa;
- memset (&sa, 0, sizeof (ikev2_sa_t));
+ clib_memset (&sa, 0, sizeof (ikev2_sa_t));
ikev2_payload_chain_t *chain = 0;
ikev2_payload_new_chain (chain);
@@ -3296,7 +3296,7 @@ ikev2_init (vlib_main_t * vm)
vlib_thread_main_t *tm = vlib_get_thread_main ();
int thread_id;
- memset (km, 0, sizeof (ikev2_main_t));
+ clib_memset (km, 0, sizeof (ikev2_main_t));
km->vnet_main = vnet_get_main ();
km->vlib_main = vm;
diff --git a/src/vnet/ipsec/ikev2_crypto.c b/src/vnet/ipsec/ikev2_crypto.c
index d595570de44..037a3f5777e 100644
--- a/src/vnet/ipsec/ikev2_crypto.c
+++ b/src/vnet/ipsec/ikev2_crypto.c
@@ -539,10 +539,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
{
sa->i_dh_data = vec_new (u8, t->key_len);
x_off = len - BN_num_bytes (x);
- memset (sa->i_dh_data, 0, x_off);
+ clib_memset (sa->i_dh_data, 0, x_off);
BN_bn2bin (x, sa->i_dh_data + x_off);
y_off = t->key_len - BN_num_bytes (y);
- memset (sa->i_dh_data + len, 0, y_off - len);
+ clib_memset (sa->i_dh_data + len, 0, y_off - len);
BN_bn2bin (y, sa->i_dh_data + y_off);
const BIGNUM *prv = EC_KEY_get0_private_key (ec);
@@ -554,10 +554,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
{
sa->r_dh_data = vec_new (u8, t->key_len);
x_off = len - BN_num_bytes (x);
- memset (sa->r_dh_data, 0, x_off);
+ clib_memset (sa->r_dh_data, 0, x_off);
BN_bn2bin (x, sa->r_dh_data + x_off);
y_off = t->key_len - BN_num_bytes (y);
- memset (sa->r_dh_data + len, 0, y_off - len);
+ clib_memset (sa->r_dh_data + len, 0, y_off - len);
BN_bn2bin (y, sa->r_dh_data + y_off);
x = BN_bin2bn (sa->i_dh_data, len, x);
@@ -569,10 +569,10 @@ ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y,
bn_ctx);
x_off = len - BN_num_bytes (x);
- memset (sa->dh_shared_key, 0, x_off);
+ clib_memset (sa->dh_shared_key, 0, x_off);
BN_bn2bin (x, sa->dh_shared_key + x_off);
y_off = t->key_len - BN_num_bytes (y);
- memset (sa->dh_shared_key + len, 0, y_off - len);
+ clib_memset (sa->dh_shared_key + len, 0, y_off - len);
BN_bn2bin (y, sa->dh_shared_key + y_off);
}
@@ -658,10 +658,10 @@ ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y, bn_ctx);
sa->dh_shared_key = vec_new (u8, t->key_len);
x_off = len - BN_num_bytes (x);
- memset (sa->dh_shared_key, 0, x_off);
+ clib_memset (sa->dh_shared_key, 0, x_off);
BN_bn2bin (x, sa->dh_shared_key + x_off);
y_off = t->key_len - BN_num_bytes (y);
- memset (sa->dh_shared_key + len, 0, y_off - len);
+ clib_memset (sa->dh_shared_key + len, 0, y_off - len);
BN_bn2bin (y, sa->dh_shared_key + y_off);
EC_KEY_free (ec);
diff --git a/src/vnet/ipsec/ikev2_payload.c b/src/vnet/ipsec/ikev2_payload.c
index 34595380ec1..e5fa0149feb 100644
--- a/src/vnet/ipsec/ikev2_payload.c
+++ b/src/vnet/ipsec/ikev2_payload.c
@@ -111,7 +111,7 @@ ikev2_payload_add_hdr (ikev2_payload_chain_t * c, u8 payload_type, int len)
c->last_hdr_off = vec_len (c->data);
vec_add2 (c->data, tmp, len);
hdr = (ike_payload_header_t *) tmp;
- memset (hdr, 0, len);
+ clib_memset (hdr, 0, len);
hdr->length = clib_host_to_net_u16 (len);
diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c
index d1b82b51326..6e4c7f1b687 100644
--- a/src/vnet/ipsec/ipsec.c
+++ b/src/vnet/ipsec/ipsec.c
@@ -126,7 +126,7 @@ ipsec_add_del_spd (vlib_main_t * vm, u32 spd_id, int is_add)
else /* create new SPD */
{
pool_get (im->spds, spd);
- memset (spd, 0, sizeof (*spd));
+ clib_memset (spd, 0, sizeof (*spd));
spd_index = spd - im->spds;
spd->id = spd_id;
hash_set (im->spd_index_by_spd_id, spd_id, spd_index);
@@ -546,7 +546,7 @@ ipsec_init (vlib_main_t * vm)
ipsec_rand_seed ();
- memset (im, 0, sizeof (im[0]));
+ clib_memset (im, 0, sizeof (im[0]));
im->vnet_main = vnet_get_main ();
im->vlib_main = vm;
diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c
index 37daee0b64f..f80c3400a6f 100644
--- a/src/vnet/ipsec/ipsec_api.c
+++ b/src/vnet/ipsec/ipsec_api.c
@@ -125,7 +125,7 @@ static void vl_api_ipsec_spd_add_del_entry_t_handler
#if WITH_LIBSSL > 0
ipsec_policy_t p;
- memset (&p, 0, sizeof (p));
+ clib_memset (&p, 0, sizeof (p));
p.id = ntohl (mp->spd_id);
p.priority = ntohl (mp->priority);
@@ -189,7 +189,7 @@ static void vl_api_ipsec_sad_add_del_entry_t_handler
ipsec_main_t *im = &ipsec_main;
ipsec_sa_t sa;
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.id = ntohl (mp->sad_id);
sa.spi = ntohl (mp->spi);
@@ -259,7 +259,7 @@ send_ipsec_spds_details (ipsec_spd_t * spd, vl_api_registration_t * reg,
vl_api_ipsec_spds_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IPSEC_SPDS_DETAILS);
mp->context = context;
@@ -297,7 +297,7 @@ send_ipsec_spd_details (ipsec_policy_t * p, vl_api_registration_t * reg,
vl_api_ipsec_spd_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IPSEC_SPD_DETAILS);
mp->context = context;
@@ -401,7 +401,7 @@ vl_api_ipsec_tunnel_if_add_del_t_handler (vl_api_ipsec_tunnel_if_add_del_t *
#if WITH_LIBSSL > 0
ipsec_add_del_tunnel_args_t tun;
- memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t));
+ clib_memset (&tun, 0, sizeof (ipsec_add_del_tunnel_args_t));
tun.is_add = mp->is_add;
tun.esn = mp->esn;
@@ -447,7 +447,7 @@ send_ipsec_sa_details (ipsec_sa_t * sa, vl_api_registration_t * reg,
vl_api_ipsec_sa_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IPSEC_SA_DETAILS);
mp->context = context;
diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c
index 9cbd2493ed4..4e382bdeab5 100644
--- a/src/vnet/ipsec/ipsec_cli.c
+++ b/src/vnet/ipsec/ipsec_cli.c
@@ -79,7 +79,7 @@ ipsec_sa_add_del_command_fn (vlib_main_t * vm,
u8 *ck = 0, *ik = 0;
clib_error_t *error = NULL;
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -262,7 +262,7 @@ ipsec_policy_add_del_command_fn (vlib_main_t * vm,
u32 tmp, tmp2;
clib_error_t *error = NULL;
- memset (&p, 0, sizeof (p));
+ clib_memset (&p, 0, sizeof (p));
p.lport.stop = p.rport.stop = ~0;
p.laddr.stop.ip4.as_u32 = p.raddr.stop.ip4.as_u32 = (u32) ~ 0;
p.laddr.stop.ip6.as_u64[0] = p.laddr.stop.ip6.as_u64[1] = (u64) ~ 0;
@@ -394,7 +394,7 @@ set_ipsec_sa_key_command_fn (vlib_main_t * vm,
u8 *ck = 0, *ik = 0;
clib_error_t *error = NULL;
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -746,7 +746,7 @@ create_ipsec_tunnel_command_fn (vlib_main_t * vm,
u32 num_m_args = 0;
clib_error_t *error = NULL;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.is_add = 1;
/* Get a line of input. */
diff --git a/src/vnet/ipsec/ipsec_if.c b/src/vnet/ipsec/ipsec_if.c
index 2640f25c011..b8cba149584 100644
--- a/src/vnet/ipsec/ipsec_if.c
+++ b/src/vnet/ipsec/ipsec_if.c
@@ -291,7 +291,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
dev_instance = t - im->tunnel_interfaces;
if (args->renumber)
@@ -309,7 +309,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm,
dev_instance);
pool_get (im->sad, sa);
- memset (sa, 0, sizeof (*sa));
+ clib_memset (sa, 0, sizeof (*sa));
t->input_sa_index = sa - im->sad;
sa->spi = args->remote_spi;
sa->tunnel_src_addr.ip4.as_u32 = args->remote_ip.as_u32;
@@ -334,7 +334,7 @@ ipsec_add_del_tunnel_if_internal (vnet_main_t * vnm,
}
pool_get (im->sad, sa);
- memset (sa, 0, sizeof (*sa));
+ clib_memset (sa, 0, sizeof (*sa));
t->output_sa_index = sa - im->sad;
sa->spi = args->local_spi;
sa->tunnel_src_addr.ip4.as_u32 = args->local_ip.as_u32;
@@ -456,7 +456,7 @@ ipsec_add_del_ipsec_gre_tunnel (vnet_main_t * vnm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get_aligned (im->tunnel_interfaces, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->input_sa_index = isa;
t->output_sa_index = osa;
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c
index eb04459f234..377880c3e64 100644
--- a/src/vnet/l2/l2_api.c
+++ b/src/vnet/l2/l2_api.c
@@ -80,7 +80,7 @@ send_l2_xconnect_details (vl_api_registration_t * reg, u32 context,
vl_api_l2_xconnect_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_L2_XCONNECT_DETAILS);
mp->context = context;
mp->rx_sw_if_index = htonl (rx_sw_if_index);
@@ -135,7 +135,7 @@ send_l2fib_table_entry (vpe_api_main_t * am,
vl_api_l2_fib_table_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_DETAILS);
mp->bd_id =
@@ -456,7 +456,7 @@ send_bridge_domain_details (l2input_main_t * l2im,
mp = vl_msg_api_alloc (sizeof (*mp) +
(n_sw_ifs * sizeof (vl_api_bridge_domain_sw_if_t)));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
mp->bd_id = ntohl (bd_config->bd_id);
mp->flood = bd_feature_flood (bd_config);
@@ -781,7 +781,7 @@ send_bd_ip_mac_entry (vpe_api_main_t * am,
vl_api_bd_ip_mac_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_BD_IP_MAC_DETAILS);
mp->bd_id = ntohl (bd_id);
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index 47bdce6af68..59149093b21 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -1298,7 +1298,7 @@ bd_add_del_command_fn (vlib_main_t * vm, unformat_input_t * input,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->bd_id = bd_id;
a->flood = (u8) flood;
diff --git a/src/vnet/l2/l2_fib.c b/src/vnet/l2/l2_fib.c
index aa325052487..46c041e72a0 100644
--- a/src/vnet/l2/l2_fib.c
+++ b/src/vnet/l2/l2_fib.c
@@ -1242,7 +1242,7 @@ l2fib_init (vlib_main_t * vm)
L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE);
/* verify the key constructor is good, since it is endian-sensitive */
- memset (test_mac, 0, sizeof (test_mac));
+ clib_memset (test_mac, 0, sizeof (test_mac));
test_mac[0] = 0x11;
test_key.raw = 0;
test_key.raw = l2fib_make_key ((u8 *) & test_mac, 0x1234);
diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c
index 9727d408088..fbd3b940fae 100644
--- a/src/vnet/l2/l2_input.c
+++ b/src/vnet/l2/l2_input.c
@@ -649,7 +649,7 @@ set_int_l2_mode (vlib_main_t * vm, vnet_main_t * vnet_main, /* */
/* Clear L2 output config */
out_config = l2output_intf_config (sw_if_index);
- memset (out_config, 0, sizeof (l2_output_config_t));
+ clib_memset (out_config, 0, sizeof (l2_output_config_t));
/* Make sure any L2-output packet to this interface now in L3 mode is
* dropped. This may happen if L2 FIB MAC entry is stale */
diff --git a/src/vnet/l2/l2_rw.c b/src/vnet/l2/l2_rw.c
index 0b5e970944d..5b0034ca43e 100644
--- a/src/vnet/l2/l2_rw.c
+++ b/src/vnet/l2/l2_rw.c
@@ -381,9 +381,9 @@ l2_rw_mod_entry (u32 * index,
skip -= e->skip_n_vectors * sizeof (u32x4);
e->rewrite_n_vectors = (skip + len - 1) / sizeof (u32x4) + 1;
vec_alloc_aligned (e->mask, e->rewrite_n_vectors, sizeof (u32x4));
- memset (e->mask, 0, e->rewrite_n_vectors * sizeof (u32x4));
+ clib_memset (e->mask, 0, e->rewrite_n_vectors * sizeof (u32x4));
vec_alloc_aligned (e->value, e->rewrite_n_vectors, sizeof (u32x4));
- memset (e->value, 0, e->rewrite_n_vectors * sizeof (u32x4));
+ clib_memset (e->value, 0, e->rewrite_n_vectors * sizeof (u32x4));
clib_memcpy (((u8 *) e->value) + skip, value, len);
clib_memcpy (((u8 *) e->mask) + skip, mask, len);
diff --git a/src/vnet/l2/l2_xcrw.c b/src/vnet/l2/l2_xcrw.c
index 334e8641455..b7ccd81806f 100644
--- a/src/vnet/l2/l2_xcrw.c
+++ b/src/vnet/l2/l2_xcrw.c
@@ -306,7 +306,7 @@ create_xcrw_interface (vlib_main_t * vm)
u32 sw_if_index;
/* mac address doesn't really matter */
- memset (address, 0, sizeof (address));
+ clib_memset (address, 0, sizeof (address));
address[2] = 0x12;
/* can returns error iff phy != 0 */
@@ -352,7 +352,7 @@ vnet_configure_l2_xcrw (vlib_main_t * vm, vnet_main_t * vnm,
vec_validate (xcm->adj_by_sw_if_index, t->l2_sw_if_index);
a = vec_elt_at_index (xcm->adj_by_sw_if_index, t->l2_sw_if_index);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->rewrite_header.sw_if_index = tx_fib_index;
@@ -382,7 +382,7 @@ vnet_configure_l2_xcrw (vlib_main_t * vm, vnet_main_t * vnm,
a = vec_elt_at_index (xcm->adj_by_sw_if_index, t->l2_sw_if_index);
/* Reset adj to drop traffic */
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
set_int_l2_mode (vm, vnm, MODE_L3, t->l2_sw_if_index, 0,
L2_BD_PORT_TYPE_NORMAL, 0, 0);
diff --git a/src/vnet/l2tp/l2tp.c b/src/vnet/l2tp/l2tp.c
index 300bd53a430..99ae6c4d79e 100644
--- a/src/vnet/l2tp/l2tp.c
+++ b/src/vnet/l2tp/l2tp.c
@@ -334,7 +334,7 @@ create_l2tpv3_ipv6_tunnel (l2t_main_t * lm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
clib_memcpy (&s->our_address, our_address, sizeof (s->our_address));
clib_memcpy (&s->client_address, client_address,
sizeof (s->client_address));
diff --git a/src/vnet/l2tp/l2tp_api.c b/src/vnet/l2tp/l2tp_api.c
index 0e0e2c2186e..6b48c140c71 100644
--- a/src/vnet/l2tp/l2tp_api.c
+++ b/src/vnet/l2tp/l2tp_api.c
@@ -65,7 +65,7 @@ send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
format_vnet_sw_interface_name, lm->vnet_main, si);
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_IF_L2TPV3_TUNNEL_DETAILS);
strncpy ((char *) mp->interface_name,
(char *) if_name, ARRAY_LEN (mp->interface_name) - 1);
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index 67b1fc4822a..a432783ddd8 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -149,7 +149,7 @@ ip_address_to_fib_prefix (const ip_address_t * addr, fib_prefix_t * prefix)
{
prefix->fp_len = 32;
prefix->fp_proto = FIB_PROTOCOL_IP4;
- memset (&prefix->fp_addr.pad, 0, sizeof (prefix->fp_addr.pad));
+ clib_memset (&prefix->fp_addr.pad, 0, sizeof (prefix->fp_addr.pad));
memcpy (&prefix->fp_addr.ip4, &addr->ip, sizeof (prefix->fp_addr.ip4));
}
else
@@ -272,7 +272,7 @@ dp_del_fwd_entry (lisp_cp_main_t * lcm, u32 dst_map_index)
vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a;
fwd_entry_t *fe = 0;
uword *feip = 0;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
feip = hash_get (lcm->fwd_entry_by_mapping_index, dst_map_index);
if (!feip)
@@ -377,7 +377,7 @@ get_locator_pairs (lisp_cp_main_t * lcm, mapping_t * lcl_map,
lcl_addr))
continue;
- memset (&pair, 0, sizeof (pair));
+ clib_memset (&pair, 0, sizeof (pair));
ip_address_copy (&pair.rmt_loc,
&gid_address_ip (&rmt->address));
ip_address_copy (&pair.lcl_loc, lcl_addr);
@@ -446,7 +446,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index)
u8 type, is_src_dst = 0;
int rv;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
/* remove entry if it already exists */
feip = hash_get (lcm->fwd_entry_by_mapping_index, dst_map_index);
@@ -574,7 +574,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index)
if (!rmts_stored_idxp)
{
pool_get (lcm->lcl_to_rmt_adjacencies, rmts);
- memset (rmts, 0, sizeof (*rmts));
+ clib_memset (rmts, 0, sizeof (*rmts));
rmts_idx = rmts - lcm->lcl_to_rmt_adjacencies;
hash_set (lcm->lcl_to_rmt_adjs_by_lcl_idx, src_map_index, rmts_idx);
}
@@ -606,7 +606,7 @@ dp_add_fwd_entry_from_mt (u32 si, u32 di)
{
fwd_entry_mt_arg_t a;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
a.si = si;
a.di = di;
@@ -699,7 +699,7 @@ vnet_lisp_add_del_map_server (ip_address_t * addr, u8 is_add)
return -1;
}
- memset (ms, 0, sizeof (*ms));
+ clib_memset (ms, 0, sizeof (*ms));
ip_address_copy (&ms->address, addr);
vec_add1 (lcm->map_servers, ms[0]);
@@ -1213,7 +1213,7 @@ remove_overlapping_sub_prefixes (lisp_cp_main_t * lcm, gid_address_t * eid,
gid_address_t *e;
remove_mapping_args_t a;
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
/* do this only in src/dst mode ... */
if (MR_MODE_SRC_DST != lcm->map_request_mode)
@@ -1234,7 +1234,7 @@ remove_overlapping_sub_prefixes (lisp_cp_main_t * lcm, gid_address_t * eid,
{
vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args;
- memset (adj_args, 0, sizeof (adj_args[0]));
+ clib_memset (adj_args, 0, sizeof (adj_args[0]));
gid_address_copy (&adj_args->reid, e);
adj_args->is_add = 0;
if (vnet_lisp_add_del_adjacency (adj_args))
@@ -1297,7 +1297,7 @@ vnet_lisp_add_mapping (vnet_lisp_add_del_mapping_args_t * a,
if (is_updated)
is_updated[0] = 0;
- memset (ls_args, 0, sizeof (ls_args[0]));
+ clib_memset (ls_args, 0, sizeof (ls_args[0]));
ls_args->locators = rlocs;
mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &a->eid);
@@ -1393,8 +1393,8 @@ vnet_lisp_del_mapping (gid_address_t * eid, u32 * res_map_index)
mapping_t *old_map;
u32 mi;
- memset (ls_args, 0, sizeof (ls_args[0]));
- memset (m_args, 0, sizeof (m_args[0]));
+ clib_memset (ls_args, 0, sizeof (ls_args[0]));
+ clib_memset (m_args, 0, sizeof (m_args[0]));
if (res_map_index)
res_map_index[0] = ~0;
@@ -1604,7 +1604,7 @@ vnet_lisp_nsh_set_locator_set (u8 * locator_set_name, u8 is_add)
locator_set_index = p[0];
pool_get (lcm->mapping_pool, m);
- memset (m, 0, sizeof *m);
+ clib_memset (m, 0, sizeof *m);
m->locator_set_index = locator_set_index;
m->local = 1;
m->nsh_set = 1;
@@ -1709,12 +1709,12 @@ vnet_lisp_use_petr (ip_address_t * ip, u8 is_add)
return VNET_API_ERROR_LISP_DISABLED;
}
- memset (ls_args, 0, sizeof (*ls_args));
+ clib_memset (ls_args, 0, sizeof (*ls_args));
if (is_add)
{
/* Create dummy petr locator-set */
- memset (&loc, 0, sizeof (loc));
+ clib_memset (&loc, 0, sizeof (loc));
gid_address_from_ip (&loc.address, ip);
loc.priority = 1;
loc.state = loc.weight = 1;
@@ -1848,7 +1848,7 @@ update_adjacencies_by_map_index (lisp_cp_main_t * lcm,
uword *fei = 0, *rmts_idxp = 0;
u32 **rmts = 0, *remote_idxp = 0, *rmts_copy = 0;
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
map = pool_elt_at_index (lcm->mapping_pool, mapping_index);
@@ -2089,7 +2089,7 @@ vnet_lisp_add_del_locator_set (vnet_lisp_add_del_locator_set_args_t * a,
else
{
pool_get (lcm->locator_set_pool, ls);
- memset (ls, 0, sizeof (*ls));
+ clib_memset (ls, 0, sizeof (*ls));
ls_index = ls - lcm->locator_set_pool;
if (a->local)
@@ -2348,7 +2348,7 @@ vnet_lisp_add_del_map_resolver (vnet_lisp_add_del_map_resolver_args_t * a)
return -1;
}
- memset (mr, 0, sizeof (*mr));
+ clib_memset (mr, 0, sizeof (*mr));
ip_address_copy (&mr->address, &a->address);
vec_add1 (lcm->map_resolvers, *mr);
@@ -2511,7 +2511,7 @@ build_itr_rloc_list (lisp_cp_main_t * lcm, locator_set_t * loc_set)
ip_prefix_t *ippref = &gid_address_ippref (gid);
ip_address_t *rloc = &ip_prefix_addr (ippref);
- memset (gid, 0, sizeof (gid[0]));
+ clib_memset (gid, 0, sizeof (gid[0]));
gid_address_type (gid) = GID_ADDR_IP_PREFIX;
for (i = 0; i < vec_len (loc_set->locator_indices); i++)
{
@@ -2611,7 +2611,7 @@ build_encapsulated_map_request (lisp_cp_main_t * lcm,
&& GID_ADDR_SRC_DST != gid_address_type (deid))
{
gid_address_t sd;
- memset (&sd, 0, sizeof (sd));
+ clib_memset (&sd, 0, sizeof (sd));
build_src_dst (&sd, seid, deid);
lisp_msg_put_mreq (lcm, b, seid, &sd, rlocs, is_smr_invoked,
0 /* rloc probe */ , nonce_res);
@@ -3010,7 +3010,7 @@ send_map_register (lisp_cp_main_t * lcm, u8 want_map_notif)
map_registers_sent++;
pool_get (lcm->pending_map_registers_pool, pmr);
- memset (pmr, 0, sizeof (*pmr));
+ clib_memset (pmr, 0, sizeof (*pmr));
pmr->time_to_expire = PENDING_MREG_EXPIRATION_TIME;
hash_set (lcm->map_register_messages_by_nonce, nonce,
pmr - lcm->pending_map_registers_pool);
@@ -3178,7 +3178,7 @@ _send_encapsulated_map_request (lisp_cp_main_t * lcm,
{
/* add map-request to pending requests table */
pool_get (lcm->pending_map_requests_pool, pmr);
- memset (pmr, 0, sizeof (*pmr));
+ clib_memset (pmr, 0, sizeof (*pmr));
gid_address_copy (&pmr->src, seid);
gid_address_copy (&pmr->dst, deid);
clib_fifo_add1 (pmr->nonces, nonce);
@@ -3274,8 +3274,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b,
u32 vni = 0;
icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
- memset (src, 0, sizeof (*src));
- memset (dst, 0, sizeof (*dst));
+ clib_memset (src, 0, sizeof (*src));
+ clib_memset (dst, 0, sizeof (*dst));
gid_address_type (dst) = GID_ADDR_NO_ADDRESS;
gid_address_type (src) = GID_ADDR_NO_ADDRESS;
@@ -3314,8 +3314,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b,
if (clib_net_to_host_u16 (ah->opcode)
!= ETHERNET_ARP_OPCODE_request)
{
- memset (&gid_address_arp_ndp_ip (dst), 0,
- sizeof (ip_address_t));
+ clib_memset (&gid_address_arp_ndp_ip (dst), 0,
+ sizeof (ip_address_t));
ip_addr_version (&gid_address_arp_ndp_ip (dst)) = IP4;
gid_address_arp_ndp_bd (dst) = ~0;
return;
@@ -3346,8 +3346,8 @@ get_src_and_dst_eids_from_buffer (lisp_cp_main_t * lcm, vlib_buffer_t * b,
ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address)
|| (opt->header.n_data_u64s != 1))
{
- memset (&gid_address_arp_ndp_ip (dst), 0,
- sizeof (ip_address_t));
+ clib_memset (&gid_address_arp_ndp_ip (dst), 0,
+ sizeof (ip_address_t));
ip_addr_version (&gid_address_arp_ndp_ip (dst)) =
IP6;
gid_address_arp_ndp_bd (dst) = ~0;
@@ -3556,7 +3556,7 @@ lisp_cp_lookup_inline (vlib_main_t * vm,
lisp_cp_lookup_trace_t *tr = vlib_add_trace (vm, node, b0,
sizeof (*tr));
- memset (tr, 0, sizeof (*tr));
+ clib_memset (tr, 0, sizeof (*tr));
gid_address_copy (&tr->dst_eid, &dst);
ip_address_copy (&tr->map_resolver_ip,
&lcm->active_map_resolver);
@@ -3727,7 +3727,7 @@ remove_expired_mapping (lisp_cp_main_t * lcm, u32 mi)
{
mapping_t *m;
vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args;
- memset (adj_args, 0, sizeof (adj_args[0]));
+ clib_memset (adj_args, 0, sizeof (adj_args[0]));
m = pool_elt_at_index (lcm->mapping_pool, mi);
@@ -3778,7 +3778,7 @@ process_expired_mapping (lisp_cp_main_t * lcm, u32 mi)
fe = pool_elt_at_index (lcm->fwd_entry_pool, fei[0]);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->rmt_eid = fe->reid;
if (fe->is_src_dst)
a->lcl_eid = fe->leid;
@@ -3797,7 +3797,7 @@ process_expired_mapping (lisp_cp_main_t * lcm, u32 mi)
{
/* mapping is in use, re-fetch */
map_request_args_t mr_args;
- memset (&mr_args, 0, sizeof (mr_args));
+ clib_memset (&mr_args, 0, sizeof (mr_args));
mr_args.seid = fe->leid;
mr_args.deid = fe->reid;
@@ -3861,7 +3861,7 @@ process_map_reply (map_records_arg_t * a)
vec_foreach (m, a->mappings)
{
vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
- memset (m_args, 0, sizeof (m_args[0]));
+ clib_memset (m_args, 0, sizeof (m_args[0]));
gid_address_copy (&m_args->eid, &m->eid);
m_args->action = m->action;
m_args->authoritative = m->authoritative;
@@ -3878,7 +3878,7 @@ process_map_reply (map_records_arg_t * a)
{
/* try to program forwarding only if mapping saved or updated */
vnet_lisp_add_del_adjacency_args_t _adj_args, *adj_args = &_adj_args;
- memset (adj_args, 0, sizeof (adj_args[0]));
+ clib_memset (adj_args, 0, sizeof (adj_args[0]));
gid_address_copy (&adj_args->leid, &pmr->src);
gid_address_copy (&adj_args->reid, &m->eid);
@@ -3929,7 +3929,7 @@ is_auth_data_valid (map_notify_hdr_t * h, u32 msg_len,
clib_memcpy (auth_data, MNOTIFY_DATA (h), auth_data_len);
/* clear auth data */
- memset (MNOTIFY_DATA (h), 0, auth_data_len);
+ clib_memset (MNOTIFY_DATA (h), 0, auth_data_len);
/* get hash of the message */
unsigned char *code = HMAC (get_encrypt_fcn (key_id), key, vec_len (key),
@@ -4022,7 +4022,7 @@ parse_map_records (vlib_buffer_t * b, map_records_arg_t * a, u8 count)
mapping_t m;
locator_t *loc;
- memset (&m, 0, sizeof (m));
+ clib_memset (&m, 0, sizeof (m));
/* parse record eid */
for (i = 0; i < count; i++)
@@ -4077,10 +4077,10 @@ parse_map_notify (vlib_buffer_t * b)
map_records_arg_t *a;
a = map_record_args_get ();
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
mnotif_hdr = vlib_buffer_get_current (b);
vlib_buffer_pull (b, sizeof (*mnotif_hdr));
- memset (&deid, 0, sizeof (deid));
+ clib_memset (&deid, 0, sizeof (deid));
a->nonce = MNOTIFY_NONCE (mnotif_hdr);
key_id = clib_net_to_host_u16 (MNOTIFY_KEY_ID (mnotif_hdr));
@@ -4163,7 +4163,7 @@ send_map_reply (lisp_cp_main_t * lcm, u32 mi, ip_address_t * dst,
vec_add1 (records, m[0]);
add_locators (lcm, &records[0], m->locator_set_index, probed_loc);
- memset (&src, 0, sizeof (src));
+ clib_memset (&src, 0, sizeof (src));
if (!ip_fib_get_first_egress_ip_for_dst (lcm, dst, &src))
{
@@ -4244,7 +4244,7 @@ process_map_request (vlib_main_t * vm, vlib_node_runtime_t * node,
/* parse eid records and send SMR-invoked map-requests */
for (i = 0; i < MREQ_REC_COUNT (mreq_hdr); i++)
{
- memset (&dst, 0, sizeof (dst));
+ clib_memset (&dst, 0, sizeof (dst));
len = lisp_msg_parse_eid_rec (b, &dst);
if (len == ~0)
{
@@ -4266,7 +4266,7 @@ process_map_request (vlib_main_t * vm, vlib_node_runtime_t * node,
goto done;
}
rloc_probe_recv++;
- memset (&m, 0, sizeof (m));
+ clib_memset (&m, 0, sizeof (m));
u32 mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &dst);
// TODO: select best locator; for now use the first one
@@ -4302,7 +4302,7 @@ parse_map_reply (vlib_buffer_t * b)
map_records_arg_t *a;
a = map_record_args_get ();
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
locator_t *locators;
@@ -4318,7 +4318,7 @@ parse_map_reply (vlib_buffer_t * b)
for (i = 0; i < MREP_REC_COUNT (mrep_hdr); i++)
{
- memset (&m, 0, sizeof (m));
+ clib_memset (&m, 0, sizeof (m));
locators = 0;
h = vlib_buffer_get_current (b);
@@ -4473,8 +4473,9 @@ lisp_cp_init (vlib_main_t * vm)
lcm->flags = 0;
lcm->pitr_map_index = ~0;
lcm->petr_map_index = ~0;
- memset (&lcm->active_map_resolver, 0, sizeof (lcm->active_map_resolver));
- memset (&lcm->active_map_server, 0, sizeof (lcm->active_map_server));
+ clib_memset (&lcm->active_map_resolver, 0,
+ sizeof (lcm->active_map_resolver));
+ clib_memset (&lcm->active_map_server, 0, sizeof (lcm->active_map_server));
gid_dictionary_init (&lcm->mapping_index_by_gid);
lcm->do_map_resolver_election = 1;
@@ -4512,8 +4513,8 @@ lisp_stats_api_fill (lisp_cp_main_t * lcm, lisp_gpe_main_t * lgm,
const lisp_gpe_tunnel_t *lgt;
fwd_entry_t *fe;
- memset (stat, 0, sizeof (*stat));
- memset (&fwd_key, 0, sizeof (fwd_key));
+ clib_memset (stat, 0, sizeof (*stat));
+ clib_memset (&fwd_key, 0, sizeof (fwd_key));
fe = pool_elt_at_index (lcm->fwd_entry_pool, key->fwd_entry_index);
ASSERT (fe != 0);
diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/vnet/lisp-cp/gid_dictionary.c
index 73aecbe3408..2d8fbc80404 100644
--- a/src/vnet/lisp-cp/gid_dictionary.c
+++ b/src/vnet/lisp-cp/gid_dictionary.c
@@ -305,7 +305,7 @@ ip_sd_lookup (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst,
if (!src)
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
return ip4_lookup_exact_match (sfib4, 0, &sp);
}
else
@@ -322,7 +322,7 @@ ip_sd_lookup (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst,
if (!src)
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
ip_prefix_version (&sp) = IP6;
return ip6_lookup_exact_match (sfib6, 0, &sp);
}
@@ -557,8 +557,8 @@ ip4_lookup_init (gid_ip4_table_t * db)
{
uword i;
- memset (db->ip4_prefix_len_refcount, 0,
- sizeof (db->ip4_prefix_len_refcount));
+ clib_memset (db->ip4_prefix_len_refcount, 0,
+ sizeof (db->ip4_prefix_len_refcount));
for (i = 0; i < ARRAY_LEN (db->ip4_fib_masks); i++)
{
@@ -606,7 +606,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add);
}
}
@@ -622,7 +622,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
old_val =
add_del_ip4_key (sfib, 0 /* vni */ , &sp, val, is_add);
}
@@ -638,7 +638,7 @@ add_del_sd_ip4_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
old_val = add_del_ip4_key (sfib, 0, &sp, 0, is_add);
}
@@ -755,8 +755,8 @@ ip6_lookup_init (gid_ip6_table_t * db)
{
uword i;
- memset (db->ip6_prefix_len_refcount, 0,
- sizeof (db->ip6_prefix_len_refcount));
+ clib_memset (db->ip6_prefix_len_refcount, 0,
+ sizeof (db->ip6_prefix_len_refcount));
for (i = 0; i < ARRAY_LEN (db->ip6_fib_masks); i++)
{
@@ -809,7 +809,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
ip_prefix_version (&sp) = IP6;
add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
}
@@ -826,7 +826,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
ip_prefix_version (&sp) = IP6;
old_val =
add_del_ip6_key (sfib, 0 /* vni */ , &sp, val, is_add);
@@ -843,7 +843,7 @@ add_del_sd_ip6_key (gid_dictionary_t * db, u32 vni, ip_prefix_t * dst_pref,
else
{
ip_prefix_t sp;
- memset (&sp, 0, sizeof (sp));
+ clib_memset (&sp, 0, sizeof (sp));
ip_prefix_version (&sp) = IP6;
old_val = add_del_ip6_key (sfib, 0, &sp, 0, is_add);
}
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c
index b116ecf4239..5d426b6277c 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/vnet/lisp-cp/lisp_api.c
@@ -102,7 +102,7 @@ unformat_lisp_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num)
{
/* remote locators */
r = &rmt_locs[i];
- memset (&loc, 0, sizeof (loc));
+ clib_memset (&loc, 0, sizeof (loc));
gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
loc.priority = r->priority;
@@ -126,7 +126,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
u8 *locator_name = NULL;
int i;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
locator_name = format (0, "%s", mp->locator_set_name);
@@ -137,7 +137,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
a->local = 1;
locator_num = clib_net_to_host_u32 (mp->locator_num);
- memset (&locator, 0, sizeof (locator));
+ clib_memset (&locator, 0, sizeof (locator));
for (i = 0; i < locator_num; i++)
{
ls_loc = &mp->locators[i];
@@ -175,8 +175,8 @@ vl_api_lisp_add_del_locator_t_handler (vl_api_lisp_add_del_locator_t * mp)
u32 ls_index = ~0;
u8 *locator_name = NULL;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
locator.sw_if_index = ntohl (mp->sw_if_index);
locator.priority = mp->priority;
@@ -244,8 +244,8 @@ vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp)
u32 locator_set_index = ~0, map_index = ~0;
vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
u8 *name = NULL, *key = NULL;
- memset (a, 0, sizeof (a[0]));
- memset (eid, 0, sizeof (eid[0]));
+ clib_memset (a, 0, sizeof (a[0]));
+ clib_memset (eid, 0, sizeof (eid[0]));
rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->prefix_len);
@@ -303,7 +303,7 @@ vl_api_lisp_add_del_map_server_t_handler (vl_api_lisp_add_del_map_server_t
int rv = 0;
ip_address_t addr;
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
@@ -319,7 +319,7 @@ vl_api_lisp_add_del_map_resolver_t_handler (vl_api_lisp_add_del_map_resolver_t
int rv = 0;
vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
a->is_add = mp->is_add;
ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
@@ -429,7 +429,7 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp)
u8 status = 0;
gid_address_t addr;
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
status = lcm->flags & LISP_FLAG_USE_PETR;
if (status)
{
@@ -501,7 +501,7 @@ static void
gid_address_t _eid, *eid = &_eid;
u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
- memset (eid, 0, sizeof (eid[0]));
+ clib_memset (eid, 0, sizeof (eid[0]));
rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->eid_len);
@@ -513,7 +513,7 @@ static void
if (!mp->is_add)
{
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
gid_address_copy (&a->reid, eid);
a->is_add = 0;
rv = vnet_lisp_add_del_adjacency (a);
@@ -528,7 +528,7 @@ static void
if (mp->is_add)
{
vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
- memset (m_args, 0, sizeof (m_args[0]));
+ clib_memset (m_args, 0, sizeof (m_args[0]));
gid_address_copy (&m_args->eid, eid);
m_args->action = mp->action;
m_args->is_static = 1;
@@ -557,7 +557,7 @@ vl_api_lisp_add_del_adjacency_t_handler (vl_api_lisp_add_del_adjacency_t * mp)
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
int rv = 0;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->leid, mp->leid_len);
@@ -582,7 +582,7 @@ send_lisp_locator_details (lisp_cp_main_t * lcm,
vl_api_lisp_locator_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
rmp->context = context;
@@ -655,7 +655,7 @@ send_lisp_locator_set_details (lisp_cp_main_t * lcm,
u8 *str = 0;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
rmp->context = context;
@@ -795,7 +795,7 @@ send_lisp_eid_table_details (mapping_t * mapit,
mac = gid_address_mac (gid);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
@@ -864,7 +864,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
if (mp->eid_set)
{
- memset (eid, 0, sizeof (*eid));
+ clib_memset (eid, 0, sizeof (*eid));
unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->prefix_length);
@@ -896,7 +896,7 @@ send_lisp_map_server_details (ip_address_t * ip, vl_api_registration_t * reg,
vl_api_lisp_map_server_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
switch (ip_addr_version (ip))
@@ -945,7 +945,7 @@ send_lisp_map_resolver_details (ip_address_t * ip,
vl_api_lisp_map_resolver_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
switch (ip_addr_version (ip))
@@ -994,7 +994,7 @@ send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg,
vl_api_lisp_eid_table_map_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
rmp->vni = clib_host_to_net_u32 (p->key);
@@ -1039,7 +1039,7 @@ send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context)
vl_api_lisp_eid_table_vni_details_t *rmp = 0;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
rmp->context = context;
rmp->vni = clib_host_to_net_u32 (vni);
@@ -1056,7 +1056,7 @@ lisp_adjacency_copy (vl_api_lisp_adjacency_t * dst, lisp_adjacency_t * adjs)
for (i = 0; i < n; i++)
{
adj = vec_elt_at_index (adjs, i);
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
switch (gid_address_type (&adj->reid))
{
diff --git a/src/vnet/lisp-cp/lisp_cli.c b/src/vnet/lisp-cp/lisp_cli.c
index a044d23ed53..690850c7ac2 100644
--- a/src/vnet/lisp-cp/lisp_cli.c
+++ b/src/vnet/lisp-cp/lisp_cli.c
@@ -148,8 +148,8 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 *key = 0;
u32 key_id = 0;
- memset (&eid, 0, sizeof (eid));
- memset (a, 0, sizeof (*a));
+ clib_memset (&eid, 0, sizeof (eid));
+ clib_memset (a, 0, sizeof (*a));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -308,8 +308,8 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&eid, 0, sizeof (eid));
- memset (&rloc, 0, sizeof (rloc));
+ clib_memset (&eid, 0, sizeof (eid));
+ clib_memset (&rloc, 0, sizeof (rloc));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -384,7 +384,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (!is_add)
{
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->reid, &eid);
if (vnet_lisp_add_del_adjacency (a))
{
@@ -398,7 +398,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (is_add)
{
vnet_lisp_add_del_mapping_args_t _map_args, *map_args = &_map_args;
- memset (map_args, 0, sizeof (map_args[0]));
+ clib_memset (map_args, 0, sizeof (map_args[0]));
gid_address_copy (&map_args->eid, &eid);
map_args->action = action;
map_args->is_static = 1;
@@ -449,8 +449,8 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&reid, 0, sizeof (reid));
- memset (&leid, 0, sizeof (leid));
+ clib_memset (&reid, 0, sizeof (reid));
+ clib_memset (&leid, 0, sizeof (leid));
leid_ippref = &gid_address_ippref (&leid);
reid_ippref = &gid_address_ippref (&reid);
@@ -510,7 +510,7 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input,
goto done;
}
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->leid, &leid);
gid_address_copy (&a->reid, &reid);
a->is_add = is_add;
@@ -811,7 +811,7 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
u8 filter = 0;
clib_error_t *error = NULL;
- memset (&eid, 0, sizeof (eid));
+ clib_memset (&eid, 0, sizeof (eid));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -1158,8 +1158,8 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm,
u32 ls_index = 0;
int rv = 0;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -1232,8 +1232,8 @@ lisp_add_del_locator_in_set_command_fn (vlib_main_t * vm,
vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
u32 ls_index = 0;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/src/vnet/lisp-cp/lisp_msg_serdes.c b/src/vnet/lisp-cp/lisp_msg_serdes.c
index 25188b46189..f45f08fad6c 100644
--- a/src/vnet/lisp-cp/lisp_msg_serdes.c
+++ b/src/vnet/lisp-cp/lisp_msg_serdes.c
@@ -27,7 +27,7 @@ lisp_msg_put_locators (vlib_buffer_t * b, locator_t * locators)
vec_foreach (loc, locators)
{
u8 *p = vlib_buffer_put_uninit (b, sizeof (locator_hdr_t));
- memset (p, 0, sizeof (locator_hdr_t));
+ clib_memset (p, 0, sizeof (locator_hdr_t));
LOC_PRIORITY (p) = loc->priority;
LOC_MPRIORITY (p) = loc->mpriority;
LOC_WEIGHT (p) = loc->weight;
@@ -45,7 +45,7 @@ lisp_msg_put_mapping_record (vlib_buffer_t * b, mapping_t * record)
vlib_buffer_put_uninit (b, sizeof (mapping_record_hdr_t));
gid_address_t *eid = &record->eid;
- memset (p, 0, sizeof (*p));
+ clib_memset (p, 0, sizeof (*p));
MAP_REC_EID_PLEN (p) = gid_address_len (eid);
MAP_REC_TTL (p) = clib_host_to_net_u32 (MAP_REGISTER_DEFAULT_TTL);
MAP_REC_AUTH (p) = record->authoritative ? 1 : 0;
@@ -104,7 +104,7 @@ lisp_msg_put_eid_rec (vlib_buffer_t * b, gid_address_t * eid)
{
eid_record_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (*h));
- memset (h, 0, sizeof (*h));
+ clib_memset (h, 0, sizeof (*h));
EID_REC_MLEN (h) = gid_address_len (eid);
lisp_msg_put_gid (b, eid);
return h;
@@ -139,7 +139,7 @@ lisp_msg_put_map_reply (vlib_buffer_t * b, mapping_t * records, u64 nonce,
{
map_reply_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0]));
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
MREP_TYPE (h) = LISP_MAP_REPLY;
MREP_NONCE (h) = nonce;
MREP_REC_COUNT (h) = 1;
@@ -159,14 +159,14 @@ lisp_msg_put_map_register (vlib_buffer_t * b, mapping_t * records,
/* Basic header init */
map_register_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0]));
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
MREG_TYPE (h) = LISP_MAP_REGISTER;
MREG_NONCE (h) = nonce_build (0);
MREG_WANT_MAP_NOTIFY (h) = want_map_notify ? 1 : 0;
MREG_REC_COUNT (h) = vec_len (records);
auth_data = vlib_buffer_put_uninit (b, auth_data_len);
- memset (auth_data, 0, auth_data_len);
+ clib_memset (auth_data, 0, auth_data_len);
/* Put map register records */
lisp_msg_put_mreg_records (b, records);
@@ -187,7 +187,7 @@ lisp_msg_put_mreq (lisp_cp_main_t * lcm, vlib_buffer_t * b,
/* Basic header init */
map_request_hdr_t *h = vlib_buffer_put_uninit (b, sizeof (h[0]));
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
MREQ_TYPE (h) = LISP_MAP_REQUEST;
MREQ_NONCE (h) = nonce_build (0);
MREQ_SMR_INVOKED (h) = is_smr_invoked ? 1 : 0;
@@ -219,8 +219,8 @@ lisp_msg_push_ecm (vlib_main_t * vm, vlib_buffer_t * b, int lp, int rp,
if (gid_address_type (la) != GID_ADDR_IP_PREFIX)
{
/* empty ip4 */
- memset (src_ip, 0, sizeof (src_ip[0]));
- memset (dst_ip, 0, sizeof (dst_ip[0]));
+ clib_memset (src_ip, 0, sizeof (src_ip[0]));
+ clib_memset (dst_ip, 0, sizeof (dst_ip[0]));
}
else
{
@@ -261,7 +261,7 @@ u32
lisp_msg_parse_addr (vlib_buffer_t * b, gid_address_t * eid)
{
u32 len;
- memset (eid, 0, sizeof (*eid));
+ clib_memset (eid, 0, sizeof (*eid));
len = gid_address_parse (vlib_buffer_get_current (b), eid);
if (len != ~0)
vlib_buffer_pull (b, len);
@@ -273,7 +273,7 @@ lisp_msg_parse_eid_rec (vlib_buffer_t * b, gid_address_t * eid)
{
eid_record_hdr_t *h = vlib_buffer_get_current (b);
u32 len;
- memset (eid, 0, sizeof (*eid));
+ clib_memset (eid, 0, sizeof (*eid));
len = gid_address_parse (EID_REC_ADDR (h), eid);
if (len == ~0)
return len;
@@ -333,7 +333,7 @@ lisp_msg_parse_mapping_record (vlib_buffer_t * b, gid_address_t * eid,
vlib_buffer_pull (b, sizeof (mapping_record_hdr_t));
- memset (eid, 0, sizeof (*eid));
+ clib_memset (eid, 0, sizeof (*eid));
len = gid_address_parse (vlib_buffer_get_current (b), eid);
if (len == ~0)
return len;
diff --git a/src/vnet/lisp-cp/lisp_types.c b/src/vnet/lisp-cp/lisp_types.c
index fb3fa6cc33e..a706832a249 100644
--- a/src/vnet/lisp-cp/lisp_types.c
+++ b/src/vnet/lisp-cp/lisp_types.c
@@ -165,7 +165,7 @@ unformat_ip_address (unformat_input_t * input, va_list * args)
{
ip_address_t *a = va_arg (*args, ip_address_t *);
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (a)))
ip_addr_version (a) = IP4;
else if (unformat_user (input, unformat_ip6_address, &ip_addr_v6 (a)))
@@ -339,9 +339,9 @@ unformat_gid_address (unformat_input_t * input, va_list * args)
fid_address_t sim1, sim2;
nsh_t nsh;
- memset (&ippref, 0, sizeof (ippref));
- memset (&sim1, 0, sizeof (sim1));
- memset (&sim2, 0, sizeof (sim2));
+ clib_memset (&ippref, 0, sizeof (ippref));
+ clib_memset (&sim1, 0, sizeof (sim1));
+ clib_memset (&sim2, 0, sizeof (sim2));
if (unformat (input, "%U|%U", unformat_fid_address, &sim1,
unformat_fid_address, &sim2))
@@ -844,7 +844,7 @@ gid_address_free (gid_address_t * a)
void
gid_address_from_ip (gid_address_t * g, ip_address_t * ip)
{
- memset (g, 0, sizeof (g[0]));
+ clib_memset (g, 0, sizeof (g[0]));
ip_address_set (&gid_address_ip (g), ip, ip_addr_version (ip));
gid_address_ippref_len (g) = 32;
}
@@ -872,7 +872,7 @@ ip_address_copy (ip_address_t * dst, const ip_address_t * src)
if (IP4 == ip_addr_version (src))
{
/* don't copy any garbage from the union */
- memset (dst, 0, sizeof (*dst));
+ clib_memset (dst, 0, sizeof (*dst));
dst->ip.v4 = src->ip.v4;
dst->version = IP4;
}
@@ -941,7 +941,7 @@ ip_prefix_normalize_ip6 (ip6_address_t * ip6, u8 preflen)
ASSERT (ip6);
- memset (mask_6, 0, sizeof (mask_6));
+ clib_memset (mask_6, 0, sizeof (mask_6));
if (128 <= preflen)
{
@@ -1178,7 +1178,7 @@ lcaf_write (u8 * p, void *a)
*(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF);
size += sizeof (u16);
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
LCAF_TYPE (h) = type;
u16 lcaf_len = (*lcaf_body_length_fcts[type]) (lcaf);
LCAF_LENGTH (h) = clib_host_to_net_u16 (lcaf_len);
@@ -1243,7 +1243,7 @@ sd_write (u8 * p, void *a)
*(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF);
size += sizeof (u16);
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
LCAF_TYPE (h) = LCAF_SOURCE_DEST;
u16 lcaf_len = sizeof (lcaf_src_dst_hdr_t)
+ fid_addr_size_to_write (&sd_src (sd))
@@ -1253,7 +1253,7 @@ sd_write (u8 * p, void *a)
clib_memcpy (p + size, h, sizeof (h[0]));
size += sizeof (h[0]);
- memset (&sd_hdr, 0, sizeof (sd_hdr));
+ clib_memset (&sd_hdr, 0, sizeof (sd_hdr));
LCAF_SD_SRC_ML (&sd_hdr) = fid_address_length (&sd_src (sd));
LCAF_SD_DST_ML (&sd_hdr) = fid_address_length (&sd_dst (sd));
clib_memcpy (p + size, &sd_hdr, sizeof (sd_hdr));
@@ -1282,8 +1282,8 @@ nsh_write (u8 * p, void *a)
ASSERT (gid_address_type (g) == GID_ADDR_NSH);
- memset (&lcaf, 0, sizeof (lcaf));
- memset (&spi, 0, sizeof (spi));
+ clib_memset (&lcaf, 0, sizeof (lcaf));
+ clib_memset (&spi, 0, sizeof (spi));
LCAF_TYPE (&lcaf) = LCAF_NSH;
LCAF_LENGTH (&lcaf) = clib_host_to_net_u16 (sizeof (lcaf_spi_hdr_t));
@@ -1314,7 +1314,7 @@ vni_write (u8 * p, void *a)
/* put lcaf header */
*(u16 *) p = clib_host_to_net_u16 (LISP_AFI_LCAF);
size += sizeof (u16);
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
LCAF_TYPE (h) = LCAF_INSTANCE_ID;
u16 lcaf_len = sizeof (u32) /* Instance ID size */
+ gid_address_size_to_put_no_vni (g);
@@ -1726,7 +1726,7 @@ locator_free (locator_t * l)
void
build_src_dst (gid_address_t * sd, gid_address_t * src, gid_address_t * dst)
{
- memset (sd, 0, sizeof (*sd));
+ clib_memset (sd, 0, sizeof (*sd));
gid_address_type (sd) = GID_ADDR_SRC_DST;
gid_address_vni (sd) = gid_address_vni (dst);
gid_address_vni_mask (sd) = gid_address_vni_mask (dst);
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index 85c5d7e1945..fa67536c32d 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -154,7 +154,7 @@ unformat_one_locs (vl_api_one_remote_locator_t * rmt_locs, u32 rloc_num)
{
/* remote locators */
r = &rmt_locs[i];
- memset (&loc, 0, sizeof (loc));
+ clib_memset (&loc, 0, sizeof (loc));
gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
loc.priority = r->priority;
@@ -207,7 +207,7 @@ vl_api_one_add_del_locator_set_t_handler (vl_api_one_add_del_locator_set_t *
u8 *locator_name = NULL;
int i;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
mp->locator_set_name[sizeof (mp->locator_set_name) - 1] = 0;
locator_name = format (0, "%s", mp->locator_set_name);
@@ -218,7 +218,7 @@ vl_api_one_add_del_locator_set_t_handler (vl_api_one_add_del_locator_set_t *
a->local = 1;
locator_num = clib_net_to_host_u32 (mp->locator_num);
- memset (&locator, 0, sizeof (locator));
+ clib_memset (&locator, 0, sizeof (locator));
for (i = 0; i < locator_num; i++)
{
ls_loc = &mp->locators[i];
@@ -256,8 +256,8 @@ vl_api_one_add_del_locator_t_handler (vl_api_one_add_del_locator_t * mp)
u32 ls_index = ~0;
u8 *locator_name = NULL;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
locator.sw_if_index = ntohl (mp->sw_if_index);
locator.priority = mp->priority;
@@ -339,8 +339,8 @@ vl_api_one_add_del_local_eid_t_handler (vl_api_one_add_del_local_eid_t * mp)
u32 locator_set_index = ~0, map_index = ~0;
vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
u8 *name = NULL, *key = NULL;
- memset (a, 0, sizeof (a[0]));
- memset (eid, 0, sizeof (eid[0]));
+ clib_memset (a, 0, sizeof (a[0]));
+ clib_memset (eid, 0, sizeof (eid[0]));
rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->prefix_len);
@@ -403,7 +403,7 @@ vl_api_one_add_del_map_server_t_handler (vl_api_one_add_del_map_server_t * mp)
int rv = 0;
ip_address_t addr;
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
@@ -419,7 +419,7 @@ vl_api_one_add_del_map_resolver_t_handler (vl_api_one_add_del_map_resolver_t
int rv = 0;
vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
a->is_add = mp->is_add;
ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
@@ -546,7 +546,7 @@ vl_api_show_one_use_petr_t_handler (vl_api_show_one_use_petr_t * mp)
u8 status = 0;
gid_address_t addr;
- memset (&addr, 0, sizeof (addr));
+ clib_memset (&addr, 0, sizeof (addr));
status = lcm->flags & LISP_FLAG_USE_PETR;
if (status)
{
@@ -618,7 +618,7 @@ static void
gid_address_t _eid, *eid = &_eid;
u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
- memset (eid, 0, sizeof (eid[0]));
+ clib_memset (eid, 0, sizeof (eid[0]));
rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->eid_len);
@@ -630,7 +630,7 @@ static void
if (!mp->is_add)
{
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->reid, eid);
a->is_add = 0;
rv = vnet_lisp_add_del_adjacency (a);
@@ -645,7 +645,7 @@ static void
if (mp->is_add)
{
vnet_lisp_add_del_mapping_args_t _m_args, *m_args = &_m_args;
- memset (m_args, 0, sizeof (m_args[0]));
+ clib_memset (m_args, 0, sizeof (m_args[0]));
gid_address_copy (&m_args->eid, eid);
m_args->action = mp->action;
m_args->is_static = 1;
@@ -672,7 +672,7 @@ vl_api_one_add_del_adjacency_t_handler (vl_api_one_add_del_adjacency_t * mp)
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
int rv = 0;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->leid, mp->leid_len);
@@ -697,7 +697,7 @@ send_one_locator_details (lisp_cp_main_t * lcm,
vl_api_one_locator_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
rmp->context = context;
@@ -770,7 +770,7 @@ send_one_locator_set_details (lisp_cp_main_t * lcm,
u8 *str = 0;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
rmp->context = context;
@@ -909,7 +909,7 @@ send_one_eid_table_details (mapping_t * mapit,
mac = gid_address_mac (gid);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
@@ -985,7 +985,7 @@ vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp)
if (mp->eid_set)
{
- memset (eid, 0, sizeof (*eid));
+ clib_memset (eid, 0, sizeof (*eid));
unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
mp->eid_type, mp->eid, mp->prefix_length);
@@ -1017,7 +1017,7 @@ send_one_map_server_details (ip_address_t * ip, vl_api_registration_t * reg,
vl_api_one_map_server_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
switch (ip_addr_version (ip))
@@ -1066,7 +1066,7 @@ send_one_map_resolver_details (ip_address_t * ip,
vl_api_one_map_resolver_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
switch (ip_addr_version (ip))
@@ -1115,7 +1115,7 @@ send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg,
vl_api_one_eid_table_map_details_t *rmp = NULL;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
rmp->vni = clib_host_to_net_u32 (p->key);
@@ -1159,7 +1159,7 @@ send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context)
vl_api_one_eid_table_vni_details_t *rmp = 0;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
rmp->context = context;
rmp->vni = clib_host_to_net_u32 (vni);
@@ -1177,7 +1177,7 @@ one_adjacency_copy (vl_api_one_adjacency_t * dst, lisp_adjacency_t * adjs)
for (i = 0; i < n; i++)
{
adj = vec_elt_at_index (adjs, i);
- memset (&a, 0, sizeof (a));
+ clib_memset (&a, 0, sizeof (a));
switch (gid_address_type (&adj->reid))
{
@@ -1536,7 +1536,7 @@ static void
vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
int rv = 0;
gid_address_t _arp, *arp = &_arp;
- memset (arp, 0, sizeof (*arp));
+ clib_memset (arp, 0, sizeof (*arp));
gid_address_type (arp) = GID_ADDR_ARP;
gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
@@ -1555,7 +1555,7 @@ vl_api_one_add_del_ndp_entry_t_handler (vl_api_one_add_del_ndp_entry_t * mp)
vl_api_one_add_del_ndp_entry_reply_t *rmp;
int rv = 0;
gid_address_t _g, *g = &_g;
- memset (g, 0, sizeof (*g));
+ clib_memset (g, 0, sizeof (*g));
gid_address_type (g) = GID_ADDR_NDP;
gid_address_ndp_bd (g) = clib_net_to_host_u32 (mp->bd);
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c
index a11138f822a..7823ea14cd9 100644
--- a/src/vnet/lisp-cp/one_cli.c
+++ b/src/vnet/lisp-cp/one_cli.c
@@ -144,8 +144,8 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 *key = 0;
u32 key_id = 0;
- memset (&eid, 0, sizeof (eid));
- memset (a, 0, sizeof (*a));
+ clib_memset (&eid, 0, sizeof (eid));
+ clib_memset (a, 0, sizeof (*a));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -290,9 +290,9 @@ lisp_add_del_ndp_entry_command_fn (vlib_main_t * vm,
u32 hw_addr_set = 0, ip_set = 0, is_add = 1;
gid_address_t _g, *g = &_g;
- memset (&ip6, 0, sizeof (ip6));
- memset (hw_addr, 0, sizeof (hw_addr));
- memset (g, 0, sizeof (*g));
+ clib_memset (&ip6, 0, sizeof (ip6));
+ clib_memset (hw_addr, 0, sizeof (hw_addr));
+ clib_memset (g, 0, sizeof (*g));
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -354,9 +354,9 @@ lisp_add_del_l2_arp_entry_command_fn (vlib_main_t * vm,
u32 hw_addr_set = 0, ip_set = 0, is_add = 1;
gid_address_t _arp, *arp = &_arp;
- memset (&ip4, 0, sizeof (ip4));
- memset (hw_addr, 0, sizeof (hw_addr));
- memset (arp, 0, sizeof (*arp));
+ clib_memset (&ip4, 0, sizeof (ip4));
+ clib_memset (hw_addr, 0, sizeof (hw_addr));
+ clib_memset (arp, 0, sizeof (*arp));
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -503,8 +503,8 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&eid, 0, sizeof (eid));
- memset (&rloc, 0, sizeof (rloc));
+ clib_memset (&eid, 0, sizeof (eid));
+ clib_memset (&rloc, 0, sizeof (rloc));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -577,7 +577,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (!is_add)
{
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->reid, &eid);
if (vnet_lisp_add_del_adjacency (a))
{
@@ -591,7 +591,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
if (is_add)
{
vnet_lisp_add_del_mapping_args_t _map_args, *map_args = &_map_args;
- memset (map_args, 0, sizeof (map_args[0]));
+ clib_memset (map_args, 0, sizeof (map_args[0]));
gid_address_copy (&map_args->eid, &eid);
map_args->action = action;
map_args->is_static = 1;
@@ -645,8 +645,8 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&reid, 0, sizeof (reid));
- memset (&leid, 0, sizeof (leid));
+ clib_memset (&reid, 0, sizeof (reid));
+ clib_memset (&leid, 0, sizeof (leid));
leid_ippref = &gid_address_ippref (&leid);
reid_ippref = &gid_address_ippref (&reid);
@@ -706,7 +706,7 @@ lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input,
goto done;
}
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->leid, &leid);
gid_address_copy (&a->reid, &reid);
a->is_add = is_add;
@@ -1127,7 +1127,7 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
u8 filter = 0;
clib_error_t *error = NULL;
- memset (&eid, 0, sizeof (eid));
+ clib_memset (&eid, 0, sizeof (eid));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -1700,8 +1700,8 @@ lisp_add_del_locator_set_command_fn (vlib_main_t * vm,
u32 ls_index = 0;
int rv = 0;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -1774,8 +1774,8 @@ lisp_add_del_locator_in_set_command_fn (vlib_main_t * vm,
vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
u32 ls_index = 0;
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
+ clib_memset (&locator, 0, sizeof (locator));
+ clib_memset (a, 0, sizeof (a[0]));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/src/vnet/lisp-cp/packets.c b/src/vnet/lisp-cp/packets.c
index 25086b8e7d9..5cb2cfa12c3 100644
--- a/src/vnet/lisp-cp/packets.c
+++ b/src/vnet/lisp-cp/packets.c
@@ -85,7 +85,7 @@ udp_ip6_checksum (ip6_header_t * ip6, udp_header_t * up, u32 len)
} phu;
/* pseudo-header */
- memset (&phu, 0, sizeof (phu));
+ clib_memset (&phu, 0, sizeof (phu));
phu.ph.ph_src = ip6->src_address;
phu.ph.ph_dst = ip6->dst_address;
phu.ph.ph_len = clib_host_to_net_u32 (len);
@@ -208,9 +208,9 @@ pkt_push_ecm_hdr (vlib_buffer_t * b)
ecm_hdr_t *h;
h = vlib_buffer_push_uninit (b, sizeof (h[0]));
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
h->type = LISP_ENCAP_CONTROL_TYPE;
- memset (h->reserved2, 0, sizeof (h->reserved2));
+ clib_memset (h->reserved2, 0, sizeof (h->reserved2));
return h;
}
diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c
index 66304ae344a..367dbae4159 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.c
+++ b/src/vnet/lisp-gpe/lisp_gpe.c
@@ -47,8 +47,8 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
locator_pair_t pair, *pairs = 0;
int rv;
- memset (leid, 0, sizeof (*leid));
- memset (reid, 0, sizeof (*reid));
+ clib_memset (leid, 0, sizeof (*leid));
+ clib_memset (reid, 0, sizeof (*reid));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -145,7 +145,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
/* add fwd entry */
vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
a->is_add = is_add;
a->is_negative = is_negative;
@@ -503,7 +503,7 @@ gpe_native_forward_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&rpath, 0, sizeof (rpath));
+ clib_memset (&rpath, 0, sizeof (rpath));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
@@ -621,7 +621,7 @@ lisp_gpe_init (vlib_main_t * vm)
lgm->lisp_stats_index_by_key =
hash_create_mem (0, sizeof (lisp_stats_key_t), sizeof (uword));
- memset (&lgm->counters, 0, sizeof (lgm->counters));
+ clib_memset (&lgm->counters, 0, sizeof (lgm->counters));
lgm->counters.name = "LISP counters";
return 0;
@@ -646,7 +646,7 @@ lisp_gpe_test_send_nsh_packet (u8 * file_name)
if (!file_name)
return clib_error_create ("no pcap file specified!");
- memset (&pm, 0, sizeof (pm));
+ clib_memset (&pm, 0, sizeof (pm));
pm.file_name = (char *) file_name;
error = pcap_read (&pm);
if (error)
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
index 7464af3d441..6f85dc4a761 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -115,7 +115,7 @@ ip46_address_to_ip_address (const ip46_address_t * a, ip_address_t * b)
{
if (ip46_address_is_ip4 (a))
{
- memset (b, 0, sizeof (*b));
+ clib_memset (b, 0, sizeof (*b));
ip_address_set (b, &a->ip4, IP4);
}
else
@@ -293,7 +293,7 @@ lisp_gpe_increment_stats_counters (lisp_cp_main_t * lcm, ip_adjacency_t * adj,
return;
lisp_stats_key_t key;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.fwd_entry_index = feip[0];
key.tunnel_index = ladj->tunnel_index;
@@ -395,7 +395,7 @@ lisp_gpe_adjacency_find_or_create_and_lock (const locator_pair_t * pair,
{
pool_get (lisp_adj_pool, ladj);
- memset (ladj, 0, sizeof (*ladj));
+ clib_memset (ladj, 0, sizeof (*ladj));
lai = (ladj - lisp_adj_pool);
ip_address_copy (&ladj->remote_rloc, &pair->rmt_loc);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c
index 97409f597ca..86328fc2cf8 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -74,7 +74,7 @@ unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
{
/* local locator */
r = &((vl_api_gpe_locator_t *) locs)[i];
- memset (&pair, 0, sizeof (pair));
+ clib_memset (&pair, 0, sizeof (pair));
ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
pair.weight = r->weight;
@@ -174,7 +174,7 @@ static void
vec_foreach (path, lfe->paths)
{
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
const lisp_gpe_tunnel_t *lgt;
rmp->_vl_msg_id =
@@ -200,7 +200,7 @@ gpe_fwd_entries_copy (vl_api_gpe_fwd_entry_t * dst,
vec_foreach (e, src)
{
- memset (&dst[i], 0, sizeof (*dst));
+ clib_memset (&dst[i], 0, sizeof (*dst));
dst[i].dp_table = e->dp_table;
dst[i].fwd_entry_index = e->fwd_entry_index;
dst[i].vni = e->vni;
@@ -332,7 +332,7 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp)
int rv = 0;
gpe_add_del_fwd_entry_t_net_to_host (mp);
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type,
mp->rmt_eid, mp->rmt_len);
@@ -447,7 +447,7 @@ static void
vnet_gpe_native_fwd_rpath_args_t _a, *a = &_a;
int rv = 0;
- memset (a, 0, sizeof (a[0]));
+ clib_memset (a, 0, sizeof (a[0]));
if (mp->is_ip4)
clib_memcpy (&a->rpath.frp_addr.ip4, mp->nh_addr, sizeof (ip4_address_t));
@@ -483,7 +483,7 @@ gpe_native_fwd_rpaths_copy (vl_api_gpe_native_fwd_rpath_t * dst,
vec_foreach (e, src)
{
- memset (&dst[i], 0, sizeof (*dst));
+ clib_memset (&dst[i], 0, sizeof (*dst));
table = fib_table_get (e->frp_fib_index, dpo_proto_to_fib (e->frp_proto));
dst[i].fib_index = table->ft_table_id;
dst[i].nh_sw_if_index = e->frp_sw_if_index;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index f810ae5fec4..2d6cd013941 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -409,7 +409,7 @@ find_fwd_entry (lisp_gpe_main_t * lgm,
{
uword *p;
- memset (key, 0, sizeof (*key));
+ clib_memset (key, 0, sizeof (*key));
if (GID_ADDR_IP_PREFIX == gid_address_type (&a->rmt_eid))
{
@@ -486,7 +486,7 @@ vnet_lisp_gpe_add_fwd_counters (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
if (LISP_GPE_FWD_ENTRY_TYPE_NORMAL != lfe->type)
return;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.fwd_entry_index = fwd_entry_index;
vec_foreach (path, lfe->paths)
@@ -531,7 +531,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lgm->lisp_fwd_entry_pool, lfe);
- memset (lfe, 0, sizeof (*lfe));
+ clib_memset (lfe, 0, sizeof (*lfe));
lfe->key = clib_mem_alloc (sizeof (key));
memcpy (lfe->key, &key, sizeof (key));
@@ -848,7 +848,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lgm->lisp_fwd_entry_pool, lfe);
- memset (lfe, 0, sizeof (*lfe));
+ clib_memset (lfe, 0, sizeof (*lfe));
lfe->key = clib_mem_alloc (sizeof (key));
memcpy (lfe->key, &key, sizeof (key));
@@ -916,7 +916,7 @@ lisp_nsh_fib_lookup (lisp_gpe_main_t * lgm, u32 spi_si_net_order)
int rv;
BVT (clib_bihash_kv) kv, value;
- memset (&kv, 0, sizeof (kv));
+ clib_memset (&kv, 0, sizeof (kv));
kv.key[0] = spi_si_net_order;
rv = BV (clib_bihash_search_inline_2) (&lgm->nsh_fib, &kv, &value);
@@ -951,7 +951,7 @@ lisp_nsh_fib_add_del_entry (u32 spi_si_host_order, u32 lfei, u8 is_add)
BVT (clib_bihash_kv) kv, value;
u32 old_val = ~0;
- memset (&kv, 0, sizeof (kv));
+ clib_memset (&kv, 0, sizeof (kv));
kv.key[0] = clib_host_to_net_u32 (spi_si_host_order);
kv.value = 0ULL;
@@ -1123,7 +1123,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm,
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lgm->lisp_fwd_entry_pool, lfe);
- memset (lfe, 0, sizeof (*lfe));
+ clib_memset (lfe, 0, sizeof (*lfe));
lfe->key = clib_mem_alloc (sizeof (key));
memcpy (lfe->key, &key, sizeof (key));
@@ -1307,7 +1307,7 @@ lisp_del_adj_stats (lisp_gpe_main_t * lgm, u32 fwd_entry_index, u32 ti)
uword *p;
u8 *s;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
key.fwd_entry_index = fwd_entry_index;
key.tunnel_index = ti;
@@ -1543,7 +1543,7 @@ vnet_lisp_gpe_fwd_entries_get_by_vni (u32 vni)
({
if (lfe->key->vni == vni)
{
- memset (&e, 0, sizeof (e));
+ clib_memset (&e, 0, sizeof (e));
e.dp_table = lfe->eid_table_id;
e.vni = lfe->key->vni;
if (lfe->type == LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE)
diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
index 3f56dbea08d..1ccd5817d7f 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
@@ -51,7 +51,7 @@ lisp_gpe_sub_interface_db_find (const ip_address_t * lrloc, u32 vni)
lisp_gpe_sub_interface_key_t key;
- memset (&key, 0, sizeof (key));
+ clib_memset (&key, 0, sizeof (key));
ip_address_copy (&key.local_rloc, lrloc);
key.vni = vni;
p = hash_get_mem (lisp_gpe_sub_interfaces, &key);
@@ -151,9 +151,9 @@ lisp_gpe_sub_interface_find_or_create_and_lock (const ip_address_t * lrloc,
return (INDEX_INVALID);
pool_get (lisp_gpe_sub_interface_pool, l3s);
- memset (l3s, 0, sizeof (*l3s));
+ clib_memset (l3s, 0, sizeof (*l3s));
l3s->key = clib_mem_alloc (sizeof (*l3s->key));
- memset (l3s->key, 0, sizeof (*l3s->key));
+ clib_memset (l3s->key, 0, sizeof (*l3s->key));
ip_address_copy (&l3s->key->local_rloc, lrloc);
l3s->key->vni = vni;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.c b/src/vnet/lisp-gpe/lisp_gpe_tenant.c
index 814b0d316cb..8da1fd40b9d 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tenant.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_tenant.c
@@ -48,7 +48,7 @@ lisp_gpe_tenant_find_or_create_i (u32 vni)
if (NULL == lt)
{
pool_get (lisp_gpe_tenant_pool, lt);
- memset (lt, 0, sizeof (*lt));
+ clib_memset (lt, 0, sizeof (*lt));
lt->lt_vni = vni;
lt->lt_table_id = ~0;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
index dd6c6fddfd9..e4ad872790c 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
@@ -161,10 +161,10 @@ lisp_gpe_tunnel_find_or_create_and_lock (const locator_pair_t * pair,
if (NULL == lgt)
{
pool_get (lisp_gpe_tunnel_pool, lgt);
- memset (lgt, 0, sizeof (*lgt));
+ clib_memset (lgt, 0, sizeof (*lgt));
lgt->key = clib_mem_alloc (sizeof (*lgt->key));
- memset (lgt->key, 0, sizeof (*lgt->key));
+ clib_memset (lgt->key, 0, sizeof (*lgt->key));
lgt->key->rmt = pair->rmt_loc;
lgt->key->lcl = pair->lcl_loc;
diff --git a/src/vnet/llc/llc.c b/src/vnet/llc/llc.c
index 706d478853e..4a7fdf9d9ba 100644
--- a/src/vnet/llc/llc.c
+++ b/src/vnet/llc/llc.c
@@ -213,7 +213,7 @@ llc_init (vlib_main_t * vm)
clib_error_t *error;
llc_main_t *pm = &llc_main;
- memset (pm, 0, sizeof (pm[0]));
+ clib_memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
pm->protocol_info_by_name = hash_create_string (0, sizeof (uword));
diff --git a/src/vnet/lldp/lldp_api.c b/src/vnet/lldp/lldp_api.c
index 28706194513..00b71f97dad 100644
--- a/src/vnet/lldp/lldp_api.c
+++ b/src/vnet/lldp/lldp_api.c
@@ -74,7 +74,7 @@ vl_api_sw_interface_set_lldp_t_handler (vl_api_sw_interface_set_lldp_t * mp)
u8 *port_desc = 0, *mgmt_ip4 = 0, *mgmt_ip6 = 0, *mgmt_oid = 0;
u8 no_data[256];
- memset (no_data, 0, 256);
+ clib_memset (no_data, 0, 256);
if (memcmp (mp->port_desc, no_data, strlen ((char *) mp->port_desc)) != 0)
{
diff --git a/src/vnet/lldp/lldp_input.c b/src/vnet/lldp/lldp_input.c
index e88f6fdba5f..cfae30e32ca 100644
--- a/src/vnet/lldp/lldp_input.c
+++ b/src/vnet/lldp/lldp_input.c
@@ -231,7 +231,7 @@ lldp_create_intf (lldp_main_t * lm, u32 hw_if_index)
if (p == 0)
{
pool_get (lm->intfs, n);
- memset (n, 0, sizeof (*n));
+ clib_memset (n, 0, sizeof (*n));
n->hw_if_index = hw_if_index;
hash_set (lm->intf_by_hw_if_index, n->hw_if_index, n - lm->intfs);
}
diff --git a/src/vnet/lldp/lldp_output.c b/src/vnet/lldp/lldp_output.c
index cffe7ba9804..4ae25a45b7b 100644
--- a/src/vnet/lldp/lldp_output.c
+++ b/src/vnet/lldp/lldp_output.c
@@ -271,7 +271,7 @@ lldp_template_init (vlib_main_t * vm)
{
ethernet_header_t h;
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
/*
* Send to 01:80:C2:00:00:0E - propagation constrained to a single
@@ -280,8 +280,8 @@ lldp_template_init (vlib_main_t * vm)
h.dst_address[0] = 0x01;
h.dst_address[1] = 0x80;
h.dst_address[2] = 0xC2;
- /* h.dst_address[3] = 0x00; (memset) */
- /* h.dst_address[4] = 0x00; (memset) */
+ /* h.dst_address[3] = 0x00; (clib_memset) */
+ /* h.dst_address[4] = 0x00; (clib_memset) */
h.dst_address[5] = 0x0E;
/* leave src address blank (fill in at send time) */
diff --git a/src/vnet/mfib/ip4_mfib.c b/src/vnet/mfib/ip4_mfib.c
index 7040fa71764..eaa61c0f86c 100644
--- a/src/vnet/mfib/ip4_mfib.c
+++ b/src/vnet/mfib/ip4_mfib.c
@@ -39,7 +39,7 @@ ip4_create_mfib_with_table_id (u32 table_id,
mfib_table_t *mfib_table;
pool_get_aligned(ip4_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES);
- memset(mfib_table, 0, sizeof(*mfib_table));
+ clib_memset(mfib_table, 0, sizeof(*mfib_table));
mfib_table->mft_proto = FIB_PROTOCOL_IP4;
mfib_table->mft_index =
@@ -425,12 +425,12 @@ ip4_show_mfib (vlib_main_t * vm,
}
else if (unformat (input, "%U/%d", unformat_ip4_address, &grp, &mask))
{
- memset(&src, 0, sizeof(src));
+ clib_memset(&src, 0, sizeof(src));
matching = 1;
}
else if (unformat (input, "%U", unformat_ip4_address, &grp))
{
- memset(&src, 0, sizeof(src));
+ clib_memset(&src, 0, sizeof(src));
matching = 1;
mask = 32;
}
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index 1c1f5db71f7..e98ac42374a 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -168,7 +168,7 @@ ip6_create_mfib_with_table_id (u32 table_id,
};
pool_get_aligned(ip6_main.mfibs, mfib_table, CLIB_CACHE_LINE_BYTES);
- memset(mfib_table, 0, sizeof(*mfib_table));
+ clib_memset(mfib_table, 0, sizeof(*mfib_table));
mfib_table->mft_proto = FIB_PROTOCOL_IP6;
mfib_table->mft_index =
@@ -340,7 +340,7 @@ ip6_mfib_table_get_index_for_sw_if_index (u32 sw_if_index)
if (_len <= 128) \
{ \
memcpy((_key)->mask+1, &ip6_main.fib_masks[_len], 16); \
- memset((_key)->mask+17, 0, 16); \
+ clib_memset((_key)->mask+17, 0, 16); \
} \
else \
{ \
@@ -434,7 +434,7 @@ ip6_mfib_table_entry_insert (ip6_mfib_t *mfib,
{
ip6_mfib_node_t *i6mn = clib_mem_alloc(sizeof(*i6mn));
- memset(i6mn->i6mn_nodes, 0, sizeof(i6mn->i6mn_nodes));
+ clib_memset(i6mn->i6mn_nodes, 0, sizeof(i6mn->i6mn_nodes));
IP6_MFIB_MK_KEY_MASK(grp, src, len, &i6mn->i6mn_key);
i6mn->i6mn_entry = mfib_entry_index;
@@ -601,12 +601,12 @@ ip6_show_mfib (vlib_main_t * vm,
}
else if (unformat (input, "%U/%d", unformat_ip6_address, &grp, &mask))
{
- memset(&src, 0, sizeof(src));
+ clib_memset(&src, 0, sizeof(src));
matching = 1;
}
else if (unformat (input, "%U", unformat_ip6_address, &grp))
{
- memset(&src, 0, sizeof(src));
+ clib_memset(&src, 0, sizeof(src));
matching = 1;
mask = 128;
}
diff --git a/src/vnet/mfib/mfib_entry.c b/src/vnet/mfib/mfib_entry.c
index a8d2f89cd55..90b223e3c25 100644
--- a/src/vnet/mfib/mfib_entry.c
+++ b/src/vnet/mfib/mfib_entry.c
@@ -403,7 +403,7 @@ mfib_entry_alloc (u32 fib_index,
/*
* Some of the members require non-default initialisation
- * so we also init those that don't and thus save on the call to memset.
+ * so we also init those that don't and thus save on the call to clib_memset.
*/
mfib_entry->mfe_flags = 0;
mfib_entry->mfe_fib_index = fib_index;
diff --git a/src/vnet/mfib/mfib_test.c b/src/vnet/mfib/mfib_test.c
index 4d519cd460f..2a12a38ef80 100644
--- a/src/vnet/mfib/mfib_test.c
+++ b/src/vnet/mfib/mfib_test.c
@@ -342,7 +342,7 @@ mfib_test_i (fib_protocol_t PROTO,
int res;
mfib_prefix_t all_1s;
- memset(&all_1s, 0xfd, sizeof(all_1s));
+ clib_memset(&all_1s, 0xfd, sizeof(all_1s));
res = 0;
n_entries = pool_elts(mfib_entry_pool);
diff --git a/src/vnet/mpls/mpls.c b/src/vnet/mpls/mpls.c
index c35aef943cd..05361de505d 100644
--- a/src/vnet/mpls/mpls.c
+++ b/src/vnet/mpls/mpls.c
@@ -228,7 +228,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
eos = MPLS_EOS;
is_del = 0;
local_label = MPLS_LABEL_INVALID;
- memset(&pfx, 0, sizeof(pfx));
+ clib_memset(&pfx, 0, sizeof(pfx));
payload_proto = DPO_PROTO_MPLS;
/* Get a line of input. */
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 84532bffbda..0f2ebb11bca 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -202,7 +202,7 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
return (rv);
ip46_address_t nh;
- memset (&nh, 0, sizeof (nh));
+ clib_memset (&nh, 0, sizeof (nh));
if (DPO_PROTO_IP4 == mp->mr_next_hop_proto)
memcpy (&nh.ip4, mp->mr_next_hop, sizeof (nh.ip4));
@@ -316,7 +316,7 @@ vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp)
fib_route_path_t rpath, *rpaths = NULL;
int ii, rv = 0;
- memset (&rpath, 0, sizeof (rpath));
+ clib_memset (&rpath, 0, sizeof (rpath));
stats_dslock_with_hint (1 /* release hint */ , 5 /* tag */ );
@@ -450,7 +450,7 @@ send_mpls_tunnel_entry (u32 mti, void *arg)
n = fib_path_list_get_n_paths (mt->mt_path_list);
mp = vl_msg_api_alloc (sizeof (*mp) + n * sizeof (vl_api_fib_path_t));
- memset (mp, 0, sizeof (*mp) + n * sizeof (vl_api_fib_path_t));
+ clib_memset (mp, 0, sizeof (*mp) + n * sizeof (vl_api_fib_path_t));
mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
mp->context = ctx->context;
@@ -504,7 +504,7 @@ send_mpls_fib_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
if (!mp)
return;
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
mp->context = context;
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index f6e5dabdd8f..27c2a2a6f00 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -609,7 +609,7 @@ vnet_mpls_tunnel_create (u8 l2_only,
vnm = vnet_get_main();
pool_get(mpls_tunnel_pool, mt);
- memset (mt, 0, sizeof (*mt));
+ clib_memset (mt, 0, sizeof (*mt));
mti = mt - mpls_tunnel_pool;
fib_node_init(&mt->mt_node, FIB_NODE_TYPE_MPLS_TUNNEL);
mt->mt_path_list = FIB_NODE_INDEX_INVALID;
@@ -788,7 +788,7 @@ vnet_create_mpls_tunnel_command_fn (vlib_main_t * vm,
u32 sw_if_index = ~0, payload_proto;
clib_error_t *error = NULL;
- memset(&rpath, 0, sizeof(rpath));
+ clib_memset(&rpath, 0, sizeof(rpath));
payload_proto = DPO_PROTO_MPLS;
/* Get a line of input. */
diff --git a/src/vnet/osi/osi.c b/src/vnet/osi/osi.c
index 0134eb0f5ea..9556481448a 100644
--- a/src/vnet/osi/osi.c
+++ b/src/vnet/osi/osi.c
@@ -176,7 +176,7 @@ osi_init (vlib_main_t * vm)
if ((error = vlib_call_init_function (vm, llc_init)))
return error;
- memset (pm, 0, sizeof (pm[0]));
+ clib_memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
pm->protocol_info_by_name = hash_create_string (0, sizeof (uword));
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index 745b9b2bf69..13b0e97cf4c 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -92,7 +92,7 @@ pg_capture (pg_capture_args_t * a)
pi = pool_elt_at_index (pg->interfaces, a->dev_instance);
vec_free (pi->pcap_file_name);
- memset (&pi->pcap_main, 0, sizeof (pi->pcap_main));
+ clib_memset (&pi->pcap_main, 0, sizeof (pi->pcap_main));
if (a->is_enabled == 0)
return 0;
@@ -224,7 +224,7 @@ pg_pcap_read (pg_stream_t * s, char *file_name)
#else
pcap_main_t pm;
clib_error_t *error;
- memset (&pm, 0, sizeof (pm));
+ clib_memset (&pm, 0, sizeof (pm));
pm.file_name = file_name;
error = pcap_read (&pm);
s->replay_packet_templates = pm.packets_read;
diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h
index b2b5798eb22..ab3ae44aed6 100644
--- a/src/vnet/pg/pg.h
+++ b/src/vnet/pg/pg.h
@@ -287,7 +287,7 @@ pg_free_edit_group (pg_stream_t * s)
pg_edit_group_t *g = pg_stream_get_group (s, i);
pg_edit_group_free (g);
- memset (g, 0, sizeof (g[0]));
+ clib_memset (g, 0, sizeof (g[0]));
_vec_len (s->edit_groups) = i;
}
diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c
index 37380034fd2..9611fe0fa4e 100644
--- a/src/vnet/policer/policer.c
+++ b/src/vnet/policer/policer.c
@@ -434,7 +434,7 @@ configure_policer_command_fn (vlib_main_t * vm,
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
- memset (&c, 0, sizeof (c));
+ clib_memset (&c, 0, sizeof (c));
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c
index d6d6b07ac34..96ee781ca18 100644
--- a/src/vnet/policer/policer_api.c
+++ b/src/vnet/policer/policer_api.c
@@ -60,7 +60,7 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
name = format (0, "%s", mp->name);
vec_terminate_c_string (name);
- memset (&cfg, 0, sizeof (cfg));
+ clib_memset (&cfg, 0, sizeof (cfg));
cfg.rfc = mp->type;
cfg.rnd_type = mp->round_type;
cfg.rate_type = mp->rate_type;
@@ -101,7 +101,7 @@ send_policer_details (u8 * name,
vl_api_policer_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_POLICER_DETAILS);
mp->context = context;
mp->cir = htonl (config->rb.kbps.cir_kbps);
diff --git a/src/vnet/policer/xlate.c b/src/vnet/policer/xlate.c
index 5905aa53351..afc0c05c376 100644
--- a/src/vnet/policer/xlate.c
+++ b/src/vnet/policer/xlate.c
@@ -798,7 +798,7 @@ sse2_pol_convert_cfg_to_hw_params (sse2_qos_pol_cfg_params_st * cfg,
/*
* clear the hw_params
*/
- memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st));
+ clib_memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st));
hw->allow_negative = SSE2_QOS_POL_ALLOW_NEGATIVE;
@@ -1174,8 +1174,8 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
int rc;
sse2_qos_pol_cfg_params_st kbps_cfg;
- memset (phys, 0, sizeof (policer_read_response_type_st));
- memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
+ clib_memset (phys, 0, sizeof (policer_read_response_type_st));
+ clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
if (!cfg)
{
@@ -1279,7 +1279,7 @@ static void
sse2_qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st * bkt,
sse2_qos_pol_hw_params_st * hw_fmt)
{
- memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st));
+ clib_memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st));
#if !defined (INTERNAL_SS) && !defined (X86)
hw_fmt->rfc = (u8) bkt->rfc;
hw_fmt->allow_negative = (u8) bkt->an;
@@ -1436,8 +1436,8 @@ sse2_pol_physical_2_logical (policer_read_response_type_st * phys,
sse2_qos_pol_hw_params_st pol_hw;
sse2_qos_pol_cfg_params_st kbps_cfg;
- memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st));
- memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
+ clib_memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st));
+ clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
if (!phys)
{
diff --git a/src/vnet/ppp/ppp.c b/src/vnet/ppp/ppp.c
index 2b3b3b23b5f..b1fafa13145 100644
--- a/src/vnet/ppp/ppp.c
+++ b/src/vnet/ppp/ppp.c
@@ -229,7 +229,7 @@ ppp_init (vlib_main_t * vm)
{
ppp_main_t *pm = &ppp_main;
- memset (pm, 0, sizeof (pm[0]));
+ clib_memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
pm->protocol_info_by_name = hash_create_string (0, sizeof (uword));
diff --git a/src/vnet/qos/qos_egress_map.c b/src/vnet/qos/qos_egress_map.c
index 365643995ba..158ff8445c6 100644
--- a/src/vnet/qos/qos_egress_map.c
+++ b/src/vnet/qos/qos_egress_map.c
@@ -73,7 +73,7 @@ qos_egress_map_find_or_create (qos_egress_map_id_t mid)
pool_get_aligned (qem_pool, qem, CLIB_CACHE_LINE_BYTES);
qemi = qem - qem_pool;
- memset (qem, 0, sizeof (*qem));
+ clib_memset (qem, 0, sizeof (*qem));
hash_set (qem_db, mid, qemi);
}
diff --git a/src/vnet/sctp/sctp.c b/src/vnet/sctp/sctp.c
index f97039c7936..53b44410f07 100644
--- a/src/vnet/sctp/sctp.c
+++ b/src/vnet/sctp/sctp.c
@@ -25,7 +25,7 @@ sctp_connection_bind (u32 session_index, transport_endpoint_t * tep)
void *iface_ip;
pool_get (tm->listener_pool, listener);
- memset (listener, 0, sizeof (*listener));
+ clib_memset (listener, 0, sizeof (*listener));
listener->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
SCTP_PRIMARY_PATH_IDX;
@@ -78,7 +78,7 @@ sctp_connection_unbind (u32 listener_index)
/* Poison the entry */
if (CLIB_DEBUG > 0)
- memset (sctp_conn, 0xFA, sizeof (*sctp_conn));
+ clib_memset (sctp_conn, 0xFA, sizeof (*sctp_conn));
pool_put_index (tm->listener_pool, listener_index);
}
@@ -424,7 +424,7 @@ sctp_connection_new (u8 thread_index)
sctp_connection_t *sctp_conn;
pool_get (sctp_main->connections[thread_index], sctp_conn);
- memset (sctp_conn, 0, sizeof (*sctp_conn));
+ clib_memset (sctp_conn, 0, sizeof (*sctp_conn));
sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
SCTP_PRIMARY_PATH_IDX;
sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index =
@@ -442,7 +442,7 @@ sctp_half_open_connection_new (u8 thread_index)
sctp_connection_t *sctp_conn = 0;
ASSERT (vlib_get_thread_index () == 0);
pool_get (tm->half_open_connections, sctp_conn);
- memset (sctp_conn, 0, sizeof (*sctp_conn));
+ clib_memset (sctp_conn, 0, sizeof (*sctp_conn));
sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index =
sctp_conn - tm->half_open_connections;
sctp_conn->sub_conn[SCTP_PRIMARY_PATH_IDX].subconn_idx =
@@ -537,7 +537,7 @@ sctp_connection_cleanup (sctp_connection_t * sctp_conn)
/* Poison the entry */
if (CLIB_DEBUG > 0)
- memset (sctp_conn, 0xFA, sizeof (*sctp_conn));
+ clib_memset (sctp_conn, 0xFA, sizeof (*sctp_conn));
pool_put (tm->connections[thread_index], sctp_conn);
}
diff --git a/src/vnet/sctp/sctp.h b/src/vnet/sctp/sctp.h
index 577c2aff8b0..c40de10a409 100644
--- a/src/vnet/sctp/sctp.h
+++ b/src/vnet/sctp/sctp.h
@@ -578,7 +578,7 @@ sctp_half_open_connection_del (sctp_connection_t * tc)
pool_put_index (sctp_main->half_open_connections,
tc->sub_conn[SCTP_PRIMARY_PATH_IDX].c_c_index);
if (CLIB_DEBUG)
- memset (tc, 0xFA, sizeof (*tc));
+ clib_memset (tc, 0xFA, sizeof (*tc));
clib_spinlock_unlock_if_init (&sctp_main->half_open_lock);
}
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index 08640a44311..2b65d97e093 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -1847,7 +1847,7 @@ sctp46_output_inline (vlib_main_t * vm,
}
else
{
- memset (&t0->sctp_header, 0, sizeof (t0->sctp_header));
+ clib_memset (&t0->sctp_header, 0, sizeof (t0->sctp_header));
}
clib_memcpy (&t0->sctp_connection, sctp_conn,
sizeof (t0->sctp_connection));
diff --git a/src/vnet/sctp/sctp_packet.h b/src/vnet/sctp/sctp_packet.h
index 427e2f39496..04995aa7ee3 100644
--- a/src/vnet/sctp/sctp_packet.h
+++ b/src/vnet/sctp/sctp_packet.h
@@ -951,7 +951,7 @@ vnet_sctp_set_hostname_address (sctp_hostname_param_t * h, char *hostname)
{
h->param_hdr.length = FQDN_MAX_LENGTH;
h->param_hdr.type = clib_host_to_net_u16 (SCTP_HOSTNAME_ADDRESS_TYPE);
- memset (h->hostname, '0', FQDN_MAX_LENGTH);
+ clib_memset (h->hostname, '0', FQDN_MAX_LENGTH);
memcpy (h->hostname, hostname, FQDN_MAX_LENGTH);
}
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index c3d838d49cc..7935eb8b242 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -387,7 +387,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
pool_get (ecm->sessions, session);
clib_spinlock_unlock_if_init (&ecm->sessions_lock);
- memset (session, 0, sizeof (*session));
+ clib_memset (session, 0, sizeof (*session));
session_index = session - ecm->sessions;
session->bytes_to_send = ecm->bytes_to_send;
session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send;
@@ -507,8 +507,8 @@ echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret)
u64 options[16];
clib_error_t *error = 0;
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
a->api_client_index = ecm->my_client_index;
a->session_cb_vft = &echo_clients;
@@ -588,7 +588,7 @@ echo_clients_connect (vlib_main_t * vm, u32 n_clients)
clib_error_t *error = 0;
int i;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
for (i = 0; i < n_clients; i++)
{
a->uri = (char *) ecm->connect_uri;
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index 14ab36d796c..3ee33ea8e29 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -287,8 +287,8 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret)
u64 options[APP_OPTIONS_N_OPTIONS];
u32 segment_size = 512 << 20;
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
if (esm->no_echo)
echo_server_session_cb_vft.builtin_app_rx_callback =
@@ -327,13 +327,13 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret)
}
esm->app_index = a->app_index;
- memset (a_cert, 0, sizeof (*a_cert));
+ clib_memset (a_cert, 0, sizeof (*a_cert));
a_cert->app_index = a->app_index;
vec_validate (a_cert->cert, test_srv_crt_rsa_len);
clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
vnet_app_add_tls_cert (a_cert);
- memset (a_key, 0, sizeof (*a_key));
+ clib_memset (a_key, 0, sizeof (*a_key));
a_key->app_index = a->app_index;
vec_validate (a_key->key, test_srv_key_rsa_len);
clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
@@ -359,7 +359,7 @@ echo_server_listen ()
{
echo_server_main_t *esm = &echo_server_main;
vnet_bind_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->app_index = esm->app_index;
a->uri = esm->server_uri;
return vnet_bind_uri (a);
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index ef9f760c992..8501cb4ee70 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -498,8 +498,8 @@ server_attach ()
vnet_app_attach_args_t _a, *a = &_a;
u32 segment_size = 128 << 20;
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
if (hsm->private_segment_size)
segment_size = hsm->private_segment_size;
@@ -522,13 +522,13 @@ server_attach ()
}
hsm->app_index = a->app_index;
- memset (a_cert, 0, sizeof (*a_cert));
+ clib_memset (a_cert, 0, sizeof (*a_cert));
a_cert->app_index = a->app_index;
vec_validate (a_cert->cert, test_srv_crt_rsa_len);
clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
vnet_app_add_tls_cert (a_cert);
- memset (a_key, 0, sizeof (*a_key));
+ clib_memset (a_key, 0, sizeof (*a_key));
a_key->app_index = a->app_index;
vec_validate (a_key->key, test_srv_key_rsa_len);
clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
@@ -542,7 +542,7 @@ http_server_listen ()
{
http_server_main_t *hsm = &http_server_main;
vnet_bind_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->app_index = hsm->app_index;
a->uri = "tcp://0.0.0.0/80";
if (hsm->uri)
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 6260ad350f0..f7896a5b0ae 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -116,7 +116,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open)
if (ps)
{
if (CLIB_DEBUG > 0)
- memset (ps, 0xFE, sizeof (*ps));
+ clib_memset (ps, 0xFE, sizeof (*ps));
pool_put (pm->sessions, ps);
}
@@ -235,11 +235,11 @@ proxy_rx_callback (stream_session_t * s)
/* $$$ your message in this space: parse url, etc. */
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
clib_spinlock_lock_if_init (&pm->sessions_lock);
pool_get (pm->sessions, ps);
- memset (ps, 0, sizeof (*ps));
+ clib_memset (ps, 0, sizeof (*ps));
ps->server_rx_fifo = rx_fifo;
ps->server_tx_fifo = tx_fifo;
ps->vpp_server_handle = session_handle (s);
@@ -397,8 +397,8 @@ proxy_server_attach ()
vnet_app_attach_args_t _a, *a = &_a;
u32 segment_size = 512 << 20;
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
if (pm->private_segment_size)
segment_size = pm->private_segment_size;
@@ -431,8 +431,8 @@ active_open_attach (void)
vnet_app_attach_args_t _a, *a = &_a;
u64 options[16];
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
a->api_client_index = pm->active_open_client_index;
a->session_cb_vft = &active_open_clients;
@@ -463,7 +463,7 @@ proxy_server_listen ()
{
proxy_main_t *pm = &proxy_main;
vnet_bind_args_t _a, *a = &_a;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->app_index = pm->server_app_index;
a->uri = (char *) pm->server_uri;
return vnet_bind_uri (a);
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index fad3e1c2292..90c067d6d31 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -25,7 +25,7 @@ app_listener_alloc (application_t * app)
{
app_listener_t *app_listener;
pool_get (app->listeners, app_listener);
- memset (app_listener, 0, sizeof (*app_listener));
+ clib_memset (app_listener, 0, sizeof (*app_listener));
app_listener->al_index = app_listener - app->listeners;
return app_listener;
}
@@ -42,7 +42,7 @@ app_listener_free (application_t * app, app_listener_t * app_listener)
clib_bitmap_free (app_listener->workers);
pool_put (app->listeners, app_listener);
if (CLIB_DEBUG)
- memset (app_listener, 0xfa, sizeof (*app_listener));
+ clib_memset (app_listener, 0xfa, sizeof (*app_listener));
}
static app_listener_t *
@@ -50,7 +50,7 @@ app_local_listener_alloc (application_t * app)
{
app_listener_t *app_listener;
pool_get (app->local_listeners, app_listener);
- memset (app_listener, 0, sizeof (*app_listener));
+ clib_memset (app_listener, 0, sizeof (*app_listener));
app_listener->al_index = app_listener - app->local_listeners;
return app_listener;
}
@@ -67,7 +67,7 @@ app_local_listener_free (application_t * app, app_listener_t * app_listener)
clib_bitmap_free (app_listener->workers);
pool_put (app->local_listeners, app_listener);
if (CLIB_DEBUG)
- memset (app_listener, 0xfa, sizeof (*app_listener));
+ clib_memset (app_listener, 0xfa, sizeof (*app_listener));
}
static app_worker_map_t *
@@ -75,7 +75,7 @@ app_worker_map_alloc (application_t * app)
{
app_worker_map_t *map;
pool_get (app->worker_maps, map);
- memset (map, 0, sizeof (*map));
+ clib_memset (map, 0, sizeof (*map));
return map;
}
@@ -234,7 +234,7 @@ application_alloc (void)
{
application_t *app;
pool_get (app_main.app_pool, app);
- memset (app, 0, sizeof (*app));
+ clib_memset (app, 0, sizeof (*app));
app->app_index = app - app_main.app_pool;
return app;
}
@@ -484,7 +484,7 @@ app_worker_alloc (application_t * app)
{
app_worker_t *app_wrk;
pool_get (app_main.workers, app_wrk);
- memset (app_wrk, 0, sizeof (*app_wrk));
+ clib_memset (app_wrk, 0, sizeof (*app_wrk));
app_wrk->wrk_index = app_wrk - app_main.workers;
app_wrk->app_index = app->app_index;
app_wrk->wrk_map_index = ~0;
@@ -572,7 +572,7 @@ app_worker_free (app_worker_t * app_wrk)
pool_put (app_main.workers, app_wrk);
if (CLIB_DEBUG)
- memset (app_wrk, 0xfe, sizeof (*app_wrk));
+ clib_memset (app_wrk, 0xfe, sizeof (*app_wrk));
}
int
@@ -1347,7 +1347,7 @@ application_local_session_alloc (app_worker_t * app_wrk)
{
local_session_t *s;
pool_get (app_wrk->local_sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->app_wrk_index = app_wrk->wrk_index;
s->session_index = s - app_wrk->local_sessions;
s->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_NONE, 0);
@@ -1359,7 +1359,7 @@ application_local_session_free (app_worker_t * app, local_session_t * s)
{
pool_put (app->local_sessions, s);
if (CLIB_DEBUG)
- memset (s, 0xfc, sizeof (*s));
+ clib_memset (s, 0xfc, sizeof (*s));
}
local_session_t *
@@ -1387,7 +1387,7 @@ application_local_listen_session_alloc (application_t * app)
{
local_session_t *ll;
pool_get (app->local_listen_sessions, ll);
- memset (ll, 0, sizeof (*ll));
+ clib_memset (ll, 0, sizeof (*ll));
return ll;
}
@@ -1403,7 +1403,7 @@ application_local_listen_session_free (application_t * app,
{
pool_put (app->local_listen_sessions, ll);
if (CLIB_DEBUG)
- memset (ll, 0xfb, sizeof (*ll));
+ clib_memset (ll, 0xfb, sizeof (*ll));
}
int
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 5b28a29c45b..c8ceb4e07a5 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -314,7 +314,7 @@ app_alloc_ctrl_evt_to_vpp (svm_msg_q_t * mq, app_session_evt_t * app_evt,
SVM_Q_WAIT, &app_evt->msg);
svm_msg_q_unlock (mq);
app_evt->evt = svm_msg_q_msg_data (mq, &app_evt->msg);
- memset (app_evt->evt, 0, sizeof (*app_evt->evt));
+ clib_memset (app_evt->evt, 0, sizeof (*app_evt->evt));
app_evt->evt->event_type = evt_type;
}
diff --git a/src/vnet/session/application_namespace.c b/src/vnet/session/application_namespace.c
index ce44547a86d..1896a723115 100644
--- a/src/vnet/session/application_namespace.c
+++ b/src/vnet/session/application_namespace.c
@@ -54,7 +54,7 @@ app_namespace_alloc (u8 * ns_id)
{
app_namespace_t *app_ns;
pool_get (app_namespace_pool, app_ns);
- memset (app_ns, 0, sizeof (*app_ns));
+ clib_memset (app_ns, 0, sizeof (*app_ns));
app_ns->ns_id = vec_dup (ns_id);
hash_set_mem (app_namespace_lookup_table, app_ns->ns_id,
app_ns - app_namespace_pool);
diff --git a/src/vnet/session/mma_template.c b/src/vnet/session/mma_template.c
index 248ced61451..15fd7c7aeed 100644
--- a/src/vnet/session/mma_template.c
+++ b/src/vnet/session/mma_template.c
@@ -53,7 +53,7 @@ RTT (mma_rule) * RT (mma_rules_table_rule_alloc) (RTT (mma_rules_table) * srt)
{
RTT (mma_rule) * rule;
pool_get (srt->rules, rule);
- memset (rule, 0, sizeof (*rule));
+ clib_memset (rule, 0, sizeof (*rule));
return rule;
}
@@ -61,7 +61,7 @@ RTT (mma_rule) *
RT (mma_rule_free) (RTT (mma_rules_table) * srt, RTT (mma_rule) * rule)
{
pool_put (srt->rules, rule);
- memset (rule, 0xfa, sizeof (*rule));
+ clib_memset (rule, 0xfa, sizeof (*rule));
return rule;
}
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 8dd72928ec4..6386645a974 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -82,7 +82,7 @@ segment_manager_del_segment (segment_manager_t * sm,
ssvm_delete (&fs->ssvm);
if (CLIB_DEBUG)
- memset (fs, 0xfb, sizeof (*fs));
+ clib_memset (fs, 0xfb, sizeof (*fs));
pool_put (sm->segments, fs);
}
@@ -182,7 +182,7 @@ segment_manager_add_segment (segment_manager_t * sm, u32 segment_size)
{
pool_get (sm->segments, seg);
}
- memset (seg, 0, sizeof (*seg));
+ clib_memset (seg, 0, sizeof (*seg));
/*
* Initialize ssvm segment and svm fifo private header
@@ -238,7 +238,7 @@ segment_manager_new ()
segment_manager_main_t *smm = &segment_manager_main;
segment_manager_t *sm;
pool_get (smm->segment_managers, sm);
- memset (sm, 0, sizeof (*sm));
+ clib_memset (sm, 0, sizeof (*sm));
clib_rwlock_init (&sm->segments_rwlock);
return sm;
}
@@ -419,7 +419,7 @@ segment_manager_del (segment_manager_t * sm)
clib_rwlock_free (&sm->segments_rwlock);
if (CLIB_DEBUG)
- memset (sm, 0xfe, sizeof (*sm));
+ clib_memset (sm, 0xfe, sizeof (*sm));
pool_put (smm->segment_managers, sm);
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 81c93064d38..189c5375fbb 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -139,7 +139,7 @@ session_alloc (u32 thread_index)
pool_get_aligned (session_manager_main.sessions[thread_index], s,
CLIB_CACHE_LINE_BYTES);
}
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
s->session_index = s - session_manager_main.sessions[thread_index];
s->thread_index = thread_index;
return s;
@@ -150,7 +150,7 @@ session_free (stream_session_t * s)
{
pool_put (session_manager_main.sessions[s->thread_index], s);
if (CLIB_DEBUG)
- memset (s, 0xFA, sizeof (*s));
+ clib_memset (s, 0xFA, sizeof (*s));
}
void
@@ -1087,7 +1087,7 @@ stream_session_disconnect (stream_session_t * s)
if (vlib_thread_is_main_w_barrier () || thread_index == s->thread_index)
{
vec_add2 (smm->pending_disconnects[s->thread_index], evt, 1);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->session_handle = session_handle (s);
evt->event_type = FIFO_EVENT_DISCONNECT;
}
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 56593865381..f0273641e7f 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -107,7 +107,7 @@ send_add_segment_callback (u32 api_client_index, const ssvm_private_t * sp)
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT);
mp->segment_size = sp->ssvm_size;
mp->fd_flags = fd_flags;
@@ -136,7 +136,7 @@ send_del_segment_callback (u32 api_client_index, const ssvm_private_t * fs)
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT);
strncpy ((char *) mp->segment_name, (char *) fs->name,
sizeof (mp->segment_name) - 1);
@@ -164,7 +164,7 @@ send_app_cut_through_registration_add (u32 api_client_index,
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id =
clib_host_to_net_u16 (VL_API_APP_CUT_THROUGH_REGISTRATION_ADD);
@@ -215,7 +215,7 @@ send_session_accept_callback (stream_session_t * s)
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION);
mp->context = server_wrk->wrk_index;
@@ -295,7 +295,7 @@ send_session_disconnect_callback (stream_session_t * s)
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_DISCONNECT_SESSION);
mp->handle = session_handle (s);
mp->context = app->api_client_index;
@@ -319,7 +319,7 @@ send_session_reset_callback (stream_session_t * s)
}
mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_RESET_SESSION);
mp->handle = session_handle (s);
vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
@@ -433,7 +433,7 @@ mq_send_session_accepted_cb (stream_session_t * s)
return -1;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_ACCEPTED;
mp = (session_accepted_msg_t *) evt->data;
mp->context = app->app_index;
@@ -519,7 +519,7 @@ mq_send_session_disconnected_cb (stream_session_t * s)
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = session_handle (s);
@@ -543,7 +543,7 @@ mq_send_local_session_disconnected_cb (u32 app_wrk_index,
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
mp = (session_disconnected_msg_t *) evt->data;
mp->handle = application_local_session_handle (ls);
@@ -564,7 +564,7 @@ mq_send_session_reset_cb (stream_session_t * s)
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_RESET;
mp = (session_reset_msg_t *) evt->data;
mp->handle = session_handle (s);
@@ -596,7 +596,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
if (mq_try_lock_and_alloc_msg (app_mq, msg))
return -1;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_CONNECTED;
mp = (session_connected_msg_t *) evt->data;
mp->context = api_context;
@@ -677,7 +677,7 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
return -1;
evt = svm_msg_q_msg_data (app_mq, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_BOUND;
mp = (session_bound_msg_t *) evt->data;
mp->context = api_context;
@@ -761,7 +761,7 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp)
sizeof (mp->options),
"Out of options, fix api message definition");
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->api_client_index = mp->client_index;
a->options = mp->options;
@@ -883,7 +883,7 @@ vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
app = application_lookup (mp->client_index);
if (app)
{
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->uri = (char *) mp->uri;
a->app_index = app->app_index;
rv = vnet_bind_uri (a);
@@ -976,7 +976,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
app = application_lookup (mp->client_index);
if (app)
{
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->uri = (char *) mp->uri;
a->api_context = mp->context;
a->app_index = app->app_index;
@@ -1180,7 +1180,7 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
}
ip46 = (ip46_address_t *) mp->ip;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->sep.is_ip4 = mp->is_ip4;
a->sep.ip = *ip46;
a->sep.port = mp->port;
@@ -1283,7 +1283,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
svm_queue_t *client_q;
ip46_address_t *ip46 = (ip46_address_t *) mp->ip;
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
client_q = vl_api_client_index_to_input_queue (mp->client_index);
mp->client_queue_address = pointer_to_uword (client_q);
a->sep.is_ip4 = mp->is_ip4;
@@ -1474,7 +1474,7 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp)
u8 fib_proto;
int rv = 0;
- memset (&args, 0, sizeof (args));
+ clib_memset (&args, 0, sizeof (args));
fib_proto = mp->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
table_args->lcl.fp_len = mp->lcl_plen;
@@ -1491,8 +1491,8 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp)
args.scope = mp->scope;
args.transport_proto = mp->transport_proto;
- memset (&table_args->lcl.fp_addr, 0, sizeof (table_args->lcl.fp_addr));
- memset (&table_args->rmt.fp_addr, 0, sizeof (table_args->rmt.fp_addr));
+ clib_memset (&table_args->lcl.fp_addr, 0, sizeof (table_args->lcl.fp_addr));
+ clib_memset (&table_args->rmt.fp_addr, 0, sizeof (table_args->rmt.fp_addr));
ip_set (&table_args->lcl.fp_addr, mp->lcl_ip, mp->is_ip4);
ip_set (&table_args->rmt.fp_addr, mp->rmt_ip, mp->is_ip4);
error = vnet_session_rule_add_del (&args);
@@ -1517,7 +1517,7 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local,
(session_mask_or_match_4_t *) & rule->mask;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_SESSION_RULES_DETAILS);
rmp->context = context;
@@ -1554,7 +1554,7 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local,
(session_mask_or_match_6_t *) & rule->mask;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_SESSION_RULES_DETAILS);
rmp->context = context;
@@ -1662,7 +1662,7 @@ vl_api_application_tls_cert_add_t_handler (vl_api_application_tls_cert_add_t *
rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->app_index = app->app_index;
cert_len = clib_net_to_host_u16 (mp->cert_len);
if (cert_len > 10000)
@@ -1702,7 +1702,7 @@ vl_api_application_tls_key_add_t_handler (vl_api_application_tls_key_add_t *
rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->app_index = app->app_index;
key_len = clib_net_to_host_u16 (mp->key_len);
if (key_len > 10000)
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index 36133523e34..57f3d3ad7f1 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -109,8 +109,8 @@ unformat_stream_session_id (unformat_input_t * input, va_list * args)
u8 *is_ip4 = va_arg (*args, u8 *);
u8 tuple_is_set = 0;
- memset (lcl, 0, sizeof (*lcl));
- memset (rmt, 0, sizeof (*rmt));
+ clib_memset (lcl, 0, sizeof (*lcl));
+ clib_memset (rmt, 0, sizeof (*rmt));
if (unformat (input, "tcp"))
{
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index 19aeb0b24e0..927922e7e64 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -460,7 +460,7 @@ session_lookup_endpoint_listener (u32 table_index, session_endpoint_t * sep,
return kv4.value;
if (use_rules)
{
- memset (&lcl4, 0, sizeof (lcl4));
+ clib_memset (&lcl4, 0, sizeof (lcl4));
srt = &st->session_rules[sep->transport_proto];
ai = session_rules_table_lookup4 (srt, &lcl4, &sep->ip.ip4, 0,
sep->port);
@@ -481,7 +481,7 @@ session_lookup_endpoint_listener (u32 table_index, session_endpoint_t * sep,
if (use_rules)
{
- memset (&lcl6, 0, sizeof (lcl6));
+ clib_memset (&lcl6, 0, sizeof (lcl6));
srt = &st->session_rules[sep->transport_proto];
ai = session_rules_table_lookup6 (srt, &lcl6, &sep->ip.ip6, 0,
sep->port);
@@ -529,7 +529,7 @@ session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep)
/*
* Check if endpoint has special rules associated
*/
- memset (&lcl4, 0, sizeof (lcl4));
+ clib_memset (&lcl4, 0, sizeof (lcl4));
srt = &st->session_rules[sep->transport_proto];
ai = session_rules_table_lookup4 (srt, &lcl4, &sep->ip.ip4, 0,
sep->port);
@@ -574,7 +574,7 @@ session_lookup_local_endpoint (u32 table_index, session_endpoint_t * sep)
session_kv6_t kv6;
ip6_address_t lcl6;
- memset (&lcl6, 0, sizeof (lcl6));
+ clib_memset (&lcl6, 0, sizeof (lcl6));
srt = &st->session_rules[sep->transport_proto];
ai = session_rules_table_lookup6 (srt, &lcl6, &sep->ip.ip6, 0,
sep->port);
@@ -1267,7 +1267,7 @@ vnet_session_rule_add_del (session_rule_add_del_args_t * args)
}
if (args->scope & SESSION_RULE_SCOPE_LOCAL)
{
- memset (&args->table_args.lcl, 0, sizeof (args->table_args.lcl));
+ clib_memset (&args->table_args.lcl, 0, sizeof (args->table_args.lcl));
args->table_args.lcl.fp_proto = args->table_args.rmt.fp_proto;
args->table_args.lcl_port = 0;
st = app_namespace_get_local_table (app_ns);
@@ -1383,8 +1383,8 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input,
app_namespace_t *app_ns;
clib_error_t *error;
- memset (&lcl_ip, 0, sizeof (lcl_ip));
- memset (&rmt_ip, 0, sizeof (rmt_ip));
+ clib_memset (&lcl_ip, 0, sizeof (lcl_ip));
+ clib_memset (&rmt_ip, 0, sizeof (rmt_ip));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "del"))
@@ -1530,8 +1530,8 @@ show_session_rules_command_fn (vlib_main_t * vm, unformat_input_t * input,
session_table_t *st;
u8 *ns_id = 0, fib_proto;
- memset (&lcl_ip, 0, sizeof (lcl_ip));
- memset (&rmt_ip, 0, sizeof (rmt_ip));
+ clib_memset (&lcl_ip, 0, sizeof (lcl_ip));
+ clib_memset (&rmt_ip, 0, sizeof (rmt_ip));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%U", unformat_transport_proto, &transport_proto))
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 281622bcc9b..c1aea6723b6 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -159,7 +159,7 @@ session_mq_disconnected_handler (void *data)
SVM_Q_WAIT, msg);
svm_msg_q_unlock (app_wrk->event_queue);
evt = svm_msg_q_msg_data (app_wrk->event_queue, msg);
- memset (evt, 0, sizeof (*evt));
+ clib_memset (evt, 0, sizeof (*evt));
evt->event_type = SESSION_CTRL_EVT_DISCONNECTED;
rmp = (session_disconnected_reply_msg_t *) evt->data;
rmp->handle = mp->handle;
diff --git a/src/vnet/session/session_rules_table.c b/src/vnet/session/session_rules_table.c
index dee445dd0ad..33f7de07944 100644
--- a/src/vnet/session/session_rules_table.c
+++ b/src/vnet/session/session_rules_table.c
@@ -445,7 +445,7 @@ session_rules_table_add_del (session_rules_table_t * srt,
{
mma_rule_16_t _rule;
rule = &_rule;
- memset (rule, 0, sizeof (*rule));
+ clib_memset (rule, 0, sizeof (*rule));
session_rules_table_init_rule_16 (rule, &args->lcl,
args->lcl_port, &args->rmt,
args->rmt_port);
@@ -499,7 +499,7 @@ session_rules_table_add_del (session_rules_table_t * srt,
{
mma_rule_40_t _rule;
rule = &_rule;
- memset (rule, 0, sizeof (*rule));
+ clib_memset (rule, 0, sizeof (*rule));
session_rules_table_init_rule_40 (rule, &args->lcl,
args->lcl_port, &args->rmt,
args->rmt_port);
@@ -522,7 +522,7 @@ session_rules_table_init (session_rules_table_t * srt)
mma_rule_40_t *rule6;
fib_prefix_t null_prefix;
- memset (&null_prefix, 0, sizeof (null_prefix));
+ clib_memset (&null_prefix, 0, sizeof (null_prefix));
srt4 = &srt->session_rules_tables_16;
rule4 = session_rules_table_alloc_rule_16 (srt4, &null_prefix, 0,
diff --git a/src/vnet/session/session_table.c b/src/vnet/session/session_table.c
index 47d19092e2b..c74e290bda7 100644
--- a/src/vnet/session/session_table.c
+++ b/src/vnet/session/session_table.c
@@ -32,7 +32,7 @@ session_table_alloc (void)
{
session_table_t *slt;
pool_get_aligned (lookup_tables, slt, CLIB_CACHE_LINE_BYTES);
- memset (slt, 0, sizeof (*slt));
+ clib_memset (slt, 0, sizeof (*slt));
return slt;
}
diff --git a/src/vnet/session/session_test.c b/src/vnet/session/session_test.c
index 058644d91d4..8fe1b0d36e0 100644
--- a/src/vnet/session/session_test.c
+++ b/src/vnet/session/session_test.c
@@ -110,7 +110,7 @@ session_create_lookpback (u32 table_id, u32 * sw_if_index,
{
u8 intf_mac[6];
- memset (intf_mac, 0, sizeof (intf_mac));
+ clib_memset (intf_mac, 0, sizeof (intf_mac));
if (vnet_create_loopback_interface (sw_if_index, intf_mac, 0, 0))
{
@@ -150,7 +150,7 @@ session_test_basic (vlib_main_t * vm, unformat_input_t * input)
clib_error_t *error = 0;
u32 server_index;
- memset (options, 0, sizeof (options));
+ clib_memset (options, 0, sizeof (options));
options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
@@ -230,7 +230,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
server_sep.port = dummy_port;
client_sep.is_ip4 = 1;
client_sep.port = dummy_port;
- memset (options, 0, sizeof (options));
+ clib_memset (options, 0, sizeof (options));
options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
vnet_app_attach_args_t attach_args = {
@@ -559,7 +559,7 @@ session_test_rule_table (vlib_main_t * vm, unformat_input_t * input)
}
}
- memset (srt, 0, sizeof (*srt));
+ clib_memset (srt, 0, sizeof (*srt));
session_rules_table_init (srt);
ip4_address_t lcl_ip = {
@@ -839,7 +839,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
server_sep.is_ip4 = 1;
server_sep.port = dummy_port;
- memset (options, 0, sizeof (options));
+ clib_memset (options, 0, sizeof (options));
vnet_app_attach_args_t attach_args = {
.api_client_index = ~0,
@@ -1424,7 +1424,7 @@ session_test_proxy (vlib_main_t * vm, unformat_input_t * input)
app_ns = app_namespace_get_default ();
app_ns->sw_if_index = sw_if_index;
- memset (options, 0, sizeof (options));
+ clib_memset (options, 0, sizeof (options));
options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_IS_BUILTIN;
options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_ACCEPT_REDIRECT;
options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_IS_PROXY;
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index a401190e426..d74a218a5bf 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -336,7 +336,7 @@ transport_alloc_local_endpoint (u8 proto, transport_endpoint_t * rmt,
return -1;
}
- memset (lcl_addr, 0, sizeof (*lcl_addr));
+ clib_memset (lcl_addr, 0, sizeof (*lcl_addr));
if (rmt->is_ip4)
{
diff --git a/src/vnet/snap/snap.c b/src/vnet/snap/snap.c
index 8609c656572..9bee415390a 100644
--- a/src/vnet/snap/snap.c
+++ b/src/vnet/snap/snap.c
@@ -180,7 +180,7 @@ snap_init (vlib_main_t * vm)
{
snap_main_t *sm = &snap_main;
- memset (sm, 0, sizeof (sm[0]));
+ clib_memset (sm, 0, sizeof (sm[0]));
sm->vlib_main = vm;
mhash_init (&sm->protocol_hash, sizeof (uword),
diff --git a/src/vnet/span/span_api.c b/src/vnet/span/span_api.c
index f05a1c5093e..9566941ab9e 100644
--- a/src/vnet/span/span_api.c
+++ b/src/vnet/span/span_api.c
@@ -89,7 +89,7 @@ vl_api_sw_interface_span_dump_t_handler (vl_api_sw_interface_span_dump_t * mp)
clib_bitmap_foreach (i, b, (
{
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SPAN_DETAILS);
rmp->context = mp->context;
diff --git a/src/vnet/srmpls/sr_mpls_api.c b/src/vnet/srmpls/sr_mpls_api.c
index 2c36c0dd9f2..4cbc6a5cf63 100644
--- a/src/vnet/srmpls/sr_mpls_api.c
+++ b/src/vnet/srmpls/sr_mpls_api.c
@@ -112,7 +112,7 @@ static void vl_api_sr_mpls_steering_add_del_t_handler
{
vl_api_sr_mpls_steering_add_del_reply_t *rmp;
ip46_address_t prefix;
- memset (&prefix, 0, sizeof (ip46_address_t));
+ clib_memset (&prefix, 0, sizeof (ip46_address_t));
if (mp->traffic_type == SR_STEER_IPV4)
memcpy (&prefix.ip4, mp->prefix_addr, sizeof (prefix.ip4));
else
@@ -146,7 +146,7 @@ static void vl_api_sr_mpls_policy_assign_endpoint_color_t_handler
int rv = 0;
ip46_address_t endpoint;
- memset (&endpoint, 0, sizeof (ip46_address_t));
+ clib_memset (&endpoint, 0, sizeof (ip46_address_t));
if (mp->endpoint_type == SR_STEER_IPV4)
memcpy (&endpoint.ip4, mp->endpoint, sizeof (endpoint.ip4));
else
diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/vnet/srmpls/sr_mpls_policy.c
index f94a8e945ec..4fb80e12225 100755
--- a/src/vnet/srmpls/sr_mpls_policy.c
+++ b/src/vnet/srmpls/sr_mpls_policy.c
@@ -64,7 +64,7 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
u32 ii;
pool_get (sm->sid_lists, segment_list);
- memset (segment_list, 0, sizeof (*segment_list));
+ clib_memset (segment_list, 0, sizeof (*segment_list));
vec_add1 (sr_policy->segments_lists, segment_list - sm->sid_lists);
@@ -172,7 +172,7 @@ sr_mpls_policy_add (mpls_label_t bsid, mpls_label_t * segments,
}
/* Add an SR policy object */
pool_get (sm->sr_policies, sr_policy);
- memset (sr_policy, 0, sizeof (*sr_policy));
+ clib_memset (sr_policy, 0, sizeof (*sr_policy));
/* the first policy needs to lock the MPLS table so it doesn't
* disappear with policies in it */
@@ -840,7 +840,7 @@ cli_sr_mpls_policy_ec_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 endpoint_type = 0;
char clear = 0, color_set = 0, bsid_set = 0;
- memset (&endpoint, 0, sizeof (ip46_address_t));
+ clib_memset (&endpoint, 0, sizeof (ip46_address_t));
int rv;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
diff --git a/src/vnet/srmpls/sr_mpls_steering.c b/src/vnet/srmpls/sr_mpls_steering.c
index c5ddab73ce4..669644913a3 100755
--- a/src/vnet/srmpls/sr_mpls_steering.c
+++ b/src/vnet/srmpls/sr_mpls_steering.c
@@ -70,7 +70,7 @@ find_or_create_internal_label (ip46_address_t endpoint, u32 color)
if (!color_table)
{
mhash_t color_t;
- memset (&color_t, 0, sizeof (mhash_t));
+ clib_memset (&color_t, 0, sizeof (mhash_t));
mhash_init (&color_t, sizeof (u32), sizeof (ip46_address_t));
mhash_set_mem (&sm->sr_policies_c2e2eclabel_hash, &color,
(uword *) & color_t, NULL);
@@ -391,7 +391,7 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
mpls_sr_policy_t *sr_policy = 0;
uword *p = 0;
- memset (&key, 0, sizeof (sr_mpls_steering_key_t));
+ clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t));
if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
return -1;
@@ -438,7 +438,7 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
/* Create a new steering policy */
pool_get (sm->steer_policies, steer_pl);
- memset (steer_pl, 0, sizeof (*steer_pl));
+ clib_memset (steer_pl, 0, sizeof (*steer_pl));
clib_memcpy (&steer_pl->classify.prefix, prefix, sizeof (ip46_address_t));
clib_memcpy (&steer_pl->next_hop, next_hop, sizeof (ip46_address_t));
steer_pl->nh_type = nh_type;
@@ -553,7 +553,7 @@ sr_mpls_steering_policy_del (ip46_address_t * prefix, u32 mask_width,
fib_prefix_t pfx = { 0 };
uword *p = 0;
- memset (&key, 0, sizeof (sr_mpls_steering_key_t));
+ clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t));
/* Compute the steer policy key */
if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
@@ -673,8 +673,8 @@ sr_mpls_steer_policy_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 sr_policy_set = 0;
- memset (&prefix, 0, sizeof (ip46_address_t));
- memset (&nh, 0, sizeof (ip46_address_t));
+ clib_memset (&prefix, 0, sizeof (ip46_address_t));
+ clib_memset (&nh, 0, sizeof (ip46_address_t));
int rv;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
diff --git a/src/vnet/srp/interface.c b/src/vnet/srp/interface.c
index bac2e75b1e9..b418ec28229 100644
--- a/src/vnet/srp/interface.c
+++ b/src/vnet/srp/interface.c
@@ -72,7 +72,7 @@ srp_build_rewrite (vnet_main_t * vnm,
if (dst_address)
clib_memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.dst_address));
else
- memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */
+ clib_memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */
h->ethernet.type = clib_host_to_net_u16 (type);
@@ -128,7 +128,7 @@ static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redi
else
{
pool_get (sm->interface_pool, si);
- memset (si, 0, sizeof (si[0]));
+ clib_memset (si, 0, sizeof (si[0]));
}
for (s = 0; s < SRP_N_SIDE; s++)
{
@@ -330,7 +330,7 @@ create_simulated_srp_interfaces (vlib_main_t * vm,
if (! unformat_user (input, unformat_ethernet_address, &address))
{
- memset (address, 0, sizeof (address));
+ clib_memset (address, 0, sizeof (address));
address[0] = 0xde;
address[1] = 0xad;
address[5] = instance;
diff --git a/src/vnet/srp/node.c b/src/vnet/srp/node.c
index 25cf0c07554..7cbc71b39ae 100644
--- a/src/vnet/srp/node.c
+++ b/src/vnet/srp/node.c
@@ -580,7 +580,7 @@ static void init_ips_packet (srp_interface_t * si,
srp_ring_type_t tx_ring,
srp_ips_header_t * i)
{
- memset (i, 0, sizeof (i[0]));
+ clib_memset (i, 0, sizeof (i[0]));
i->srp.ttl = 1;
i->srp.is_inner_ring = tx_ring;
diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c
index c37923f7b01..46fb8293c64 100644
--- a/src/vnet/srv6/sr_api.c
+++ b/src/vnet/srv6/sr_api.c
@@ -71,7 +71,7 @@ static void vl_api_sr_localsid_add_del_t_handler
ip46_address_t prefix;
- memset (&prefix, 0, sizeof (ip46_address_t));
+ clib_memset (&prefix, 0, sizeof (ip46_address_t));
if ((mp->nh_addr4[0] | mp->nh_addr4[1] | mp->
nh_addr4[2] | mp->nh_addr4[3]) != 0)
memcpy (&prefix.ip4, mp->nh_addr4, sizeof (prefix.ip4));
@@ -210,7 +210,7 @@ static void send_sr_localsid_details
vl_api_sr_localsids_details_t *rmp;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_SR_LOCALSIDS_DETAILS);
clib_memcpy (rmp->addr.addr, &t->localsid, sizeof (ip6_address_t));
rmp->end_psp = t->end_psp;
@@ -261,9 +261,10 @@ static void send_sr_policies_details
rmp = vl_msg_api_alloc (sizeof (*rmp) +
vec_len (t->segments_lists) *
sizeof (vl_api_srv6_sid_list_t));
- memset (rmp, 0,
- (sizeof (*rmp) +
- vec_len (t->segments_lists) * sizeof (vl_api_srv6_sid_list_t)));
+ clib_memset (rmp, 0,
+ (sizeof (*rmp) +
+ vec_len (t->segments_lists) *
+ sizeof (vl_api_srv6_sid_list_t)));
rmp->_vl_msg_id = ntohs (VL_API_SR_POLICIES_DETAILS);
clib_memcpy (rmp->bsid.addr, &t->bsid, sizeof (ip6_address_t));
@@ -313,7 +314,7 @@ static void send_sr_steering_pol_details
ip6_sr_main_t *sm = &sr_main;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_SR_STEERING_POL_DETAILS);
//Get the SR policy BSID
diff --git a/src/vnet/srv6/sr_localsid.c b/src/vnet/srv6/sr_localsid.c
index 58fdbfd551b..7aeb1b680b2 100755
--- a/src/vnet/srv6/sr_localsid.c
+++ b/src/vnet/srv6/sr_localsid.c
@@ -146,7 +146,7 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr,
/* Create a new localsid registry */
pool_get (sm->localsids, ls);
- memset (ls, 0, sizeof (*ls));
+ clib_memset (ls, 0, sizeof (*ls));
clib_memcpy (&ls->localsid, localsid_addr, sizeof (ip6_address_t));
ls->end_psp = end_psp;
@@ -276,7 +276,7 @@ sr_cli_localsid_command_fn (vlib_main_t * vm, unformat_input_t * input,
int rv;
- memset (&resulting_address, 0, sizeof (ip6_address_t));
+ clib_memset (&resulting_address, 0, sizeof (ip6_address_t));
ip46_address_reset (&next_hop);
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -1549,7 +1549,7 @@ sr_localsid_register_function (vlib_main_t * vm, u8 * fn_name,
plugin - sm->plugin_functions);
}
- memset (plugin, 0, sizeof (*plugin));
+ clib_memset (plugin, 0, sizeof (*plugin));
plugin->sr_localsid_function_number = (plugin - sm->plugin_functions);
plugin->sr_localsid_function_number += SR_BEHAVIOR_LAST;
diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c
index 62ce224cd8e..c80b9c4505a 100755
--- a/src/vnet/srv6/sr_policy_rewrite.c
+++ b/src/vnet/srv6/sr_policy_rewrite.c
@@ -301,7 +301,7 @@ create_sl (ip6_sr_policy_t * sr_policy, ip6_address_t * sl, u32 weight,
ip6_sr_sl_t *segment_list;
pool_get (sm->sid_lists, segment_list);
- memset (segment_list, 0, sizeof (*segment_list));
+ clib_memset (segment_list, 0, sizeof (*segment_list));
vec_add1 (sr_policy->segments_lists, segment_list - sm->sid_lists);
@@ -588,7 +588,7 @@ sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments,
/* Add an SR policy object */
pool_get (sm->sr_policies, sr_policy);
- memset (sr_policy, 0, sizeof (*sr_policy));
+ clib_memset (sr_policy, 0, sizeof (*sr_policy));
clib_memcpy (&sr_policy->bsid, bsid, sizeof (ip6_address_t));
sr_policy->type = behavior;
sr_policy->fib_table = (fib_table != (u32) ~ 0 ? fib_table : 0); //Is default FIB 0 ?
diff --git a/src/vnet/srv6/sr_steering.c b/src/vnet/srv6/sr_steering.c
index a888fea9fda..d44bbae576f 100755
--- a/src/vnet/srv6/sr_steering.c
+++ b/src/vnet/srv6/sr_steering.c
@@ -69,7 +69,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
ip6_sr_policy_t *sr_policy = 0;
uword *p = 0;
- memset (&key, 0, sizeof (sr_steering_key_t));
+ clib_memset (&key, 0, sizeof (sr_steering_key_t));
/* Compute the steer policy key */
if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
@@ -245,7 +245,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
/* Create a new steering policy */
pool_get (sm->steer_policies, steer_pl);
- memset (steer_pl, 0, sizeof (*steer_pl));
+ clib_memset (steer_pl, 0, sizeof (*steer_pl));
if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
{
@@ -379,7 +379,7 @@ sr_steer_policy_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 sr_policy_set = 0;
- memset (&prefix, 0, sizeof (ip46_address_t));
+ clib_memset (&prefix, 0, sizeof (ip46_address_t));
int rv;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 5378de1c1da..e32b5c417ae 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -77,7 +77,7 @@ tcp_connection_bind (u32 session_index, transport_endpoint_t * lcl)
void *iface_ip;
pool_get (tm->listener_pool, listener);
- memset (listener, 0, sizeof (*listener));
+ clib_memset (listener, 0, sizeof (*listener));
listener->c_c_index = listener - tm->listener_pool;
listener->c_lcl_port = lcl->port;
@@ -121,7 +121,7 @@ tcp_connection_unbind (u32 listener_index)
/* Poison the entry */
if (CLIB_DEBUG > 0)
- memset (tc, 0xFA, sizeof (*tc));
+ clib_memset (tc, 0xFA, sizeof (*tc));
pool_put_index (tm->listener_pool, listener_index);
}
@@ -153,7 +153,7 @@ tcp_half_open_connection_del (tcp_connection_t * tc)
clib_spinlock_lock_if_init (&tm->half_open_lock);
pool_put_index (tm->half_open_connections, tc->c_c_index);
if (CLIB_DEBUG)
- memset (tc, 0xFA, sizeof (*tc));
+ clib_memset (tc, 0xFA, sizeof (*tc));
clib_spinlock_unlock_if_init (&tm->half_open_lock);
}
@@ -185,7 +185,7 @@ tcp_half_open_connection_new (void)
tcp_connection_t *tc = 0;
ASSERT (vlib_get_thread_index () == 0);
pool_get (tm->half_open_connections, tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->c_c_index = tc - tm->half_open_connections;
return tc;
}
@@ -225,7 +225,7 @@ tcp_connection_cleanup (tcp_connection_t * tc)
/* Poison the entry */
if (CLIB_DEBUG > 0)
- memset (tc, 0xFA, sizeof (*tc));
+ clib_memset (tc, 0xFA, sizeof (*tc));
pool_put (tm->connections[thread_index], tc);
}
}
@@ -252,7 +252,7 @@ tcp_connection_new (u8 thread_index)
tcp_connection_t *tc;
pool_get (tm->connections[thread_index], tc);
- memset (tc, 0, sizeof (*tc));
+ clib_memset (tc, 0, sizeof (*tc));
tc->c_c_index = tc - tm->connections[thread_index];
tc->c_thread_index = thread_index;
return tc;
@@ -435,7 +435,7 @@ tcp_connection_select_lb_bucket (tcp_connection_t * tc, const dpo_id_t * dpo,
if (tc->c_is_ip4)
{
ip4_tcp_hdr_t hdr;
- memset (&hdr, 0, sizeof (hdr));
+ clib_memset (&hdr, 0, sizeof (hdr));
hdr.ip.protocol = IP_PROTOCOL_TCP;
hdr.ip.address_pair.src.as_u32 = tc->c_lcl_ip.ip4.as_u32;
hdr.ip.address_pair.dst.as_u32 = tc->c_rmt_ip.ip4.as_u32;
@@ -446,7 +446,7 @@ tcp_connection_select_lb_bucket (tcp_connection_t * tc, const dpo_id_t * dpo,
else
{
ip6_tcp_hdr_t hdr;
- memset (&hdr, 0, sizeof (hdr));
+ clib_memset (&hdr, 0, sizeof (hdr));
hdr.ip.protocol = IP_PROTOCOL_TCP;
clib_memcpy (&hdr.ip.src_address, &tc->c_lcl_ip.ip6,
sizeof (ip6_address_t));
@@ -1453,7 +1453,7 @@ tcp_configure_v4_source_address_range (vlib_main_t * vm,
ip4_address_t * hi_addr, u32 fib_index,
int is_del);
- memset (&prefix, 0, sizeof (prefix));
+ clib_memset (&prefix, 0, sizeof (prefix));
fib_index = fib_table_find (FIB_PROTOCOL_IP4, table_id);
@@ -1538,7 +1538,7 @@ tcp_configure_v6_source_address_range (vlib_main_t * vm,
fib_node_index_t fei;
u32 sw_if_index;
- memset (&prefix, 0, sizeof (prefix));
+ clib_memset (&prefix, 0, sizeof (prefix));
fib_index = fib_table_find (FIB_PROTOCOL_IP6, table_id);
@@ -1763,7 +1763,7 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose)
if (!tc)
return s;
- memset (dummy_tc, 0, sizeof (*dummy_tc));
+ clib_memset (dummy_tc, 0, sizeof (*dummy_tc));
tcp_connection_timers_init (dummy_tc);
scoreboard_init (&dummy_tc->sack_sb);
dummy_tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK;
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index 87bacc24354..4e3987eeaed 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -622,7 +622,7 @@ scoreboard_remove_hole (sack_scoreboard_t * sb, sack_scoreboard_hole_t * hole)
/* Poison the entry */
if (CLIB_DEBUG > 0)
- memset (hole, 0xfe, sizeof (*hole));
+ clib_memset (hole, 0xfe, sizeof (*hole));
pool_put (sb->holes, hole);
}
@@ -635,7 +635,7 @@ scoreboard_insert_hole (sack_scoreboard_t * sb, u32 prev_index,
u32 hole_index;
pool_get (sb->holes, hole);
- memset (hole, 0, sizeof (*hole));
+ clib_memset (hole, 0, sizeof (*hole));
hole->start = start;
hole->end = end;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 7d7c32ad210..ed1c641d80f 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -599,7 +599,7 @@ tcp_make_syn (tcp_connection_t * tc, vlib_buffer_t * b)
initial_wnd = tcp_initial_window_to_advertise (tc);
/* Make and write options */
- memset (&snd_opts, 0, sizeof (snd_opts));
+ clib_memset (&snd_opts, 0, sizeof (snd_opts));
tcp_opts_len = tcp_make_syn_options (&snd_opts, tc->rcv_wscale);
tcp_hdr_opts_len = tcp_opts_len + sizeof (tcp_header_t);
@@ -622,7 +622,7 @@ tcp_make_synack (tcp_connection_t * tc, vlib_buffer_t * b)
tcp_header_t *th;
u16 initial_wnd;
- memset (snd_opts, 0, sizeof (*snd_opts));
+ clib_memset (snd_opts, 0, sizeof (*snd_opts));
tcp_reuse_buffer (vm, b);
initial_wnd = tcp_initial_window_to_advertise (tc);
diff --git a/src/vnet/tcp/tcp_syn_filter4.c b/src/vnet/tcp/tcp_syn_filter4.c
index 9b2a8ac7c87..6ec39a7bbeb 100644
--- a/src/vnet/tcp/tcp_syn_filter4.c
+++ b/src/vnet/tcp/tcp_syn_filter4.c
@@ -101,7 +101,7 @@ syn_filter4_node_fn (vlib_main_t * vm,
if (now > rt->next_reset)
{
- memset (rt->syn_counts, 0, vec_len (rt->syn_counts));
+ clib_memset (rt->syn_counts, 0, vec_len (rt->syn_counts));
rt->next_reset = now + rt->reset_interval;
}
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index f4814a3ce21..3eecfe9b4b5 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -96,7 +96,7 @@ tls_listener_ctx_alloc (void)
tls_ctx_t *ctx;
pool_get (tm->listener_ctx_pool, ctx);
- memset (ctx, 0, sizeof (*ctx));
+ clib_memset (ctx, 0, sizeof (*ctx));
return ctx - tm->listener_ctx_pool;
}
@@ -144,7 +144,7 @@ tls_ctx_half_open_alloc (void)
ctx_index = ctx - tm->half_open_ctx_pool;
clib_rwlock_reader_unlock (&tm->half_open_rwlock);
}
- memset (ctx, 0, sizeof (*ctx));
+ clib_memset (ctx, 0, sizeof (*ctx));
return ctx_index;
}
@@ -598,7 +598,7 @@ tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep)
}
sep->transport_proto = TRANSPORT_PROTO_TCP;
- memset (args, 0, sizeof (*args));
+ clib_memset (args, 0, sizeof (*args));
args->app_index = tm->app_index;
args->sep_ext = *sep;
if (vnet_bind (args))
@@ -762,8 +762,8 @@ tls_init (vlib_main_t * vm)
num_threads = 1 /* main thread */ + vtm->n_threads;
- memset (a, 0, sizeof (*a));
- memset (options, 0, sizeof (options));
+ clib_memset (a, 0, sizeof (*a));
+ clib_memset (options, 0, sizeof (options));
a->session_cb_vft = &tls_app_cb_vft;
a->api_client_index = APP_INVALID_INDEX;
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 96189364b34..85a22a982b3 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -45,7 +45,7 @@ udp_connection_alloc (u32 thread_index)
pool_get_aligned (um->connections[thread_index], uc,
CLIB_CACHE_LINE_BYTES);
}
- memset (uc, 0, sizeof (*uc));
+ clib_memset (uc, 0, sizeof (*uc));
uc->c_c_index = uc - um->connections[thread_index];
uc->c_thread_index = thread_index;
uc->c_proto = TRANSPORT_PROTO_UDP;
@@ -58,7 +58,7 @@ udp_connection_free (udp_connection_t * uc)
{
pool_put (udp_main.connections[uc->c_thread_index], uc);
if (CLIB_DEBUG)
- memset (uc, 0xFA, sizeof (*uc));
+ clib_memset (uc, 0xFA, sizeof (*uc));
}
u32
@@ -76,7 +76,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
return -1;
pool_get (um->listener_pool, listener);
- memset (listener, 0, sizeof (udp_connection_t));
+ clib_memset (listener, 0, sizeof (udp_connection_t));
listener->c_lcl_port = lcl->port;
listener->c_c_index = listener - um->listener_pool;
diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c
index 05840ec4bc9..63186761181 100644
--- a/src/vnet/udp/udp_api.c
+++ b/src/vnet/udp/udp_api.c
@@ -51,7 +51,7 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg,
vl_api_udp_encap_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_UDP_ENCAP_DETAILS);
mp->context = context;
diff --git a/src/vnet/udp/udp_local.c b/src/vnet/udp/udp_local.c
index f0d95304f13..bb7305d8d03 100644
--- a/src/vnet/udp/udp_local.c
+++ b/src/vnet/udp/udp_local.c
@@ -583,7 +583,7 @@ unformat_udp_header (unformat_input_t * input, va_list * args)
udp = p;
}
- memset (udp, 0, sizeof (udp[0]));
+ clib_memset (udp, 0, sizeof (udp[0]));
if (unformat (input, "src-port %d dst-port %d", &src_port, &dst_port))
{
udp->src_port = clib_host_to_net_u16 (src_port);
diff --git a/src/vnet/unix/pcap.c b/src/vnet/unix/pcap.c
index e91b8792c2a..3c9ce314d9c 100644
--- a/src/vnet/unix/pcap.c
+++ b/src/vnet/unix/pcap.c
@@ -113,7 +113,7 @@ pcap_write (pcap_main_t * pm)
clib_spinlock_init (&pm->lock);
/* Write file header. */
- memset (&fh, 0, sizeof (fh));
+ clib_memset (&fh, 0, sizeof (fh));
fh.magic = 0xa1b2c3d4;
fh.major_version = 2;
fh.minor_version = 4;
diff --git a/src/vnet/unix/tap_api.c b/src/vnet/unix/tap_api.c
index 026a9632eb8..8437c6a270b 100644
--- a/src/vnet/unix/tap_api.c
+++ b/src/vnet/unix/tap_api.c
@@ -65,7 +65,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -87,7 +87,7 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp)
u8 *tag;
vnet_tap_connect_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->intfc_name = mp->tap_name;
if (!mp->use_random_mac)
@@ -141,7 +141,7 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp)
vlib_main_t *vm = vlib_get_main ();
vnet_tap_connect_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->orig_sw_if_index = ntohl (mp->sw_if_index);
ap->intfc_name = mp->tap_name;
@@ -206,7 +206,7 @@ send_sw_interface_tap_details (vpe_api_main_t * am,
{
vl_api_sw_interface_tap_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_TAP_DETAILS);
mp->sw_if_index = ntohl (tap_if->sw_if_index);
strncpy ((char *) mp->dev_name,
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 00f093eb067..d183c3a9ea8 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -874,7 +874,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
if ((dev_net_tun_fd = open ("/dev/net/tun", O_RDWR)) < 0)
return VNET_API_ERROR_SYSCALL_ERROR_1;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name) - 1);
ifr.ifr_flags = flags;
if (ioctl (dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
@@ -895,7 +895,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
struct ifreq ifr;
struct sockaddr_ll sll;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, (char *) ap->intfc_name,
sizeof (ifr.ifr_name) - 1);
if (ioctl (dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
@@ -905,7 +905,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
}
/* Bind the provisioning socket to the interface. */
- memset (&sll, 0, sizeof (sll));
+ clib_memset (&sll, 0, sizeof (sll));
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifr.ifr_ifindex;
sll.sll_protocol = htons (ETH_P_ALL);
@@ -954,7 +954,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
/* ip4: mask defaults to /24 */
u32 mask = clib_host_to_net_u32 (0xFFFFFF00);
- memset (&sin, 0, sizeof (sin));
+ clib_memset (&sin, 0, sizeof (sin));
sin.sin_family = AF_INET;
/* sin.sin_port = 0; */
sin.sin_addr.s_addr = ap->ip4_address->as_u32;
@@ -998,7 +998,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
goto error;
}
- memset (&ifr2, 0, sizeof (ifr));
+ clib_memset (&ifr2, 0, sizeof (ifr));
strncpy (ifr2.ifr_name, (char *) ap->intfc_name,
sizeof (ifr2.ifr_name) - 1);
if (ioctl (sockfd6, SIOCGIFINDEX, &ifr2) < 0)
@@ -1316,7 +1316,7 @@ tap_modify_command_fn (vlib_main_t * vm,
user_hwaddr = 1;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->orig_sw_if_index = sw_if_index;
ap->intfc_name = intfc_name;
ap->sw_if_indexp = &new_sw_if_index;
@@ -1418,7 +1418,7 @@ tap_connect_command_fn (vlib_main_t * vm,
goto done;
}
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->intfc_name = intfc_name;
ap->hwaddr_arg = hwaddr_arg;
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 4a9bd46c31c..5f2259269f3 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -445,7 +445,7 @@ tuntap_exit (vlib_main_t * vm)
if (sfd < 0)
clib_unix_warning ("provisioning socket");
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
/* get flags, modify to bring down interface... */
@@ -535,7 +535,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
goto done;
}
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
ifr.ifr_flags = flags;
if (ioctl (tm->dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
@@ -563,7 +563,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
struct ifreq ifr;
struct sockaddr_ll sll;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
if (ioctl (tm->dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
{
@@ -572,7 +572,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
}
/* Bind the provisioning socket to the interface. */
- memset (&sll, 0, sizeof (sll));
+ clib_memset (&sll, 0, sizeof (sll));
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifr.ifr_ifindex;
sll.sll_protocol = htons (ETH_P_ALL);
@@ -719,7 +719,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
return;
/** See if we already know about this subif */
- memset (&subif_addr, 0, sizeof (subif_addr));
+ clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
clib_memcpy (&subif_addr.addr, address, sizeof (*address));
@@ -735,7 +735,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
}
/* Use subif pool index to select alias device. */
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
"%s:%d", tm->tun_name, (int) (ap - tm->subifs));
@@ -835,7 +835,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
return;
/* See if we already know about this subif */
- memset (&subif_addr, 0, sizeof (subif_addr));
+ clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
subif_addr.is_v6 = 1;
clib_memcpy (&subif_addr.addr, address, sizeof (*address));
@@ -852,8 +852,8 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
}
/* Use subif pool index to select alias device. */
- memset (&ifr, 0, sizeof (ifr));
- memset (&ifr6, 0, sizeof (ifr6));
+ clib_memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr6, 0, sizeof (ifr6));
snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
"%s:%d", tm->tun_name, (int) (ap - tm->subifs));
diff --git a/src/vnet/util/radix.c b/src/vnet/util/radix.c
index ff0b0f7bf38..82b0343348d 100644
--- a/src/vnet/util/radix.c
+++ b/src/vnet/util/radix.c
@@ -74,7 +74,7 @@ rm_alloc (void)
{
struct radix_mask *rm = clib_mem_alloc(sizeof(struct radix_mask));
- memset(rm, 0, sizeof(*rm));
+ clib_memset(rm, 0, sizeof(*rm));
return (rm);
}
@@ -88,7 +88,7 @@ rm_free (struct radix_mask *rm)
#define R_Malloc(p, t, n) \
{ \
p = (t) clib_mem_alloc((unsigned int)(n)); \
- memset(p, 0, n); \
+ clib_memset(p, 0, n); \
}
#define Free(p) clib_mem_free((p))
#define log(a,b, c...)
@@ -518,7 +518,7 @@ rn_addmask(
return mask_rnhead->rnh_nodes;
}
if (m0 < last_zeroed)
- memset(addmask_key + m0, 0, last_zeroed - m0);
+ clib_memset(addmask_key + m0, 0, last_zeroed - m0);
*addmask_key = last_zeroed = mlen;
x = rn_search(addmask_key, rn_masktop);
if (memcmp(addmask_key, x->rn_key, mlen) != 0)
@@ -528,7 +528,7 @@ rn_addmask(
R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x));
if ((saved_x = x) == NULL)
return NULL;
- memset(x, 0, max_keylen + 2 * sizeof (*x));
+ clib_memset(x, 0, max_keylen + 2 * sizeof (*x));
cp = netmask = (void *)(x + 2);
memmove(x + 2, addmask_key, mlen);
x = rn_insert(cp, mask_rnhead, &maskduplicated, x);
@@ -586,7 +586,7 @@ rn_new_radix_mask(
log(LOG_ERR, "Mask for route not entered\n");
return NULL;
}
- memset(m, 0, sizeof(*m));
+ clib_memset(m, 0, sizeof(*m));
m->rm_b = tt->rn_b;
m->rm_flags = tt->rn_flags;
if (tt->rn_flags & RNF_NORMAL)
@@ -1063,7 +1063,7 @@ rn_inithead0(struct radix_node_head *rnh, int off)
struct radix_node *tt;
struct radix_node *ttt;
- memset(rnh, 0, sizeof(*rnh));
+ clib_memset(rnh, 0, sizeof(*rnh));
t = rn_newpair(rn_zeros, off, rnh->rnh_nodes);
ttt = rnh->rnh_nodes + 2;
t->rn_r = ttt;
@@ -1090,7 +1090,7 @@ rn_module_init (vlib_main_t * vm)
if (rn_zeros == NULL)
return (clib_error_return (0, "RN Zeros..."));
- memset(rn_zeros, 0, 3 * max_keylen);
+ clib_memset(rn_zeros, 0, 3 * max_keylen);
rn_ones = cp = rn_zeros + max_keylen;
addmask_key = cplim = rn_ones + max_keylen;
while (cp < cplim)
diff --git a/src/vnet/util/throttle.h b/src/vnet/util/throttle.h
index 97ebb2597b3..45d437cf471 100644
--- a/src/vnet/util/throttle.h
+++ b/src/vnet/util/throttle.h
@@ -42,7 +42,7 @@ throttle_seed (throttle_t * t, u32 thread_index, f64 time_now)
if (time_now - t->last_seed_change_time[thread_index] > t->time)
{
(void) random_u32 (&t->seeds[thread_index]);
- memset (t->bitmaps[thread_index], 0, THROTTLE_BITS / BITS (u8));
+ clib_memset (t->bitmaps[thread_index], 0, THROTTLE_BITS / BITS (u8));
t->last_seed_change_time[thread_index] = time_now;
}
diff --git a/src/vnet/vxlan-gbp/decap.c b/src/vnet/vxlan-gbp/decap.c
index 12097986af5..1602e940f3f 100644
--- a/src/vnet/vxlan-gbp/decap.c
+++ b/src/vnet/vxlan-gbp/decap.c
@@ -179,9 +179,9 @@ vxlan_gbp_input (vlib_main_t * vm,
u32 thread_index = vlib_get_thread_index ();
if (is_ip4)
- memset (&last4, 0xff, sizeof last4);
+ clib_memset (&last4, 0xff, sizeof last4);
else
- memset (&last6, 0xff, sizeof last6);
+ clib_memset (&last6, 0xff, sizeof last6);
u32 next_index = node->cached_next_index;
diff --git a/src/vnet/vxlan-gbp/vxlan_gbp.c b/src/vnet/vxlan-gbp/vxlan_gbp.c
index d01a16799ef..45e4fdc390c 100644
--- a/src/vnet/vxlan-gbp/vxlan_gbp.c
+++ b/src/vnet/vxlan-gbp/vxlan_gbp.c
@@ -230,7 +230,7 @@ vxlan_gbp_rewrite (vxlan_gbp_tunnel_t * t, bool is_ip6)
vxlan_gbp_header_t *vxlan_gbp;
/* Fixed portion of the (outer) ip header */
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
if (!is_ip6)
{
ip4_header_t *ip = &h.h4.ip4;
@@ -407,7 +407,7 @@ int vnet_vxlan_gbp_tunnel_add_del
return VNET_API_ERROR_INVALID_DECAP_NEXT;
pool_get_aligned (vxm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
dev_instance = t - vxm->tunnels;
/* copy from arg structure */
diff --git a/src/vnet/vxlan-gbp/vxlan_gbp_api.c b/src/vnet/vxlan-gbp/vxlan_gbp_api.c
index cf3f7fe9670..b7e6935b2f8 100644
--- a/src/vnet/vxlan-gbp/vxlan_gbp_api.c
+++ b/src/vnet/vxlan-gbp/vxlan_gbp_api.c
@@ -131,7 +131,7 @@ static void send_vxlan_gbp_tunnel_details
IP46_TYPE_IP4 : IP46_TYPE_IP6);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_VXLAN_GBP_TUNNEL_DETAILS);
ip_address_encode (&t->src, itype, &rmp->tunnel.src);
diff --git a/src/vnet/vxlan-gpe/decap.c b/src/vnet/vxlan-gpe/decap.c
index 975323df5da..9c429294d67 100644
--- a/src/vnet/vxlan-gpe/decap.c
+++ b/src/vnet/vxlan-gpe/decap.c
@@ -121,9 +121,9 @@ vxlan_gpe_input (vlib_main_t * vm,
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
if (is_ip4)
- memset (&last_key4, 0xff, sizeof (last_key4));
+ clib_memset (&last_key4, 0xff, sizeof (last_key4));
else
- memset (&last_key6, 0xff, sizeof (last_key6));
+ clib_memset (&last_key6, 0xff, sizeof (last_key6));
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/vxlan-gpe/vxlan_gpe.c b/src/vnet/vxlan-gpe/vxlan_gpe.c
index ac3e1784009..c14cc734fb3 100644
--- a/src/vnet/vxlan-gpe/vxlan_gpe.c
+++ b/src/vnet/vxlan-gpe/vxlan_gpe.c
@@ -509,7 +509,7 @@ int vnet_vxlan_gpe_add_del_tunnel
return VNET_API_ERROR_TUNNEL_EXIST;
pool_get_aligned (ngm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
/* copy from arg structure */
/* *INDENT-OFF* */
@@ -914,7 +914,7 @@ vxlan_gpe_add_del_tunnel_command_fn (vlib_main_t * vm,
goto done;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = is_add;
a->is_ip6 = ipv6_set;
diff --git a/src/vnet/vxlan-gpe/vxlan_gpe_api.c b/src/vnet/vxlan-gpe/vxlan_gpe_api.c
index e23b2fed033..22a28a73a77 100644
--- a/src/vnet/vxlan-gpe/vxlan_gpe_api.c
+++ b/src/vnet/vxlan-gpe/vxlan_gpe_api.c
@@ -112,7 +112,7 @@ static void
rv = VNET_API_ERROR_SAME_SRC_DST;
goto out;
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->is_add = mp->is_add;
a->is_ip6 = mp->is_ipv6;
@@ -152,7 +152,7 @@ static void send_vxlan_gpe_tunnel_details
u8 is_ipv6 = !(t->flags & VXLAN_GPE_TUNNEL_IS_IPV4);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_VXLAN_GPE_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/vnet/vxlan/decap.c b/src/vnet/vxlan/decap.c
index b84a9b6eb56..efd718994c9 100644
--- a/src/vnet/vxlan/decap.c
+++ b/src/vnet/vxlan/decap.c
@@ -204,9 +204,9 @@ vxlan_input (vlib_main_t * vm,
u32 thread_index = vlib_get_thread_index ();
if (is_ip4)
- memset (&last4, 0xff, sizeof last4);
+ clib_memset (&last4, 0xff, sizeof last4);
else
- memset (&last6, 0xff, sizeof last6);
+ clib_memset (&last6, 0xff, sizeof last6);
u32 *from = vlib_frame_vector_args (from_frame);
u32 n_left_from = from_frame->n_vectors;
diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c
index 4276d6689ac..a26428673c5 100644
--- a/src/vnet/vxlan/vxlan.c
+++ b/src/vnet/vxlan/vxlan.c
@@ -241,7 +241,7 @@ vxlan_rewrite (vxlan_tunnel_t * t, bool is_ip6)
vxlan_header_t *vxlan;
/* Fixed portion of the (outer) ip header */
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
if (!is_ip6)
{
ip4_header_t *ip = &h.h4.ip4;
@@ -419,7 +419,7 @@ int vnet_vxlan_add_del_tunnel
vxlan_tunnel_t *t;
pool_get_aligned (vxm->tunnels, t, CLIB_CACHE_LINE_BYTES);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
dev_instance = t - vxm->tunnels;
/* copy from arg structure */
diff --git a/src/vnet/vxlan/vxlan_api.c b/src/vnet/vxlan/vxlan_api.c
index 512cc896650..2cec93c7687 100644
--- a/src/vnet/vxlan/vxlan_api.c
+++ b/src/vnet/vxlan/vxlan_api.c
@@ -180,7 +180,7 @@ static void send_vxlan_tunnel_details
u8 is_ipv6 = !ip46_address_is_ip4 (&t->dst);
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_VXLAN_TUNNEL_DETAILS);
if (is_ipv6)
{
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c
index a57db289250..6a12c4ab963 100644
--- a/src/vpp-api/client/client.c
+++ b/src/vpp-api/client/client.c
@@ -115,7 +115,7 @@ static void
init (void)
{
vac_main_t *pm = &vac_main;
- memset(pm, 0, sizeof(*pm));
+ clib_memset(pm, 0, sizeof(*pm));
pthread_mutex_init(&pm->queue_lock, NULL);
pthread_cond_init(&pm->suspend_cv, NULL);
pthread_cond_init(&pm->resume_cv, NULL);
@@ -137,7 +137,7 @@ cleanup (void)
pthread_cond_destroy(&pm->timeout_cv);
pthread_cond_destroy(&pm->timeout_cancel_cv);
pthread_cond_destroy(&pm->terminate_cv);
- memset(pm, 0, sizeof(*pm));
+ clib_memset(pm, 0, sizeof(*pm));
}
/*
@@ -215,7 +215,7 @@ vac_rx_thread_fn (void *arg)
case VL_API_MEMCLNT_KEEPALIVE:
mp = (void *)msg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs(VL_API_MEMCLNT_KEEPALIVE_REPLY);
rmp->context = mp->context;
shmem_hdr = am->shmem_hdr;
@@ -472,7 +472,7 @@ vac_read (char **p, int *l, u16 timeout)
/* Handle an alive-check ping from vpp. */
mp = (void *)msg;
rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rmp->_vl_msg_id = ntohs(VL_API_MEMCLNT_KEEPALIVE_REPLY);
rmp->context = mp->context;
shmem_hdr = am->shmem_hdr;
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index 0042a2be4e4..5e10e18c43e 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -89,7 +89,7 @@ stat_segment_connect (char *socket_name)
int mfd = -1;
int sock;
- memset (sm, 0, sizeof (*sm));
+ clib_memset (sm, 0, sizeof (*sm));
if ((sock = socket (AF_UNIX, SOCK_SEQPACKET, 0)) < 0)
{
perror ("Couldn't open socket");
diff --git a/src/vpp-api/client/test.c b/src/vpp-api/client/test.c
index 8061fe58fb6..da2211b6459 100644
--- a/src/vpp-api/client/test.c
+++ b/src/vpp-api/client/test.c
@@ -55,7 +55,7 @@ volatile u16 result_msg_id;
#define M_NOALLOC(T,t) \
do { \
result_ready = 0; \
- memset (mp, 0, sizeof (*mp)); \
+ clib_memset (mp, 0, sizeof (*mp)); \
mp->_vl_msg_id = ntohs (VL_API_##T); \
mp->client_index = am->my_client_index; \
} while(0);
diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c
index 70382d17bbb..031c421d355 100644
--- a/src/vpp-api/vapi/vapi.c
+++ b/src/vpp-api/vapi/vapi.c
@@ -262,8 +262,9 @@ vapi_ctx_alloc (vapi_ctx_t * result)
{
goto fail;
}
- memset (ctx->vapi_msg_id_t_to_vl_msg_id, ~0,
- __vapi_metadata.count * sizeof (*ctx->vapi_msg_id_t_to_vl_msg_id));
+ clib_memset (ctx->vapi_msg_id_t_to_vl_msg_id, ~0,
+ __vapi_metadata.count *
+ sizeof (*ctx->vapi_msg_id_t_to_vl_msg_id));
ctx->event_cbs = calloc (__vapi_metadata.count, sizeof (*ctx->event_cbs));
if (!ctx->event_cbs)
{
@@ -318,7 +319,7 @@ vapi_connect (vapi_ctx_t ctx, const char *name,
return VAPI_ENOMEM;
}
ctx->requests = tmp;
- memset (ctx->requests, 0, size);
+ clib_memset (ctx->requests, 0, size);
/* coverity[MISSING_LOCK] - 177211 requests_mutex is not needed here */
ctx->requests_start = ctx->requests_count = 0;
if (chroot_prefix)
@@ -651,8 +652,8 @@ vapi_dispatch_response (vapi_ctx_t ctx, vapi_msg_id_t id,
requests_start].callback_ctx,
VAPI_ENORESP, true,
NULL);
- memset (&ctx->requests[ctx->requests_start], 0,
- sizeof (ctx->requests[ctx->requests_start]));
+ clib_memset (&ctx->requests[ctx->requests_start], 0,
+ sizeof (ctx->requests[ctx->requests_start]));
++ctx->requests_start;
--ctx->requests_count;
if (ctx->requests_start == ctx->requests_size)
@@ -693,8 +694,8 @@ vapi_dispatch_response (vapi_ctx_t ctx, vapi_msg_id_t id,
}
if (is_last)
{
- memset (&ctx->requests[ctx->requests_start], 0,
- sizeof (ctx->requests[ctx->requests_start]));
+ clib_memset (&ctx->requests[ctx->requests_start], 0,
+ sizeof (ctx->requests[ctx->requests_start]));
++ctx->requests_start;
--ctx->requests_count;
if (ctx->requests_start == ctx->requests_size)
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 86865099532..cf5d252e347 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -292,7 +292,7 @@ vl_api_show_threads_t_handler (vl_api_show_threads_t * mp)
return;
rmp = vl_msg_api_alloc (msg_size);
- memset (rmp, 0, msg_size);
+ clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id = htons (VL_API_SHOW_THREADS_REPLY);
rmp->context = mp->context;
rmp->count = htonl (count);
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c
index 8f33f042c5d..7770880d01c 100644
--- a/src/vpp/api/api_main.c
+++ b/src/vpp/api/api_main.c
@@ -92,7 +92,7 @@ maybe_register_api_client (vat_main_t * vam)
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
- memset (regp, 0, sizeof (*regp));
+ clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
regp->vlib_rp = svm;
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 8fd4a8deeb1..727032fb1bf 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -536,7 +536,7 @@ static void *vl_api_tap_connect_t_print
u8 *s;
u8 null_mac[6];
- memset (null_mac, 0, sizeof (null_mac));
+ clib_memset (null_mac, 0, sizeof (null_mac));
s = format (0, "SCRIPT: tap_connect ");
s = format (s, "tapname %s ", mp->tap_name);
@@ -561,7 +561,7 @@ static void *vl_api_tap_modify_t_print
u8 *s;
u8 null_mac[6];
- memset (null_mac, 0, sizeof (null_mac));
+ clib_memset (null_mac, 0, sizeof (null_mac));
s = format (0, "SCRIPT: tap_modify ");
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
@@ -602,7 +602,7 @@ static void *vl_api_tap_create_v2_t_print
u8 *s;
u8 null_mac[6];
- memset (null_mac, 0, sizeof (null_mac));
+ clib_memset (null_mac, 0, sizeof (null_mac));
s = format (0, "SCRIPT: tap_create_v2 ");
s = format (s, "id %u ", ntohl (mp->id));
@@ -662,7 +662,7 @@ static void *vl_api_bond_create_t_print
u8 *s;
u8 null_mac[6];
- memset (null_mac, 0, sizeof (null_mac));
+ clib_memset (null_mac, 0, sizeof (null_mac));
s = format (0, "SCRIPT: bond_create ");
if (memcmp (mp->mac_address, null_mac, 6))
@@ -1036,7 +1036,7 @@ static void *vl_api_ip_neighbor_add_del_t_print
u8 *s;
u8 null_mac[6];
- memset (null_mac, 0, sizeof (null_mac));
+ clib_memset (null_mac, 0, sizeof (null_mac));
s = format (0, "SCRIPT: ip_neighbor_add_del ");
@@ -3601,7 +3601,7 @@ static void *vl_api_sw_interface_set_lldp_t_print
u8 *s;
u8 null_data[256];
- memset (null_data, 0, sizeof (null_data));
+ clib_memset (null_data, 0, sizeof (null_data));
s = format (0, "SCRIPT: sw_interface_set_lldp ");
s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
diff --git a/src/vpp/api/gmon.c b/src/vpp/api/gmon.c
index 6b33373070d..f665a09c62a 100644
--- a/src/vpp/api/gmon.c
+++ b/src/vpp/api/gmon.c
@@ -172,7 +172,7 @@ gmon_init (vlib_main_t * vm)
gm->vlib_main = vm;
- memset (ma, 0, sizeof (*ma));
+ clib_memset (ma, 0, sizeof (*ma));
ma->root_path = am->root_path;
ma->uid = am->api_uid;
ma->gid = am->api_gid;
diff --git a/src/vpp/api/json_format.c b/src/vpp/api/json_format.c
index 63454b87ac7..e001be04601 100644
--- a/src/vpp/api/json_format.c
+++ b/src/vpp/api/json_format.c
@@ -245,7 +245,7 @@ void
vat_json_print (FILE * ofp, vat_json_node_t * node)
{
vat_print_ctx_t ctx;
- memset (&ctx, 0, sizeof ctx);
+ clib_memset (&ctx, 0, sizeof ctx);
ctx.indent = 0;
ctx.ofp = ofp;
fformat (ofp, "\n");
diff --git a/src/vpp/api/plugin.c b/src/vpp/api/plugin.c
index 1506a82ddca..51f3461f1ec 100644
--- a/src/vpp/api/plugin.c
+++ b/src/vpp/api/plugin.c
@@ -160,7 +160,7 @@ vat_load_new_plugins (plugin_main_t * pm)
_vec_len (pm->plugin_info) = vec_len (pm->plugin_info) - 1;
continue;
}
- memset (pi, 0, sizeof (*pi));
+ clib_memset (pi, 0, sizeof (*pi));
hash_set_mem (pm->plugin_by_name_hash, plugin_name,
pi - pm->plugin_info);
}
diff --git a/src/vpp/api/summary_stats_client.c b/src/vpp/api/summary_stats_client.c
index 8c8e9bbe44f..60a0cd921b5 100644
--- a/src/vpp/api/summary_stats_client.c
+++ b/src/vpp/api/summary_stats_client.c
@@ -266,7 +266,7 @@ main (int argc, char **argv)
exit (1);
}
- memset (&tm->send_data_addr, 0, sizeof (tm->send_data_addr));
+ clib_memset (&tm->send_data_addr, 0, sizeof (tm->send_data_addr));
tm->send_data_addr.sin_family = AF_INET;
tm->send_data_addr.sin_addr.s_addr = collector_ip.as_u32;
tm->send_data_addr.sin_port = htons (collector_port);
@@ -281,7 +281,7 @@ main (int argc, char **argv)
break;
/* Poll for stats */
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_VNET_GET_SUMMARY_STATS);
mp->client_index = tm->my_client_index;
vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
diff --git a/src/vpp/api/test_client.c b/src/vpp/api/test_client.c
index e36fdbfc22c..1239732ec8e 100644
--- a/src/vpp/api/test_client.c
+++ b/src/vpp/api/test_client.c
@@ -656,7 +656,7 @@ link_up_down_enable_disable (test_main_t * tm, int enable)
/* Request admin / link up down messages */
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_WANT_INTERFACE_EVENTS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -672,7 +672,7 @@ stats_enable_disable (test_main_t * tm, int enable)
vl_api_want_stats_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_WANT_STATS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -688,7 +688,7 @@ oam_events_enable_disable (test_main_t * tm, int enable)
vl_api_want_oam_events_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_WANT_OAM_EVENTS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -705,7 +705,7 @@ oam_add_del (test_main_t * tm, int is_add)
ip4_address_t tmp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_OAM_ADD_DEL);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -727,7 +727,7 @@ dump (test_main_t * tm)
vl_api_sw_interface_dump_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DUMP);
mp->client_index = tm->my_client_index;
mp->name_filter_valid = 1;
@@ -743,7 +743,7 @@ add_del_ip4_route (test_main_t * tm, int enable_disable)
u32 tmp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -772,7 +772,7 @@ add_del_ip6_route (test_main_t * tm, int enable_disable)
u64 tmp[2];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -804,7 +804,7 @@ add_del_interface_address (test_main_t * tm, int enable_disable)
u32 tmp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -825,7 +825,7 @@ add_del_v6_interface_address (test_main_t * tm, int enable_disable)
u64 tmp[2];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -849,7 +849,7 @@ del_all_interface_addresses (test_main_t * tm)
vl_api_sw_interface_add_del_address_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -865,7 +865,7 @@ set_interface_table (test_main_t * tm, int is_ipv6, u32 vrf_id)
vl_api_sw_interface_set_table_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_TABLE);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -882,7 +882,7 @@ connect_unix_tap (test_main_t * tm, char *name)
vl_api_tap_connect_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -897,7 +897,7 @@ create_vlan_subif (test_main_t * tm, u32 vlan_id)
vl_api_create_vlan_subif_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_CREATE_VLAN_SUBIF);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -914,7 +914,7 @@ add_del_proxy_arp (test_main_t * tm, int is_add)
u32 tmp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_ADD_DEL);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -937,7 +937,7 @@ proxy_arp_intfc_enable_disable (test_main_t * tm, int enable_disable)
vl_api_proxy_arp_intfc_enable_disable_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -954,14 +954,14 @@ add_ip4_neighbor (test_main_t * tm, int add_del)
u32 tmp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
mp->sw_if_index = ntohl (6);
mp->is_add = add_del;
- memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
+ clib_memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
tmp = ntohl (0x0101010a);
clib_memcpy (mp->dst_address, &tmp, 4);
@@ -976,7 +976,7 @@ add_ip6_neighbor (test_main_t * tm, int add_del)
u64 tmp[2];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -984,7 +984,7 @@ add_ip6_neighbor (test_main_t * tm, int add_del)
mp->is_add = add_del;
mp->is_ipv6 = 1;
- memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
+ clib_memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
tmp[1] = clib_host_to_net_u64 (0x11ULL);
@@ -1001,7 +1001,7 @@ reset_fib (test_main_t * tm, u8 is_ip6)
vl_api_reset_fib_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_RESET_FIB);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1017,7 +1017,7 @@ dhcpv6_set_vss (test_main_t * tm)
vl_api_dhcp_proxy_set_vss_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1034,7 +1034,7 @@ dhcpv4_set_vss (test_main_t * tm)
vl_api_dhcp_proxy_set_vss_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1058,7 +1058,7 @@ dhcp_set_proxy (test_main_t * tm, int ipv6)
vl_api_dhcp_proxy_config_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_CONFIG);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1095,7 +1095,7 @@ set_ip_flow_hash (test_main_t * tm, u8 is_ip6)
vl_api_set_ip_flow_hash_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SET_IP_FLOW_HASH);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1113,7 +1113,7 @@ ip6nd_ra_config (test_main_t * tm, int is_no)
vl_api_sw_interface_ip6nd_ra_config_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1134,7 +1134,7 @@ ip6nd_ra_prefix (test_main_t * tm, int is_no)
u64 tmp[2];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1164,7 +1164,7 @@ ip6_enable_disable (test_main_t * tm, int enable)
vl_api_sw_interface_ip6_enable_disable_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1181,7 +1181,7 @@ loop_create (test_main_t * tm)
vl_api_create_loopback_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_CREATE_LOOPBACK);
mp->client_index = tm->my_client_index;
@@ -1196,7 +1196,7 @@ ip6_set_link_local_address (test_main_t * tm)
u64 tmp[2];
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1220,7 +1220,7 @@ set_flags (test_main_t * tm, int up_down)
vl_api_sw_interface_set_flags_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
mp->client_index = tm->my_client_index;
@@ -1237,7 +1237,7 @@ l2_patch_add_del (test_main_t * tm, int is_add)
vl_api_l2_patch_add_del_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_L2_PATCH_ADD_DEL);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1254,7 +1254,7 @@ l2_xconnect (test_main_t * tm)
vl_api_sw_interface_set_l2_xconnect_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_XCONNECT);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
@@ -1271,7 +1271,7 @@ l2_bridge (test_main_t * tm)
vl_api_sw_interface_set_l2_bridge_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_BRIDGE);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
diff --git a/src/vpp/api/test_ha.c b/src/vpp/api/test_ha.c
index d88c4d4c1f4..b9fc428d192 100644
--- a/src/vpp/api/test_ha.c
+++ b/src/vpp/api/test_ha.c
@@ -113,7 +113,7 @@ ping (test_main_t * tm)
vl_api_control_ping_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_CONTROL_PING);
mp->client_index = tm->my_client_index;
mp->context = 0xdeadbeef;
diff --git a/src/vpp/api/vpp_get_metrics.c b/src/vpp/api/vpp_get_metrics.c
index 3474133da3f..9241e6d70c5 100644
--- a/src/vpp/api/vpp_get_metrics.c
+++ b/src/vpp/api/vpp_get_metrics.c
@@ -69,7 +69,7 @@ setup_signal_handlers (void)
for (i = 1; i < 32; i++)
{
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_sigaction = (void *) unix_signal_handler;
sa.sa_flags = SA_SIGINFO;
@@ -177,7 +177,7 @@ main (int argc, char **argv)
setup_signal_handlers ();
- memset (ma, 0, sizeof (*ma));
+ clib_memset (ma, 0, sizeof (*ma));
ma->root_path = chroot_path;
ma->uid = uid;
ma->gid = gid;
diff --git a/src/vpp/app/vpp_prometheus_export.c b/src/vpp/app/vpp_prometheus_export.c
index b12ce6f30d2..e2fdd7150e5 100644
--- a/src/vpp/app/vpp_prometheus_export.c
+++ b/src/vpp/app/vpp_prometheus_export.c
@@ -200,7 +200,7 @@ start_listen (u16 port)
return -1;
}
- memset (&serveraddr, 0, sizeof (serveraddr));
+ clib_memset (&serveraddr, 0, sizeof (serveraddr));
serveraddr.sin6_family = AF_INET6;
serveraddr.sin6_port = htons (port);
serveraddr.sin6_addr = in6addr_any;
diff --git a/src/vpp/app/vppctl.c b/src/vpp/app/vppctl.c
index b7582c07c1c..31c9e43a770 100644
--- a/src/vpp/app/vppctl.c
+++ b/src/vpp/app/vppctl.c
@@ -180,7 +180,7 @@ main (int argc, char *argv[])
if (is_interactive)
{
/* Capture terminal resize events */
- memset (&sa, 0, sizeof (struct sigaction));
+ clib_memset (&sa, 0, sizeof (struct sigaction));
sa.sa_handler = signal_handler_winch;
if (sigaction (SIGWINCH, &sa, 0) < 0)
{
diff --git a/src/vpp/oam/oam.c b/src/vpp/oam/oam.c
index 1579f562a67..8cee64b9628 100644
--- a/src/vpp/oam/oam.c
+++ b/src/vpp/oam/oam.c
@@ -29,7 +29,7 @@ init_oam_packet_template (oam_main_t * om, oam_target_t * t)
vec_validate (t->template, 0);
h = t->template;
- memset (h, 0, sizeof (*h));
+ clib_memset (h, 0, sizeof (*h));
h->ip4.src_address.as_u32 = t->src_address.as_u32;
h->ip4.dst_address.as_u32 = t->dst_address.as_u32;
@@ -83,7 +83,7 @@ vpe_oam_add_del_target (ip4_address_t * src_address,
return VNET_API_ERROR_INVALID_REGISTRATION; /* already there... */
pool_get (om->targets, t);
- memset (t, 0, sizeof (*t));
+ clib_memset (t, 0, sizeof (*t));
t->src_address.as_u32 = src_address->as_u32;
t->dst_address.as_u32 = dst_address->as_u32;
t->fib_id = fib_id;
diff --git a/src/vpp/stats/stats_to_be_deprecated.c b/src/vpp/stats/stats_to_be_deprecated.c
index 241bdd978df..70974271658 100644
--- a/src/vpp/stats/stats_to_be_deprecated.c
+++ b/src/vpp/stats/stats_to_be_deprecated.c
@@ -870,7 +870,7 @@ do_combined_per_interface_counters (stats_main_t * sm)
continue;
}
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp) + sizeof (*vp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id =
ntohs (VL_API_VNET_PER_INTERFACE_COMBINED_COUNTERS);
@@ -1070,7 +1070,7 @@ do_simple_per_interface_counters (stats_main_t * sm)
}
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp) + sizeof (*vp));
- memset (mp, 0, sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_VNET_PER_INTERFACE_SIMPLE_COUNTERS);
/*
@@ -3046,8 +3046,8 @@ vl_api_vnet_get_summary_stats_t_handler (vl_api_vnet_get_summary_stats_t * mp)
rmp->context = mp->context;
rmp->retval = 0;
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
vnet_interface_counter_lock (im);
@@ -3128,7 +3128,7 @@ stats_init (vlib_main_t * vm)
sm->data_structure_lock =
clib_mem_alloc_aligned (sizeof (data_structure_lock_t),
CLIB_CACHE_LINE_BYTES);
- memset (sm->data_structure_lock, 0, sizeof (*sm->data_structure_lock));
+ clib_memset (sm->data_structure_lock, 0, sizeof (*sm->data_structure_lock));
#define _(N,n) \
vl_msg_api_set_handlers(VL_API_##N, #n, \
diff --git a/src/vppinfra/asm_x86.c b/src/vppinfra/asm_x86.c
index 16e41c249b1..e6e00ce5543 100644
--- a/src/vppinfra/asm_x86.c
+++ b/src/vppinfra/asm_x86.c
@@ -1500,7 +1500,7 @@ u8 * x86_insn_parse (x86_insn_parse_t * p, u8 * code_start)
/* Preserve global parse flags. */
parse_flags = p->flags & (X86_INSN_PARSE_32_BIT | X86_INSN_PARSE_64_BIT);
- memset (p, 0, sizeof (p[0]));
+ clib_memset (p, 0, sizeof (p[0]));
p->flags = parse_flags;
/* 64 implies 32 bit parsing. */
diff --git a/src/vppinfra/bihash_16_8.h b/src/vppinfra/bihash_16_8.h
index 5949e2b3549..f6515b8aea0 100644
--- a/src/vppinfra/bihash_16_8.h
+++ b/src/vppinfra/bihash_16_8.h
@@ -36,7 +36,7 @@ typedef struct
static inline int
clib_bihash_is_free_16_8 (clib_bihash_kv_16_8_t * v)
{
- /* Free values are memset to 0xff, check a bit... */
+ /* Free values are clib_memset to 0xff, check a bit... */
if (v->key[0] == ~0ULL && v->value == ~0ULL)
return 1;
return 0;
diff --git a/src/vppinfra/bihash_16_8_32.h b/src/vppinfra/bihash_16_8_32.h
index d30625da39a..3e83ad2c52f 100644
--- a/src/vppinfra/bihash_16_8_32.h
+++ b/src/vppinfra/bihash_16_8_32.h
@@ -38,7 +38,7 @@ typedef struct
static inline int
clib_bihash_is_free_16_8_32 (clib_bihash_kv_16_8_32_t * v)
{
- /* Free values are memset to 0xff, check a bit... */
+ /* Free values are clib_memset to 0xff, check a bit... */
if (v->key[0] == ~0ULL && v->value == ~0ULL)
return 1;
return 0;
diff --git a/src/vppinfra/bihash_24_8.h b/src/vppinfra/bihash_24_8.h
index c028352d0e9..6d1cdd310bd 100644
--- a/src/vppinfra/bihash_24_8.h
+++ b/src/vppinfra/bihash_24_8.h
@@ -36,7 +36,7 @@ typedef struct
static inline int
clib_bihash_is_free_24_8 (const clib_bihash_kv_24_8_t * v)
{
- /* Free values are memset to 0xff, check a bit... */
+ /* Free values are clib_memset to 0xff, check a bit... */
if (v->key[0] == ~0ULL && v->value == ~0ULL)
return 1;
return 0;
diff --git a/src/vppinfra/bihash_40_8.h b/src/vppinfra/bihash_40_8.h
index fe57ba03966..b85adb09712 100644
--- a/src/vppinfra/bihash_40_8.h
+++ b/src/vppinfra/bihash_40_8.h
@@ -37,7 +37,7 @@ typedef struct
static inline int
clib_bihash_is_free_40_8 (const clib_bihash_kv_40_8_t * v)
{
- /* Free values are memset to 0xff, check a bit... */
+ /* Free values are clib_memset to 0xff, check a bit... */
if (v->key[0] == ~0ULL && v->value == ~0ULL)
return 1;
return 0;
diff --git a/src/vppinfra/bihash_48_8.h b/src/vppinfra/bihash_48_8.h
index 9aebe66d264..328a90b0fd4 100644
--- a/src/vppinfra/bihash_48_8.h
+++ b/src/vppinfra/bihash_48_8.h
@@ -37,7 +37,7 @@ typedef struct
static inline int
clib_bihash_is_free_48_8 (const clib_bihash_kv_48_8_t * v)
{
- /* Free values are memset to 0xff, check a bit... */
+ /* Free values are clib_memset to 0xff, check a bit... */
if (v->key[0] == ~0ULL && v->value == ~0ULL)
return 1;
return 0;
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c
index 752597ebbd5..e218f4b0dc6 100644
--- a/src/vppinfra/bihash_template.c
+++ b/src/vppinfra/bihash_template.c
@@ -203,7 +203,7 @@ void BV (clib_bihash_free) (BVT (clib_bihash) * h)
(void) close (h->memfd);
#endif
clib_mem_vm_free ((void *) (uword) (alloc_arena (h)), alloc_arena_size (h));
- memset (h, 0, sizeof (*h));
+ clib_memset (h, 0, sizeof (*h));
}
static
@@ -234,7 +234,7 @@ initialize:
* if we replace (1<<log2_pages) with vec_len(rv).
* No clue.
*/
- memset (rv, 0xff, sizeof (*rv) * (1 << log2_pages));
+ clib_memset (rv, 0xff, sizeof (*rv) * (1 << log2_pages));
return rv;
}
@@ -247,7 +247,7 @@ BV (value_free) (BVT (clib_bihash) * h, BVT (clib_bihash_value) * v,
ASSERT (vec_len (h->freelists) > log2_pages);
if (CLIB_DEBUG > 0)
- memset (v, 0xFE, sizeof (*v) * (1 << log2_pages));
+ clib_memset (v, 0xFE, sizeof (*v) * (1 << log2_pages));
v->next_free_as_u64 = (u64) h->freelists[log2_pages];
h->freelists[log2_pages] = (u64) BV (clib_bihash_get_offset) (h, v);
@@ -295,7 +295,7 @@ BV (make_working_copy) (BVT (clib_bihash) * h, BVT (clib_bihash_bucket) * b)
v = BV (clib_bihash_get_value) (h, b->offset);
- clib_memcpy (working_copy, v, sizeof (*v) * (1 << b->log2_pages));
+ _clib_memcpy (working_copy, v, sizeof (*v) * (1 << b->log2_pages));
working_bucket.as_u64 = b->as_u64;
working_bucket.offset = BV (clib_bihash_get_offset) (h, working_copy);
CLIB_MEMORY_BARRIER ();
@@ -338,8 +338,8 @@ BV (split_and_rehash)
/* Empty slot */
if (BV (clib_bihash_is_free) (&(new_v->kvp[j])))
{
- clib_memcpy (&(new_v->kvp[j]), &(old_values->kvp[i]),
- sizeof (new_v->kvp[j]));
+ _clib_memcpy (&(new_v->kvp[j]), &(old_values->kvp[i]),
+ sizeof (new_v->kvp[j]));
goto doublebreak;
}
}
@@ -383,8 +383,8 @@ BV (split_and_rehash_linear)
if (BV (clib_bihash_is_free) (&(new_values->kvp[j])))
{
/* Copy the old value and move along */
- clib_memcpy (&(new_values->kvp[j]), &(old_values->kvp[i]),
- sizeof (new_values->kvp[j]));
+ _clib_memcpy (&(new_values->kvp[j]), &(old_values->kvp[i]),
+ sizeof (new_values->kvp[j]));
j++;
goto doublebreak;
}
@@ -472,7 +472,7 @@ static inline int BV (clib_bihash_add_del_inline)
if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
{
CLIB_MEMORY_BARRIER (); /* Add a delay */
- clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
+ _clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
BV (clib_bihash_unlock_bucket) (b);
return (0);
}
@@ -488,10 +488,10 @@ static inline int BV (clib_bihash_add_del_inline)
* Copy the value first, so that if a reader manages
* to match the new key, the value will be right...
*/
- clib_memcpy (&(v->kvp[i].value),
- &add_v->value, sizeof (add_v->value));
+ _clib_memcpy (&(v->kvp[i].value),
+ &add_v->value, sizeof (add_v->value));
CLIB_MEMORY_BARRIER (); /* Make sure the value has settled */
- clib_memcpy (&(v->kvp[i]), &add_v->key, sizeof (add_v->key));
+ _clib_memcpy (&(v->kvp[i]), &add_v->key, sizeof (add_v->key));
b->refcnt++;
ASSERT (b->refcnt > 0);
BV (clib_bihash_unlock_bucket) (b);
@@ -506,7 +506,7 @@ static inline int BV (clib_bihash_add_del_inline)
if (is_stale_cb (&(v->kvp[i]), arg))
{
CLIB_MEMORY_BARRIER ();
- clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
+ _clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
BV (clib_bihash_unlock_bucket) (b);
return (0);
}
@@ -521,7 +521,7 @@ static inline int BV (clib_bihash_add_del_inline)
/* Found the key? Kill it... */
if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
{
- memset (&(v->kvp[i]), 0xff, sizeof (*(add_v)));
+ clib_memset (&(v->kvp[i]), 0xff, sizeof (*(add_v)));
/* Is the bucket empty? */
if (PREDICT_TRUE (b->refcnt > 1))
{
@@ -602,7 +602,7 @@ static inline int BV (clib_bihash_add_del_inline)
{
if (BV (clib_bihash_is_free) (&(new_v->kvp[i])))
{
- clib_memcpy (&(new_v->kvp[i]), add_v, sizeof (*add_v));
+ _clib_memcpy (&(new_v->kvp[i]), add_v, sizeof (*add_v));
goto expand_ok;
}
}
diff --git a/src/vppinfra/cuckoo_8_8.h b/src/vppinfra/cuckoo_8_8.h
index 6fe334da32d..a3d07c870eb 100644
--- a/src/vppinfra/cuckoo_8_8.h
+++ b/src/vppinfra/cuckoo_8_8.h
@@ -64,7 +64,7 @@ clib_cuckoo_kv_is_free_8_8 (const clib_cuckoo_kv_8_8_t * v)
always_inline void
clib_cuckoo_kv_set_free_8_8 (clib_cuckoo_kv_8_8_t * v)
{
- memset (v, 0xff, sizeof (*v));
+ clib_memset (v, 0xff, sizeof (*v));
}
/** Format a clib_cuckoo_kv_8_8_t instance
diff --git a/src/vppinfra/cuckoo_template.c b/src/vppinfra/cuckoo_template.c
index 595bd1ca3bc..119a407962f 100644
--- a/src/vppinfra/cuckoo_template.c
+++ b/src/vppinfra/cuckoo_template.c
@@ -180,7 +180,7 @@ void CV (clib_cuckoo_init) (CVT (clib_cuckoo) * h, const char *name,
CVT (clib_cuckoo_bucket) * bucket;
/* *INDENT-OFF* */
clib_cuckoo_foreach_bucket (
- bucket, h, { memset (bucket->elts, 0xff, sizeof (bucket->elts)); });
+ bucket, h, { clib_memset (bucket->elts, 0xff, sizeof (bucket->elts)); });
/* *INDENT-ON* */
h->name = name;
h->garbage_callback = garbage_callback;
@@ -189,7 +189,7 @@ void CV (clib_cuckoo_init) (CVT (clib_cuckoo) * h, const char *name,
void CV (clib_cuckoo_free) (CVT (clib_cuckoo) * h)
{
- memset (h, 0, sizeof (*h));
+ clib_memset (h, 0, sizeof (*h));
}
static clib_cuckoo_bucket_aux_t
@@ -227,7 +227,7 @@ static clib_cuckoo_path_t *CV (clib_cuckoo_path_get) (CVT (clib_cuckoo) * h)
{
clib_cuckoo_path_t *path;
pool_get (h->paths, path);
- memset (path, 0, sizeof (*path));
+ clib_memset (path, 0, sizeof (*path));
#if CLIB_CUCKOO_DEBUG_PATH_DETAIL
CLIB_CUCKOO_DBG ("Get path @%lu", (long unsigned) (path - h->paths));
#endif
@@ -531,10 +531,10 @@ static void CV (clib_cuckoo_bucket_tidy) (CVT (clib_cuckoo_bucket) * b)
static void CV (clib_cuckoo_free_locked_elt) (CVT (clib_cuckoo_kv) * elt)
{
/*
- * FIXME - improve performance by getting rid of this memset - make all
+ * FIXME - improve performance by getting rid of this clib_memset - make all
* functions in this file not rely on clib_cuckoo_kv_is_free but instead
* take use_count into account */
- memset (elt, 0xff, sizeof (*elt));
+ clib_memset (elt, 0xff, sizeof (*elt));
}
static void CV (clib_cuckoo_free_elt_in_bucket) (CVT (clib_cuckoo_bucket) * b,
@@ -736,7 +736,7 @@ static void CV (clib_cuckoo_rehash) (CVT (clib_cuckoo) * h)
CVT (clib_cuckoo_bucket) * bucket;
for (bucket = new + old_nbuckets; bucket < vec_end (new); ++bucket)
{
- memset (bucket->elts, 0xff, sizeof (bucket->elts));
+ clib_memset (bucket->elts, 0xff, sizeof (bucket->elts));
}
/*
* this for loop manipulates the new (unseen) memory, so no locks
diff --git a/src/vppinfra/dlist.h b/src/vppinfra/dlist.h
index e445b39f336..d28500dc49f 100644
--- a/src/vppinfra/dlist.h
+++ b/src/vppinfra/dlist.h
@@ -36,7 +36,7 @@ static inline void
clib_dlist_init (dlist_elt_t * pool, u32 index)
{
dlist_elt_t *head = pool_elt_at_index (pool, index);
- memset (head, 0xFF, sizeof (*head));
+ clib_memset (head, 0xFF, sizeof (*head));
}
static inline void
diff --git a/src/vppinfra/elf.c b/src/vppinfra/elf.c
index 931fbcccc48..a8c5d307cdf 100644
--- a/src/vppinfra/elf.c
+++ b/src/vppinfra/elf.c
@@ -983,7 +983,7 @@ elf_parse (elf_main_t * em, void *data, uword data_bytes)
{
char *save = em->file_name;
- memset (em, 0, sizeof (em[0]));
+ clib_memset (em, 0, sizeof (em[0]));
em->file_name = save;
}
@@ -1435,7 +1435,7 @@ static void string_table_init (string_table_builder_t * b, u8 * old_table)
static void
string_table_init (string_table_builder_t * b, u8 * old_table)
{
- memset (b, 0, sizeof (b[0]));
+ clib_memset (b, 0, sizeof (b[0]));
b->old_table = old_table;
b->hash = hash_create_string (0, sizeof (uword));
}
diff --git a/src/vppinfra/elf.h b/src/vppinfra/elf.h
index c57b06f5d2a..cceb13e256b 100644
--- a/src/vppinfra/elf.h
+++ b/src/vppinfra/elf.h
@@ -919,7 +919,7 @@ typedef struct
always_inline void
elf_main_init (elf_main_t * em)
{
- memset (em, 0, sizeof (em[0]));
+ clib_memset (em, 0, sizeof (em[0]));
}
always_inline void
diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c
index c6902eb86ea..8e3f6c18dfa 100644
--- a/src/vppinfra/elog.c
+++ b/src/vppinfra/elog.c
@@ -469,7 +469,7 @@ elog_alloc (elog_main_t * em, u32 n_events)
void
elog_init (elog_main_t * em, u32 n_events)
{
- memset (em, 0, sizeof (em[0]));
+ clib_memset (em, 0, sizeof (em[0]));
em->lock = 0;
@@ -636,7 +636,7 @@ elog_merge (elog_main_t * dst, u8 * dst_tag, elog_main_t * src, u8 * src_tag,
elog_track_t newt;
int i;
- memset (&newt, 0, sizeof (newt));
+ clib_memset (&newt, 0, sizeof (newt));
/* Acquire src and dst events */
elog_get_events (src);
diff --git a/src/vppinfra/fheap.c b/src/vppinfra/fheap.c
index 1369245615a..034168e85ab 100644
--- a/src/vppinfra/fheap.c
+++ b/src/vppinfra/fheap.c
@@ -167,7 +167,7 @@ fheap_add (fheap_t * f, u32 ni, u32 key)
n = vec_elt_at_index (f->nodes, ni);
- memset (n, 0, sizeof (n[0]));
+ clib_memset (n, 0, sizeof (n[0]));
n->parent = n->first_child = n->next_sibling = n->prev_sibling = ~0;
n->key = key;
diff --git a/src/vppinfra/fheap.h b/src/vppinfra/fheap.h
index 6d4965f1bea..1dbd52bad76 100644
--- a/src/vppinfra/fheap.h
+++ b/src/vppinfra/fheap.h
@@ -89,7 +89,7 @@ fheap_init (fheap_t * f, u32 n_nodes)
fheap_node_t *save_nodes = f->nodes;
u32 *save_root_list = f->root_list_by_rank;
- memset (f, 0, sizeof (f[0]));
+ clib_memset (f, 0, sizeof (f[0]));
f->nodes = save_nodes;
f->root_list_by_rank = save_root_list;
diff --git a/src/vppinfra/fifo.c b/src/vppinfra/fifo.c
index 5b4c76d1084..e3b7b415cb3 100644
--- a/src/vppinfra/fifo.c
+++ b/src/vppinfra/fifo.c
@@ -121,7 +121,7 @@ _clib_fifo_resize (void *v_old, uword n_new_elts, uword elt_bytes)
/* Zero empty space. */
n_zero_bytes = (n_new_elts - n_old_elts) * elt_bytes;
- memset (v_new + n_copy_bytes, 0, n_zero_bytes);
+ clib_memset (v_new + n_copy_bytes, 0, n_zero_bytes);
clib_fifo_free (v_old);
diff --git a/src/vppinfra/flowhash_template.h b/src/vppinfra/flowhash_template.h
index 92272563878..d7a621c1754 100644
--- a/src/vppinfra/flowhash_template.h
+++ b/src/vppinfra/flowhash_template.h
@@ -374,7 +374,7 @@ FVT(flowhash) *FV(flowhash_alloc)(u32 fixed_entries, u32 collision_buckets)
/* Fill free elements list */
int i;
- memset(h->entries, 0, sizeof(h->entries[0]) * entries);
+ clib_memset(h->entries, 0, sizeof(h->entries[0]) * entries);
for (i = 1; i <= collision_buckets; i++)
{
h->free_buckets_indices[-i] =
diff --git a/src/vppinfra/format.c b/src/vppinfra/format.c
index e2fd84bb08b..886f03d9c5f 100644
--- a/src/vppinfra/format.c
+++ b/src/vppinfra/format.c
@@ -139,13 +139,13 @@ justify (u8 * s, format_info_t * fi, uword s_len_orig)
if (n_left > 0)
{
vec_insert (s, n_left, i0);
- memset (s + i0, fi->pad_char, n_left);
+ clib_memset (s + i0, fi->pad_char, n_left);
l1 = vec_len (s);
}
if (n_right > 0)
{
vec_resize (s, n_right);
- memset (s + l1, fi->pad_char, n_right);
+ clib_memset (s + l1, fi->pad_char, n_right);
}
}
return s;
diff --git a/src/vppinfra/format.h b/src/vppinfra/format.h
index 9a3a342076b..94344474067 100644
--- a/src/vppinfra/format.h
+++ b/src/vppinfra/format.h
@@ -153,7 +153,7 @@ unformat_init (unformat_input_t * i,
uword (*fill_buffer) (unformat_input_t *),
void *fill_buffer_arg)
{
- memset (i, 0, sizeof (i[0]));
+ clib_memset (i, 0, sizeof (i[0]));
i->fill_buffer = fill_buffer;
i->fill_buffer_arg = fill_buffer_arg;
}
@@ -163,7 +163,7 @@ unformat_free (unformat_input_t * i)
{
vec_free (i->buffer);
vec_free (i->buffer_marks);
- memset (i, 0, sizeof (i[0]));
+ clib_memset (i, 0, sizeof (i[0]));
}
always_inline uword
diff --git a/src/vppinfra/graph.c b/src/vppinfra/graph.c
index ea11a96f1c8..3f8a3e8423e 100644
--- a/src/vppinfra/graph.c
+++ b/src/vppinfra/graph.c
@@ -102,7 +102,7 @@ graph_del_node (graph_t * g, u32 src)
index = src_node - g->nodes;
pool_put (g->nodes, src_node);
- memset (src_node, ~0, sizeof (src_node[0]));
+ clib_memset (src_node, ~0, sizeof (src_node[0]));
return index;
}
diff --git a/src/vppinfra/hash.c b/src/vppinfra/hash.c
index abc7c4ce4a2..2ff8ebfd17b 100644
--- a/src/vppinfra/hash.c
+++ b/src/vppinfra/hash.c
@@ -43,13 +43,13 @@
always_inline void
zero_pair (hash_t * h, hash_pair_t * p)
{
- memset (p, 0, hash_pair_bytes (h));
+ clib_memset (p, 0, hash_pair_bytes (h));
}
always_inline void
init_pair (hash_t * h, hash_pair_t * p)
{
- memset (p->value, ~0, hash_value_bytes (h));
+ clib_memset (p->value, ~0, hash_value_bytes (h));
}
always_inline hash_pair_union_t *
@@ -624,7 +624,7 @@ hash_next (void *v, hash_next_t * hn)
{
/* Restore flags. */
h->flags = hn->f;
- memset (hn, 0, sizeof (hn[0]));
+ clib_memset (hn, 0, sizeof (hn[0]));
return 0;
}
diff --git a/src/vppinfra/hash.h b/src/vppinfra/hash.h
index 36a70066044..892b2ea916c 100644
--- a/src/vppinfra/hash.h
+++ b/src/vppinfra/hash.h
@@ -496,7 +496,7 @@ hash_set_value_bytes (hash_t * h, uword value_bytes)
_format_pair,_format_pair_arg) \
({ \
hash_t _h; \
- memset (&_h, 0, sizeof (_h)); \
+ clib_memset (&_h, 0, sizeof (_h)); \
_h.user = (_user); \
_h.key_sum = (hash_key_sum_function_t *) (_key_sum); \
_h.key_equal = (_key_equal); \
diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c
index 2a5fb5c8d8e..f7b1f6bb31e 100644
--- a/src/vppinfra/heap.c
+++ b/src/vppinfra/heap.c
@@ -698,7 +698,7 @@ format_heap (u8 * s, va_list * va)
heap_header_t *h = heap_header (v);
heap_header_t zero;
- memset (&zero, 0, sizeof (zero));
+ clib_memset (&zero, 0, sizeof (zero));
if (!v)
h = &zero;
diff --git a/src/vppinfra/heap.h b/src/vppinfra/heap.h
index f76c9453e65..b6e9f022852 100644
--- a/src/vppinfra/heap.h
+++ b/src/vppinfra/heap.h
@@ -260,7 +260,7 @@ heap_create_from_memory (void *memory, uword max_len, uword elt_bytes)
return 0;
h = memory;
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
h->max_len = max_len;
h->elt_bytes = elt_bytes;
h->flags = HEAP_IS_STATIC;
diff --git a/src/vppinfra/lock.h b/src/vppinfra/lock.h
index 4645378360d..337c5a3f0ad 100644
--- a/src/vppinfra/lock.h
+++ b/src/vppinfra/lock.h
@@ -57,7 +57,7 @@ static inline void
clib_spinlock_init (clib_spinlock_t * p)
{
*p = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES, CLIB_CACHE_LINE_BYTES);
- memset ((void *) *p, 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) *p, 0, CLIB_CACHE_LINE_BYTES);
}
static inline void
@@ -122,7 +122,7 @@ always_inline void
clib_rwlock_init (clib_rwlock_t * p)
{
*p = clib_mem_alloc_aligned (CLIB_CACHE_LINE_BYTES, CLIB_CACHE_LINE_BYTES);
- memset ((void *) *p, 0, CLIB_CACHE_LINE_BYTES);
+ clib_memset ((void *) *p, 0, CLIB_CACHE_LINE_BYTES);
}
always_inline void
diff --git a/src/vppinfra/maplog.c b/src/vppinfra/maplog.c
index 1900aa8f03b..68913365130 100644
--- a/src/vppinfra/maplog.c
+++ b/src/vppinfra/maplog.c
@@ -42,7 +42,7 @@ clib_maplog_init (clib_maplog_init_args_t * a)
if (mm->flags & CLIB_MAPLOG_FLAG_INIT)
return (-2);
- memset (mm, 0, sizeof (*mm));
+ clib_memset (mm, 0, sizeof (*mm));
record_size_in_cache_lines =
(a->record_size_in_bytes + CLIB_CACHE_LINE_BYTES -
@@ -113,7 +113,7 @@ clib_maplog_init (clib_maplog_init_args_t * a)
(void) close (fd);
}
- memset (h, 0, sizeof (*h));
+ clib_memset (h, 0, sizeof (*h));
h->maplog_major_version = MAPLOG_MAJOR_VERSION;
h->maplog_minor_version = MAPLOG_MINOR_VERSION;
h->maplog_patch_version = MAPLOG_PATCH_VERSION;
@@ -321,7 +321,7 @@ clib_maplog_close (clib_maplog_main_t * mm)
vec_free (mm->file_basename);
vec_free (mm->header_filename);
- memset (mm, 0, sizeof (*mm));
+ clib_memset (mm, 0, sizeof (*mm));
}
/**
diff --git a/src/vppinfra/mem.h b/src/vppinfra/mem.h
index 9cc62ed7592..04c26d218aa 100644
--- a/src/vppinfra/mem.h
+++ b/src/vppinfra/mem.h
@@ -52,7 +52,7 @@
#endif
#include <vppinfra/os.h>
-#include <vppinfra/string.h> /* memcpy, memset */
+#include <vppinfra/string.h> /* memcpy, clib_memset */
#include <vppinfra/valgrind.h>
#define CLIB_MAX_MHEAPS 256
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c
index 8afb0507092..6268709bb36 100644
--- a/src/vppinfra/mem_dlmalloc.c
+++ b/src/vppinfra/mem_dlmalloc.c
@@ -73,7 +73,7 @@ mheap_get_trace (uword offset, uword size)
return;
/* Spurious Coverity warnings be gone. */
- memset (&trace, 0, sizeof (trace));
+ clib_memset (&trace, 0, sizeof (trace));
/* Skip our frame and mspace_get_aligned's frame */
n_callers = clib_backtrace (trace.callers, ARRAY_LEN (trace.callers), 2);
@@ -185,7 +185,7 @@ mheap_put_trace (uword offset, uword size)
{
hash_unset_mem (tm->trace_by_callers, t->callers);
vec_add1 (tm->trace_free_list, trace_index);
- memset (t, 0, sizeof (t[0]));
+ clib_memset (t, 0, sizeof (t[0]));
}
tm->enabled = save_enabled;
clib_spinlock_unlock (&tm->lock);
diff --git a/src/vppinfra/memcpy_avx2.h b/src/vppinfra/memcpy_avx2.h
index 6519d86924e..64dff4e5ddb 100644
--- a/src/vppinfra/memcpy_avx2.h
+++ b/src/vppinfra/memcpy_avx2.h
@@ -109,7 +109,7 @@ clib_mov128blocks (u8 * dst, const u8 * src, size_t n)
}
static inline void *
-clib_memcpy (void *dst, const void *src, size_t n)
+_clib_memcpy (void *dst, const void *src, size_t n)
{
uword dstu = (uword) dst;
uword srcu = (uword) src;
diff --git a/src/vppinfra/memcpy_avx512.h b/src/vppinfra/memcpy_avx512.h
index 67982500b6c..e5245268770 100644
--- a/src/vppinfra/memcpy_avx512.h
+++ b/src/vppinfra/memcpy_avx512.h
@@ -139,7 +139,7 @@ clib_mov512blocks (u8 * dst, const u8 * src, size_t n)
}
static inline void *
-clib_memcpy (void *dst, const void *src, size_t n)
+_clib_memcpy (void *dst, const void *src, size_t n)
{
uword dstu = (uword) dst;
uword srcu = (uword) src;
diff --git a/src/vppinfra/memcpy_sse3.h b/src/vppinfra/memcpy_sse3.h
index 5e4bf7d79c5..2dd9399d428 100644
--- a/src/vppinfra/memcpy_sse3.h
+++ b/src/vppinfra/memcpy_sse3.h
@@ -183,7 +183,7 @@ clib_mov256 (u8 * dst, const u8 * src)
})
static inline void *
-clib_memcpy (void *dst, const void *src, size_t n)
+_clib_memcpy (void *dst, const void *src, size_t n)
{
__m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
uword dstu = (uword) dst;
diff --git a/src/vppinfra/mhash.c b/src/vppinfra/mhash.c
index b694cc7c50f..e09d7193f68 100644
--- a/src/vppinfra/mhash.c
+++ b/src/vppinfra/mhash.c
@@ -202,7 +202,7 @@ mhash_init (mhash_t * h, uword n_value_bytes, uword n_key_bytes)
vec_free (h->key_tmps);
hash_free (h->hash);
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
h->n_key_bytes = n_key_bytes;
#if 0
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index 0a62943e2f2..ba5bbc9b6e7 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -935,7 +935,7 @@ mheap_alloc_with_flags (void *memory, uword memory_size, uword flags)
clib_mem_vm_map (h, sizeof (h[0]));
/* Zero vector header: both heap header and vector length. */
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
_vec_len (v) = 0;
h->vm_alloc_offset_from_header = (void *) h - memory;
@@ -953,8 +953,8 @@ mheap_alloc_with_flags (void *memory, uword memory_size, uword flags)
(clib_address_t) v, h->max_size);
/* Initialize free list heads to empty. */
- memset (h->first_free_elt_uoffset_by_bin, 0xFF,
- sizeof (h->first_free_elt_uoffset_by_bin));
+ clib_memset (h->first_free_elt_uoffset_by_bin, 0xFF,
+ sizeof (h->first_free_elt_uoffset_by_bin));
return v;
}
@@ -1236,7 +1236,7 @@ format_mheap (u8 * s, va_list * va)
mheap_elt_t *e;
uword i, n_hist;
- memset (hist, 0, sizeof (hist));
+ clib_memset (hist, 0, sizeof (hist));
n_hist = 0;
for (e = v;
@@ -1536,7 +1536,7 @@ mheap_get_trace (void *v, uword offset, uword size)
mheap_trace_t trace;
/* Spurious Coverity warnings be gone. */
- memset (&trace, 0, sizeof (trace));
+ clib_memset (&trace, 0, sizeof (trace));
n_callers = clib_backtrace (trace.callers, ARRAY_LEN (trace.callers),
/* Skip mheap_get_aligned's frame */ 1);
@@ -1630,7 +1630,7 @@ mheap_put_trace (void *v, uword offset, uword size)
{
hash_unset_mem (tm->trace_by_callers, t->callers);
vec_add1 (tm->trace_free_list, trace_index);
- memset (t, 0, sizeof (t[0]));
+ clib_memset (t, 0, sizeof (t[0]));
}
}
diff --git a/src/vppinfra/phash.c b/src/vppinfra/phash.c
index f6eecaa4103..52c29b33f78 100644
--- a/src/vppinfra/phash.c
+++ b/src/vppinfra/phash.c
@@ -605,7 +605,7 @@ perfect (phash_main_t * pm)
/* clear any state from previous attempts */
if (vec_bytes (pm->tabh))
- memset (pm->tabh, ~0, vec_bytes (pm->tabh));
+ clib_memset (pm->tabh, ~0, vec_bytes (pm->tabh));
vec_validate (pm->tabb_sort, vec_len (pm->tabb) - 1);
for (i = 0; i < vec_len (pm->tabb_sort); i++)
diff --git a/src/vppinfra/phash.h b/src/vppinfra/phash.h
index 746a0fddfab..3dc59c724f7 100644
--- a/src/vppinfra/phash.h
+++ b/src/vppinfra/phash.h
@@ -168,7 +168,7 @@ phash_main_free (phash_main_t * pm)
phash_main_free_working_memory (pm);
vec_free (pm->tab);
vec_free (pm->keys);
- memset (pm, 0, sizeof (pm[0]));
+ clib_memset (pm, 0, sizeof (pm[0]));
}
/* Slow hash computation for general keys. */
diff --git a/src/vppinfra/pool.c b/src/vppinfra/pool.c
index ed83b41afef..ed04eb68e31 100644
--- a/src/vppinfra/pool.c
+++ b/src/vppinfra/pool.c
@@ -107,7 +107,8 @@ _pool_init_fixed (void **pool_ptr, u32 elt_size, u32 max_elts)
/* Set the entire free bitmap */
clib_bitmap_alloc (fh->free_bitmap, max_elts);
- memset (fh->free_bitmap, 0xff, vec_len (fh->free_bitmap) * sizeof (uword));
+ clib_memset (fh->free_bitmap, 0xff,
+ vec_len (fh->free_bitmap) * sizeof (uword));
/* Clear any extraneous set bits */
set_bits = vec_len (fh->free_bitmap) * BITS (uword);
diff --git a/src/vppinfra/qhash.c b/src/vppinfra/qhash.c
index f4e38c4a1d7..3b5a175065d 100644
--- a/src/vppinfra/qhash.c
+++ b/src/vppinfra/qhash.c
@@ -61,7 +61,7 @@ _qhash_resize (void *v, uword length, uword elt_bytes)
CLIB_CACHE_LINE_BYTES);
vec_resize (h->hash_key_valid_bitmap,
1 << (l - QHASH_LOG2_KEYS_PER_BUCKET));
- memset (v, ~0, elt_bytes << l);
+ clib_memset (v, ~0, elt_bytes << l);
return v;
}
@@ -123,7 +123,8 @@ qhash_get_multiple (void *v,
if (!v)
{
- memset (result_indices, ~0, sizeof (result_indices[0]) * n_search_keys);
+ clib_memset (result_indices, ~0,
+ sizeof (result_indices[0]) * n_search_keys);
return;
}
@@ -417,7 +418,7 @@ qhash_set_overflow (void *v, uword elt_bytes,
uword dl = round_pow2 (1 + i - l, 8);
v = _vec_resize (v, dl, (l + dl) * elt_bytes, sizeof (h[0]),
/* align */ sizeof (uword));
- memset (v + l * elt_bytes, ~0, dl * elt_bytes);
+ clib_memset (v + l * elt_bytes, ~0, dl * elt_bytes);
}
}
diff --git a/src/vppinfra/random_buffer.c b/src/vppinfra/random_buffer.c
index df03698066c..52de5d34dd0 100644
--- a/src/vppinfra/random_buffer.c
+++ b/src/vppinfra/random_buffer.c
@@ -63,7 +63,7 @@ clib_random_buffer_init (clib_random_buffer_t * b, uword seed)
{
uword i, j;
- memset (b, 0, sizeof (b[0]));
+ clib_memset (b, 0, sizeof (b[0]));
/* Seed ISAAC. */
for (i = 0; i < ARRAY_LEN (b->ctx); i++)
diff --git a/src/vppinfra/serialize.c b/src/vppinfra/serialize.c
index a098aa2d98a..ef9cf03f362 100644
--- a/src/vppinfra/serialize.c
+++ b/src/vppinfra/serialize.c
@@ -572,7 +572,7 @@ unserialize_heap (serialize_main_t * m, va_list * va)
return;
}
- memset (&h, 0, sizeof (h));
+ clib_memset (&h, 0, sizeof (h));
#define _(f) unserialize_integer (m, &h.f, sizeof (h.f));
foreach_serialize_heap_header_integer;
#undef _
@@ -882,7 +882,7 @@ unserialize_close (serialize_main_t * m)
void
serialize_open_data (serialize_main_t * m, u8 * data, uword n_data_bytes)
{
- memset (m, 0, sizeof (m[0]));
+ clib_memset (m, 0, sizeof (m[0]));
m->stream.buffer = data;
m->stream.n_buffer_bytes = n_data_bytes;
}
@@ -908,7 +908,7 @@ serialize_vector_write (serialize_main_header_t * m, serialize_stream_t * s)
void
serialize_open_vector (serialize_main_t * m, u8 * vector)
{
- memset (m, 0, sizeof (m[0]));
+ clib_memset (m, 0, sizeof (m[0]));
m->header.data_function = serialize_vector_write;
m->stream.buffer = vector;
m->stream.current_buffer_index = 0;
@@ -926,7 +926,7 @@ serialize_close_vector (serialize_main_t * m)
if (s->buffer)
_vec_len (s->buffer) = s->current_buffer_index;
result = s->buffer;
- memset (m, 0, sizeof (m[0]));
+ clib_memset (m, 0, sizeof (m[0]));
return result;
}
@@ -1192,7 +1192,7 @@ static void
serialize_open_clib_file_descriptor_helper (serialize_main_t * m, int fd,
uword is_read)
{
- memset (m, 0, sizeof (m[0]));
+ clib_memset (m, 0, sizeof (m[0]));
vec_resize (m->stream.buffer, 4096);
if (!is_read)
diff --git a/src/vppinfra/slist.c b/src/vppinfra/slist.c
index 892517bbb79..5598871c884 100644
--- a/src/vppinfra/slist.c
+++ b/src/vppinfra/slist.c
@@ -54,7 +54,7 @@ clib_slist_init (clib_slist_t * sp, f64 branching_factor,
format_function_t format_user_element)
{
clib_slist_elt_t *head;
- memset (sp, 0, sizeof (sp[0]));
+ clib_memset (sp, 0, sizeof (sp[0]));
sp->branching_factor = branching_factor;
sp->format_user_element = format_user_element;
sp->compare = compare;
@@ -88,7 +88,7 @@ slist_search_internal (clib_slist_t * sp, void *key, int need_full_path)
* Initial negotiating position, only the head_elt is
* lighter than the supplied key
*/
- memset (sp->path, 0, vec_len (head_elt->n.nexts) * sizeof (u32));
+ clib_memset (sp->path, 0, vec_len (head_elt->n.nexts) * sizeof (u32));
/* Walk the fastest lane first */
level = vec_len (head_elt->n.nexts) - 1;
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index 29b2a945cb9..990d0f7390b 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -73,7 +73,7 @@ find_free_port (word sock)
{
struct sockaddr_in a;
- memset (&a, 0, sizeof (a)); /* Warnings be gone */
+ clib_memset (&a, 0, sizeof (a)); /* Warnings be gone */
a.sin_family = PF_INET;
a.sin_addr.s_addr = INADDR_ANY;
@@ -289,7 +289,7 @@ default_socket_sendmsg (clib_socket_t * s, void *msg, int msglen,
if (num_fds > 0)
{
struct cmsghdr *cmsg;
- memset (&ctl, 0, sizeof (ctl));
+ clib_memset (&ctl, 0, sizeof (ctl));
mh.msg_control = ctl;
mh.msg_controllen = sizeof (ctl);
cmsg = CMSG_FIRSTHDR (&mh);
@@ -328,7 +328,7 @@ default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen,
mh.msg_control = ctl;
mh.msg_controllen = sizeof (ctl);
- memset (ctl, 0, sizeof (ctl));
+ clib_memset (ctl, 0, sizeof (ctl));
/* receive the incoming message */
size = recvmsg (s->fd, &mh, 0);
@@ -525,7 +525,7 @@ clib_socket_accept (clib_socket_t * server, clib_socket_t * client)
clib_error_t *err = 0;
socklen_t len = 0;
- memset (client, 0, sizeof (client[0]));
+ clib_memset (client, 0, sizeof (client[0]));
/* Accept the new socket connection. */
client->fd = accept (server->fd, 0, 0);
diff --git a/src/vppinfra/socket.h b/src/vppinfra/socket.h
index 4f9e9509342..b5f005839e4 100644
--- a/src/vppinfra/socket.h
+++ b/src/vppinfra/socket.h
@@ -168,7 +168,7 @@ clib_socket_free (clib_socket_t * s)
vec_free (s->rx_buffer);
if (clib_mem_is_heap_object (s->config))
vec_free (s->config);
- memset (s, 0, sizeof (s[0]));
+ clib_memset (s, 0, sizeof (s[0]));
}
always_inline clib_error_t *
diff --git a/src/vppinfra/string.c b/src/vppinfra/string.c
index ba21e7b3490..b90f432c0cc 100644
--- a/src/vppinfra/string.c
+++ b/src/vppinfra/string.c
@@ -85,6 +85,25 @@ clib_memswap (void *_a, void *_b, uword bytes)
}
}
+void
+clib_c11_violation (const char *s)
+{
+ _clib_error (CLIB_ERROR_WARNING, (char *) __FUNCTION__, 0, (char *) s);
+}
+
+errno_t
+memcpy_s (void *__restrict__ dest, rsize_t dmax,
+ const void *__restrict__ src, rsize_t n)
+{
+ return memcpy_s_inline (dest, dmax, src, n);
+}
+
+errno_t
+memset_s (void *s, rsize_t smax, int c, rsize_t n)
+{
+ return memset_s_inline (s, smax, c, n);
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h
index 2c794baf71f..5c1d8267742 100644
--- a/src/vppinfra/string.h
+++ b/src/vppinfra/string.h
@@ -35,6 +35,12 @@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/** \file
+
+ Optimized string handling code, including c11-compliant
+ "safe C library" variants.
+*/
+
#ifndef included_clib_string_h
#define included_clib_string_h
@@ -72,12 +78,114 @@ void clib_memswap (void *_a, void *_b, uword bytes);
#elif __SSSE3__
#include <vppinfra/memcpy_sse3.h>
#else
-#define clib_memcpy(a,b,c) memcpy(a,b,c)
+#define _clib_memcpy(a,b,c) memcpy(a,b,c)
#endif
#else /* __COVERITY__ */
-#define clib_memcpy(a,b,c) memcpy(a,b,c)
+#define _clib_memcpy(a,b,c) memcpy(a,b,c)
#endif
+/* c-11 string manipulation variants */
+
+#ifndef EOK
+#define EOK 0
+#endif
+#ifndef EINVAL
+#define EINVAL 22
+#endif
+
+typedef int errno_t;
+typedef uword rsize_t;
+
+void clib_c11_violation (const char *s);
+errno_t memcpy_s (void *__restrict__ dest, rsize_t dmax,
+ const void *__restrict__ src, rsize_t n);
+
+always_inline errno_t
+memcpy_s_inline (void *__restrict__ dest, rsize_t dmax,
+ const void *__restrict__ src, rsize_t n)
+{
+ uword low, hi;
+ u8 bad;
+
+ /*
+ * call bogus if: src or dst NULL, trying to copy
+ * more data than we have space in dst, or src == dst.
+ * n == 0 isn't really "bad", so check first in the
+ * "wall-of-shame" department...
+ */
+ bad = (dest == 0) + (src == 0) + (n > dmax) + (dest == src) + (n == 0);
+ if (PREDICT_FALSE (bad != 0))
+ {
+ /* Not actually trying to copy anything is OK */
+ if (n == 0)
+ return EOK;
+ if (dest == NULL)
+ clib_c11_violation ("dest NULL");
+ if (src == NULL)
+ clib_c11_violation ("src NULL");
+ if (n > dmax)
+ clib_c11_violation ("n > dmax");
+ if (dest == src)
+ clib_c11_violation ("dest == src");
+ return EINVAL;
+ }
+
+ /* Check for src/dst overlap, which is not allowed */
+ low = (uword) (src < dest ? src : dest);
+ hi = (uword) (src < dest ? dest : src);
+
+ if (PREDICT_FALSE (low + (n - 1) >= hi))
+ {
+ clib_c11_violation ("src/dest overlap");
+ return EINVAL;
+ }
+
+ _clib_memcpy (dest, src, n);
+ return EOK;
+}
+
+/*
+ * Note: $$$ This macro is a crutch. Folks need to manually
+ * inspect every extant clib_memcpy(...) call and
+ * attempt to provide a real destination buffer size
+ * argument...
+ */
+#define clib_memcpy(d,s,n) memcpy_s_inline(d,n,s,n)
+
+errno_t memset_s (void *s, rsize_t smax, int c, rsize_t n);
+
+always_inline errno_t
+memset_s_inline (void *s, rsize_t smax, int c, rsize_t n)
+{
+ u8 bad;
+
+ bad = (s == 0) + (n > smax);
+
+ if (PREDICT_FALSE (bad != 0))
+ {
+ if (s == 0)
+ clib_c11_violation ("s NULL");
+ if (n > smax)
+ clib_c11_violation ("n > smax");
+ return (EINVAL);
+ }
+ memset (s, c, n);
+ return (EOK);
+}
+
+/*
+ * This macro is not [so much of] a crutch.
+ * It's super-typical to write:
+ *
+ * ep = pool_get (<pool>);
+ * clib_memset(ep, 0, sizeof (*ep));
+ *
+ * The compiler should delete the not-so useful
+ * (n > smax) test. TBH the NULL pointer check isn't
+ * so useful in this case, but so be it.
+ */
+#define clib_memset(s,c,n) memset_s_inline(s,n,c,n)
+
/*
* Copy 64 bytes of data to 4 destinations
* this function is typically used in quad-loop case when whole cacheline
@@ -575,7 +683,6 @@ clib_count_equal_u8 (u8 * data, uword max_count)
return count;
}
-
#endif /* included_clib_string_h */
/*
diff --git a/src/vppinfra/test_cuckoo_bihash.c b/src/vppinfra/test_cuckoo_bihash.c
index eb17eed2ba1..3e63f0bee01 100644
--- a/src/vppinfra/test_cuckoo_bihash.c
+++ b/src/vppinfra/test_cuckoo_bihash.c
@@ -413,7 +413,7 @@ main (int argc, char *argv[])
unformat_input_t i;
clib_error_t *error;
test_main_t *tm = &test_main;
- memset (&test_main, 0, sizeof (test_main));
+ clib_memset (&test_main, 0, sizeof (test_main));
clib_mem_init (0, 3ULL << 30);
diff --git a/src/vppinfra/test_elf.c b/src/vppinfra/test_elf.c
index 84fe0776c33..3bed95484f7 100644
--- a/src/vppinfra/test_elf.c
+++ b/src/vppinfra/test_elf.c
@@ -72,7 +72,7 @@ elf_set_interpreter (elf_main_t * em, char *interp)
return error;
/* Put in new null terminated string. */
- memset (s->contents, 0, vec_len (s->contents));
+ clib_memset (s->contents, 0, vec_len (s->contents));
clib_memcpy (s->contents, interp, strlen (interp));
return 0;
@@ -146,7 +146,7 @@ main (int argc, char *argv[])
unformat_input_t i;
clib_error_t *error = 0;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
unformat_init_command_line (&i, argv);
while (unformat_check_input (&i) != UNFORMAT_END_OF_INPUT)
diff --git a/src/vppinfra/test_heap.c b/src/vppinfra/test_heap.c
index 54a1f09710d..0fd6bf74245 100644
--- a/src/vppinfra/test_heap.c
+++ b/src/vppinfra/test_heap.c
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
vec_resize (objects, 1000);
if (vec_bytes (objects) > 0) /* stupid warning be gone */
- memset (objects, ~0, vec_bytes (objects));
+ clib_memset (objects, ~0, vec_bytes (objects));
vec_resize (handles, vec_len (objects));
objects_used = 0;
diff --git a/src/vppinfra/test_maplog.c b/src/vppinfra/test_maplog.c
index f3ff6623a3e..b51f7f51b25 100644
--- a/src/vppinfra/test_maplog.c
+++ b/src/vppinfra/test_maplog.c
@@ -79,7 +79,7 @@ test_maplog_main (unformat_input_t * input)
clib_warning ("unknown input '%U'", format_unformat_error, input);
}
- memset (a, 0, sizeof (*a));
+ clib_memset (a, 0, sizeof (*a));
a->mm = mm;
a->file_basename = "/tmp/maplog_test";
a->file_size_in_bytes = 4096;
@@ -107,7 +107,7 @@ test_maplog_main (unformat_input_t * input)
}
if (noclose)
- memset (mm, 0, sizeof (*mm));
+ clib_memset (mm, 0, sizeof (*mm));
else
clib_maplog_close (mm);
diff --git a/src/vppinfra/test_mheap.c b/src/vppinfra/test_mheap.c
index f6923a96926..de94065edaf 100644
--- a/src/vppinfra/test_mheap.c
+++ b/src/vppinfra/test_mheap.c
@@ -154,7 +154,7 @@ test_mheap_main (unformat_input_t * input)
vec_resize (objects, n_objects);
if (vec_bytes (objects) > 0) /* stupid warning be gone */
- memset (objects, ~0, vec_bytes (objects));
+ clib_memset (objects, ~0, vec_bytes (objects));
objects_used = 0;
/* Allocate initial heap. */
diff --git a/src/vppinfra/test_qhash.c b/src/vppinfra/test_qhash.c
index 68e8cbc2bde..a520fa4bd77 100644
--- a/src/vppinfra/test_qhash.c
+++ b/src/vppinfra/test_qhash.c
@@ -54,7 +54,7 @@ test_qhash_main (unformat_input_t * input)
test_qhash_main_t _tm, *tm = &_tm;
uword i, iter;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
tm->n_iter = 10;
tm->seed = 1;
tm->n_keys = 10;
diff --git a/src/vppinfra/test_serialize.c b/src/vppinfra/test_serialize.c
index 09f38082313..5c931b76023 100644
--- a/src/vppinfra/test_serialize.c
+++ b/src/vppinfra/test_serialize.c
@@ -145,7 +145,7 @@ test_serialize_main (unformat_input_t * input)
serialize_main_t *um = &tm->unserialize_main;
uword i;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
tm->n_iter = 100;
tm->seed = 1;
tm->max_len = 128;
diff --git a/src/vppinfra/test_time_range.c b/src/vppinfra/test_time_range.c
index 2ec6e13a9d5..a22ef3a2c08 100644
--- a/src/vppinfra/test_time_range.c
+++ b/src/vppinfra/test_time_range.c
@@ -55,7 +55,7 @@ test_time_range_main (unformat_input_t * input)
fformat (stdout, "Test daylight time rules:\n");
- memset (cp, 0, sizeof (*cp));
+ clib_memset (cp, 0, sizeof (*cp));
/* Just before DST starts */
cp->year = 2011;
diff --git a/src/vppinfra/test_timing_wheel.c b/src/vppinfra/test_timing_wheel.c
index 7cf6e0c33f4..48020d520a0 100644
--- a/src/vppinfra/test_timing_wheel.c
+++ b/src/vppinfra/test_timing_wheel.c
@@ -97,7 +97,7 @@ test_timing_wheel_main (unformat_input_t * input)
timing_wheel_t *w = &tm->timing_wheel;
uword iter, i;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
tm->n_iter = 10;
tm->time_per_status_update = 0;
tm->n_events = 100;
diff --git a/src/vppinfra/test_tw_timer.c b/src/vppinfra/test_tw_timer.c
index bde958f3ca2..90fbc9e18b7 100644
--- a/src/vppinfra/test_tw_timer.c
+++ b/src/vppinfra/test_tw_timer.c
@@ -246,7 +246,7 @@ test2_single (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -293,7 +293,7 @@ test2_single (tw_timer_test_main_t * tm)
for (j = 0; j < tm->ntimers / 4; j++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -384,7 +384,7 @@ test2_double (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -430,7 +430,7 @@ test2_double (tw_timer_test_main_t * tm)
for (j = 0; j < tm->ntimers / 4; j++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -528,7 +528,7 @@ test2_double_updates (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
expiration_time = get_expiration_time (tm);
max_expiration_time = clib_max (expiration_time, max_expiration_time);
@@ -635,7 +635,7 @@ test2_triple (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -681,7 +681,7 @@ test2_triple (tw_timer_test_main_t * tm)
for (j = 0; j < tm->ntimers / 4; j++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -775,7 +775,7 @@ test2_triple_ov (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -822,7 +822,7 @@ test2_triple_ov (tw_timer_test_main_t * tm)
for (j = 0; j < tm->ntimers / 4; j++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
do
{
@@ -916,7 +916,7 @@ test1_single (tw_timer_test_main_t * tm)
expected_to_expire = timer_arg + offset;
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
e->expected_to_expire = expected_to_expire;
e->stop_timer_handle = tw_timer_start_2t_1w_2048sl
(&tm->single_wheel, e - tm->test_elts, 1 /* timer id */ ,
@@ -973,7 +973,7 @@ test1_double (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
e->expected_to_expire = i + offset + 1;
e->stop_timer_handle = tw_timer_start_16t_2w_512sl
@@ -1039,7 +1039,7 @@ test3_triple_double (tw_timer_test_main_t * tm)
/* Prime the pump */
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
/* 1 glacier ring tick from now */
expiration_time = TW_SLOTS_PER_RING * TW_SLOTS_PER_RING;
@@ -1117,7 +1117,7 @@ test4_double_double (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
expiration_time = 512;
@@ -1203,7 +1203,7 @@ test5_double (tw_timer_test_main_t * tm)
for (i = 0; i < tm->ntimers; i++)
{
pool_get (tm->test_elts, e);
- memset (e, 0, sizeof (*e));
+ clib_memset (e, 0, sizeof (*e));
expiration_time = i + 1;
@@ -1260,7 +1260,7 @@ timer_test_command_fn (tw_timer_test_main_t * tm, unformat_input_t * input)
int is_test5 = 0;
int overflow = 0;
- memset (tm, 0, sizeof (*tm));
+ clib_memset (tm, 0, sizeof (*tm));
/* Default values */
tm->ntimers = 100000;
tm->seed = 0xDEADDABEB00BFACE;
diff --git a/src/vppinfra/test_vhash.c b/src/vppinfra/test_vhash.c
index f5aa5e21aec..594d46c38df 100644
--- a/src/vppinfra/test_vhash.c
+++ b/src/vppinfra/test_vhash.c
@@ -471,7 +471,7 @@ test_vhash_main (unformat_input_t * input)
vhash_t *vh = &tm->vhash;
uword i, j;
- memset (tm, 0, sizeof (tm[0]));
+ clib_memset (tm, 0, sizeof (tm[0]));
tm->n_iter = 100;
tm->seed = 1;
tm->n_keys = 1;
diff --git a/src/vppinfra/time.c b/src/vppinfra/time.c
index d647e670dad..afb1a867ec7 100644
--- a/src/vppinfra/time.c
+++ b/src/vppinfra/time.c
@@ -177,7 +177,7 @@ os_cpu_clock_frequency (void)
void
clib_time_init (clib_time_t * c)
{
- memset (c, 0, sizeof (c[0]));
+ clib_memset (c, 0, sizeof (c[0]));
c->clocks_per_second = os_cpu_clock_frequency ();
c->seconds_per_clock = 1 / c->clocks_per_second;
c->log2_clocks_per_second = min_log2_u64 ((u64) c->clocks_per_second);
diff --git a/src/vppinfra/time_range.c b/src/vppinfra/time_range.c
index e502ca358db..ea95284ea03 100644
--- a/src/vppinfra/time_range.c
+++ b/src/vppinfra/time_range.c
@@ -19,7 +19,7 @@ void
clib_timebase_init (clib_timebase_t * tb, i32 timezone_offset_in_hours,
clib_timebase_daylight_time_t daylight_type)
{
- memset (tb, 0, sizeof (*tb));
+ clib_memset (tb, 0, sizeof (*tb));
clib_time_init (&tb->clib_time);
tb->time_zero = unix_time_now ();
diff --git a/src/vppinfra/timer.c b/src/vppinfra/timer.c
index 8bbab653ec0..e1e32eb285f 100644
--- a/src/vppinfra/timer.c
+++ b/src/vppinfra/timer.c
@@ -132,7 +132,7 @@ timer_interrupt (int signum)
{
/* Set timer for to go off in future. */
struct itimerval itv;
- memset (&itv, 0, sizeof (itv));
+ clib_memset (&itv, 0, sizeof (itv));
f64_to_tv (dt, &itv.it_value);
if (setitimer (ITIMER_REAL, &itv, 0) < 0)
clib_unix_error ("sititmer");
@@ -146,7 +146,7 @@ timer_block (sigset_t * save)
{
sigset_t block_timer;
- memset (&block_timer, 0, sizeof (block_timer));
+ clib_memset (&block_timer, 0, sizeof (block_timer));
sigaddset (&block_timer, TIMER_SIGNAL);
sigprocmask (SIG_BLOCK, &block_timer, save);
}
@@ -175,7 +175,7 @@ timer_call (timer_func_t * func, any arg, f64 dt)
/* Initialize time_resolution before first call to timer_interrupt */
time_resolution = 0.75 / (f64) HZ;
- memset (&sa, 0, sizeof (sa));
+ clib_memset (&sa, 0, sizeof (sa));
sa.sa_handler = timer_interrupt;
if (sigaction (TIMER_SIGNAL, &sa, 0) < 0)
diff --git a/src/vppinfra/timing_wheel.c b/src/vppinfra/timing_wheel.c
index 09a46d52252..bbf3012ffd8 100644
--- a/src/vppinfra/timing_wheel.c
+++ b/src/vppinfra/timing_wheel.c
@@ -184,7 +184,7 @@ free_elt_vector (timing_wheel_t * w, timing_wheel_elt_t * ev)
{
/* Poison free elements so we never use them by mistake. */
if (CLIB_DEBUG > 0)
- memset (ev, ~0, vec_len (ev) * sizeof (ev[0]));
+ clib_memset (ev, ~0, vec_len (ev) * sizeof (ev[0]));
_vec_len (ev) = 0;
vec_add1 (w->free_elt_vectors, ev);
}
diff --git a/src/vppinfra/tw_timer_template.c b/src/vppinfra/tw_timer_template.c
index 9c9bb977d5e..11a38890f9c 100644
--- a/src/vppinfra/tw_timer_template.c
+++ b/src/vppinfra/tw_timer_template.c
@@ -301,7 +301,7 @@ TW (tw_timer_start) (TWT (tw_timer_wheel) * tw, u32 user_id, u32 timer_id,
ASSERT (interval);
pool_get (tw->timers, t);
- memset (t, 0xff, sizeof (*t));
+ clib_memset (t, 0xff, sizeof (*t));
t->user_handle = TW (make_internal_timer_handle) (user_id, timer_id);
@@ -411,7 +411,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw,
int ring, slot;
tw_timer_wheel_slot_t *ts;
TWT (tw_timer) * t;
- memset (tw, 0, sizeof (*tw));
+ clib_memset (tw, 0, sizeof (*tw));
tw->expired_timer_callback = expired_timer_callback;
tw->max_expirations = max_expirations;
if (timer_interval_in_seconds == 0.0)
@@ -432,7 +432,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw,
{
ts = &tw->w[ring][slot];
pool_get (tw->timers, t);
- memset (t, 0xff, sizeof (*t));
+ clib_memset (t, 0xff, sizeof (*t));
t->next = t->prev = t - tw->timers;
ts->head_index = t - tw->timers;
}
@@ -441,7 +441,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw,
#if TW_OVERFLOW_VECTOR > 0
ts = &tw->overflow;
pool_get (tw->timers, t);
- memset (t, 0xff, sizeof (*t));
+ clib_memset (t, 0xff, sizeof (*t));
t->next = t->prev = t - tw->timers;
ts->head_index = t - tw->timers;
#endif
@@ -490,7 +490,7 @@ void TW (tw_timer_wheel_free) (TWT (tw_timer_wheel) * tw)
pool_put (tw->timers, head);
#endif
- memset (tw, 0, sizeof (*tw));
+ clib_memset (tw, 0, sizeof (*tw));
}
/**
diff --git a/src/vppinfra/unformat.c b/src/vppinfra/unformat.c
index 365cdb15700..da7622a90a8 100644
--- a/src/vppinfra/unformat.c
+++ b/src/vppinfra/unformat.c
@@ -335,7 +335,7 @@ unformat_token (unformat_input_t * input, va_list * va)
if (!token_chars)
token_chars = (u8 *) "a-zA-Z0-9_";
- memset (map, 0, sizeof (map));
+ clib_memset (map, 0, sizeof (map));
for (s = token_chars; *s;)
{
/* Parse range. */
@@ -576,9 +576,9 @@ unformat_float (unformat_input_t * input, va_list * va)
uword signs[2], sign_index = 0;
uword n_input = 0;
- memset (values, 0, sizeof (values));
- memset (n_digits, 0, sizeof (n_digits));
- memset (signs, 0, sizeof (signs));
+ clib_memset (values, 0, sizeof (values));
+ clib_memset (n_digits, 0, sizeof (n_digits));
+ clib_memset (signs, 0, sizeof (signs));
while ((c = unformat_get_input (input)) != UNFORMAT_END_OF_INPUT)
{
diff --git a/src/vppinfra/valloc.c b/src/vppinfra/valloc.c
index cd1d89bb9a1..927802bfeb1 100644
--- a/src/vppinfra/valloc.c
+++ b/src/vppinfra/valloc.c
@@ -68,7 +68,7 @@ clib_valloc_add_chunk (clib_valloc_main_t * vam,
if (index == ~0 || template->baseva < ch->baseva)
{
pool_get (vam->chunks, new_ch);
- memset (new_ch, 0, sizeof (*new_ch));
+ clib_memset (new_ch, 0, sizeof (*new_ch));
if (index != ~0)
{
@@ -102,7 +102,7 @@ clib_valloc_add_chunk (clib_valloc_main_t * vam,
index = ch - vam->chunks;
pool_get (vam->chunks, new_ch);
- memset (new_ch, 0, sizeof (*new_ch));
+ clib_memset (new_ch, 0, sizeof (*new_ch));
ch = pool_elt_at_index (vam->chunks, index);
@@ -130,7 +130,7 @@ clib_valloc_init (clib_valloc_main_t * vam, clib_valloc_chunk_t * template,
int need_lock)
{
ASSERT (template && template->baseva && template->size);
- memset (vam, 0, sizeof (*vam));
+ clib_memset (vam, 0, sizeof (*vam));
if (need_lock)
clib_spinlock_init (&vam->lock);
@@ -180,7 +180,7 @@ clib_valloc_alloc (clib_valloc_main_t * vam, uword size,
pool_get (vam->chunks, new_ch);
/* ch might have just moved */
ch = pool_elt_at_index (vam->chunks, index);
- memset (new_ch, 0, sizeof (*new_ch));
+ clib_memset (new_ch, 0, sizeof (*new_ch));
new_ch->next = new_ch->prev = ~0;
new_ch->baseva = ch->baseva + size;
new_ch->size = ch->size - size;
@@ -271,7 +271,7 @@ clib_valloc_free (clib_valloc_main_t * vam, uword baseva)
next_ch->prev = ch->prev;
}
ASSERT (ch - vam->chunks != vam->first_index);
- memset (ch, 0xfe, sizeof (*ch));
+ clib_memset (ch, 0xfe, sizeof (*ch));
pool_put (vam->chunks, ch);
/* See about combining with next elt */
ch = prev_ch;
@@ -295,7 +295,7 @@ clib_valloc_free (clib_valloc_main_t * vam, uword baseva)
n2_ch->prev = ch - vam->chunks;
}
ASSERT (next_ch - vam->chunks != vam->first_index);
- memset (next_ch, 0xfe, sizeof (*ch));
+ clib_memset (next_ch, 0xfe, sizeof (*ch));
pool_put (vam->chunks, next_ch);
}
}
diff --git a/src/vppinfra/vec.c b/src/vppinfra/vec.c
index a0b3e038af1..1e0164a9e34 100644
--- a/src/vppinfra/vec.c
+++ b/src/vppinfra/vec.c
@@ -59,7 +59,7 @@ vec_resize_allocate_memory (void *v,
new = clib_mem_alloc_aligned_at_offset (data_bytes, data_align, header_bytes, 1 /* yes, call os_out_of_memory */
);
data_bytes = clib_mem_size (new);
- memset (new, 0, data_bytes);
+ clib_memset (new, 0, data_bytes);
v = new + header_bytes;
_vec_len (v) = length_increment;
return v;
@@ -100,7 +100,7 @@ vec_resize_allocate_memory (void *v,
v = new;
/* Zero new memory. */
- memset (v + old_alloc_bytes, 0, new_alloc_bytes - old_alloc_bytes);
+ clib_memset (v + old_alloc_bytes, 0, new_alloc_bytes - old_alloc_bytes);
return v + header_bytes;
}
diff --git a/src/vppinfra/vec.h b/src/vppinfra/vec.h
index 1b0378fe063..dc7b908a3b5 100644
--- a/src/vppinfra/vec.h
+++ b/src/vppinfra/vec.h
@@ -423,7 +423,7 @@ do { \
vec_resize_ha ((V), 1 + (_v(i) - _v(l)), (H), (A)); \
/* Must zero new space since user may have previously \
used e.g. _vec_len (v) -= 10 */ \
- memset ((V) + _v(l), 0, (1 + (_v(i) - _v(l))) * sizeof ((V)[0])); \
+ clib_memset ((V) + _v(l), 0, (1 + (_v(i) - _v(l))) * sizeof ((V)[0])); \
} \
} while (0)
@@ -661,7 +661,7 @@ do { \
memmove ((V) + _v(m) + _v(n), \
(V) + _v(m), \
(_v(l) - _v(m)) * sizeof ((V)[0])); \
- memset ((V) + _v(m), INIT, _v(n) * sizeof ((V)[0])); \
+ clib_memset ((V) + _v(m), INIT, _v(n) * sizeof ((V)[0])); \
} while (0)
/** \brief Insert N vector elements starting at element M,
@@ -794,7 +794,7 @@ do { \
(_v(l) - _v(n) - _v(m)) * sizeof ((V)[0])); \
/* Zero empty space at end (for future re-allocation). */ \
if (_v(n) > 0) \
- memset ((V) + _v(l) - _v(n), 0, _v(n) * sizeof ((V)[0])); \
+ clib_memset ((V) + _v(l) - _v(n), 0, _v(n) * sizeof ((V)[0])); \
_vec_len (V) -= _v(n); \
} while (0)
@@ -883,7 +883,7 @@ do { \
#define vec_zero(var) \
do { \
if (var) \
- memset ((var), 0, vec_len (var) * sizeof ((var)[0])); \
+ clib_memset ((var), 0, vec_len (var) * sizeof ((var)[0])); \
} while (0)
/** \brief Set all vector elements to given value. Null-pointer tolerant.
diff --git a/src/vppinfra/vhash.c b/src/vppinfra/vhash.c
index f9dac0d9ff1..9120f502c91 100644
--- a/src/vppinfra/vhash.c
+++ b/src/vppinfra/vhash.c
@@ -245,7 +245,7 @@ vhash_init (vhash_t * h, u32 log2_n_keys, u32 n_key_u32, u32 * hash_seeds)
uword i, j, m;
vhash_search_bucket_t *b;
- memset (h, 0, sizeof (h[0]));
+ clib_memset (h, 0, sizeof (h[0]));
/* Must have at least 4 keys (e.g. one search bucket). */
log2_n_keys = clib_max (log2_n_keys, 2);