aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp
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/vnet/lisp-cp
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/lisp-cp')
-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
9 files changed, 171 insertions, 170 deletions
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;
}