aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/unix
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/unix
parentb9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff)
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/unix')
-rw-r--r--src/vnet/unix/pcap.c2
-rw-r--r--src/vnet/unix/tap_api.c8
-rw-r--r--src/vnet/unix/tapcli.c14
-rw-r--r--src/vnet/unix/tuntap.c18
4 files changed, 21 insertions, 21 deletions
diff --git a/src/vnet/unix/pcap.c b/src/vnet/unix/pcap.c
index e91b8792c2a..3c9ce314d9c 100644
--- a/src/vnet/unix/pcap.c
+++ b/src/vnet/unix/pcap.c
@@ -113,7 +113,7 @@ pcap_write (pcap_main_t * pm)
clib_spinlock_init (&pm->lock);
/* Write file header. */
- memset (&fh, 0, sizeof (fh));
+ clib_memset (&fh, 0, sizeof (fh));
fh.magic = 0xa1b2c3d4;
fh.major_version = 2;
fh.minor_version = 4;
diff --git a/src/vnet/unix/tap_api.c b/src/vnet/unix/tap_api.c
index 026a9632eb8..8437c6a270b 100644
--- a/src/vnet/unix/tap_api.c
+++ b/src/vnet/unix/tap_api.c
@@ -65,7 +65,7 @@ send_sw_interface_event_deleted (vpe_api_main_t * am,
vl_api_sw_interface_event_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_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (sw_if_index);
@@ -87,7 +87,7 @@ vl_api_tap_connect_t_handler (vl_api_tap_connect_t * mp)
u8 *tag;
vnet_tap_connect_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->intfc_name = mp->tap_name;
if (!mp->use_random_mac)
@@ -141,7 +141,7 @@ vl_api_tap_modify_t_handler (vl_api_tap_modify_t * mp)
vlib_main_t *vm = vlib_get_main ();
vnet_tap_connect_args_t _a, *ap = &_a;
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->orig_sw_if_index = ntohl (mp->sw_if_index);
ap->intfc_name = mp->tap_name;
@@ -206,7 +206,7 @@ send_sw_interface_tap_details (vpe_api_main_t * am,
{
vl_api_sw_interface_tap_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_SW_INTERFACE_TAP_DETAILS);
mp->sw_if_index = ntohl (tap_if->sw_if_index);
strncpy ((char *) mp->dev_name,
diff --git a/src/vnet/unix/tapcli.c b/src/vnet/unix/tapcli.c
index 00f093eb067..d183c3a9ea8 100644
--- a/src/vnet/unix/tapcli.c
+++ b/src/vnet/unix/tapcli.c
@@ -874,7 +874,7 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
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 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
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 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
}
/* 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 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
/* 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 @@ vnet_tap_connect (vlib_main_t * vm, vnet_tap_connect_args_t * ap)
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 @@ tap_modify_command_fn (vlib_main_t * vm,
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 @@ tap_connect_command_fn (vlib_main_t * vm,
goto done;
}
- memset (ap, 0, sizeof (*ap));
+ clib_memset (ap, 0, sizeof (*ap));
ap->intfc_name = intfc_name;
ap->hwaddr_arg = hwaddr_arg;
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 4a9bd46c31c..5f2259269f3 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -445,7 +445,7 @@ tuntap_exit (vlib_main_t * vm)
if (sfd < 0)
clib_unix_warning ("provisioning socket");
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
/* get flags, modify to bring down interface... */
@@ -535,7 +535,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
goto done;
}
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
ifr.ifr_flags = flags;
if (ioctl (tm->dev_net_tun_fd, TUNSETIFF, (void *) &ifr) < 0)
@@ -563,7 +563,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
struct ifreq ifr;
struct sockaddr_ll sll;
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, tm->tun_name, sizeof (ifr.ifr_name) - 1);
if (ioctl (tm->dev_tap_fd, SIOCGIFINDEX, &ifr) < 0)
{
@@ -572,7 +572,7 @@ tuntap_config (vlib_main_t * vm, unformat_input_t * input)
}
/* 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);
@@ -719,7 +719,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
return;
/** See if we already know about this subif */
- memset (&subif_addr, 0, sizeof (subif_addr));
+ clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
clib_memcpy (&subif_addr.addr, address, sizeof (*address));
@@ -735,7 +735,7 @@ tuntap_ip4_add_del_interface_address (ip4_main_t * im,
}
/* Use subif pool index to select alias device. */
- memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr, 0, sizeof (ifr));
snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
"%s:%d", tm->tun_name, (int) (ap - tm->subifs));
@@ -835,7 +835,7 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
return;
/* See if we already know about this subif */
- memset (&subif_addr, 0, sizeof (subif_addr));
+ clib_memset (&subif_addr, 0, sizeof (subif_addr));
subif_addr.sw_if_index = sw_if_index;
subif_addr.is_v6 = 1;
clib_memcpy (&subif_addr.addr, address, sizeof (*address));
@@ -852,8 +852,8 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
}
/* Use subif pool index to select alias device. */
- memset (&ifr, 0, sizeof (ifr));
- memset (&ifr6, 0, sizeof (ifr6));
+ clib_memset (&ifr, 0, sizeof (ifr));
+ clib_memset (&ifr6, 0, sizeof (ifr6));
snprintf (ifr.ifr_name, sizeof (ifr.ifr_name),
"%s:%d", tm->tun_name, (int) (ap - tm->subifs));