diff options
author | Dave Barach <dave@barachs.net> | 2018-10-17 10:38:51 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-23 13:06:46 +0000 |
commit | b7b929931a07fbb27b43d5cd105f366c3e29807e (patch) | |
tree | 438681c89738802dbb5d339715b96ea2c31bafb4 /src/vnet/unix/tapcli.c | |
parent | b9a4c445c1d4e9cdab476a8e1fb8a46ff0fc6080 (diff) |
c11 safe string handling support
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/unix/tapcli.c')
-rw-r--r-- | src/vnet/unix/tapcli.c | 14 |
1 files changed, 7 insertions, 7 deletions
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; |