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