summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
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/ip
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/ip')
-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
25 files changed, 90 insertions, 88 deletions
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')
{