c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 00f093e..d183c3a 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -874,7 +874,7 @@
if ((dev_net_tun_fd = open ("/dev/net/tun", O_RDWR)) < 0)
return VNET_API_ERROR_SYSCALL_ERROR_1;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, (char *) ap->intfc_name, sizeof (ifr.ifr_name) - 1);
ifr.ifr_flags = flags;
if (ioctl (dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
@@ -895,7 +895,7 @@
struct ifreq ifr;
struct sockaddr_ll sll;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, (char *) ap->intfc_name,
sizeof (ifr.ifr_name) - 1);
if (ioctl (dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
@@ -905,7 +905,7 @@
}
/* Bind the provisioning socket to the interface. */
- memset (&sll, 0, sizeof (sll));
+ clib_memset (&sll, 0, sizeof (sll));
sll.sll_family = AF_PACKET;
sll.sll_ifindex = ifr.ifr_ifindex;
sll.sll_protocol = htons (ETH_P_ALL);
@@ -954,7 +954,7 @@
/* ip4: mask defaults to /24 */
u32 mask = clib_host_to_net_u32 (0xFFFFFF00);
- memset (&sin, 0, sizeof (sin));
+ clib_memset (&sin, 0, sizeof (sin));
sin.sin_family = AF_INET;
/* sin.sin_port = 0; */
sin.sin_addr.s_addr = ap->ip4_address->as_u32;
@@ -998,7 +998,7 @@
goto error;
}
- memset (&ifr2, 0, sizeof (ifr));
+ clib_memset (&ifr2, 0, sizeof (ifr));
strncpy (ifr2.ifr_name, (char *) ap->intfc_name,
sizeof (ifr2.ifr_name) - 1);
if (ioctl (sockfd6, SIOCGIFINDEX, &ifr2) < 0)
@@ -1316,7 +1316,7 @@
user_hwaddr = 1;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->orig_sw_if_index = sw_if_index;
ap->intfc_name = intfc_name;
ap->sw_if_indexp = &new_sw_if_index;
@@ -1418,7 +1418,7 @@
goto done;
}
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->intfc_name = intfc_name;
ap->hwaddr_arg = hwaddr_arg;