aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
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/vat/api_format.c
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c94
1 files changed, 47 insertions, 47 deletions
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)
{