*/
#include <netinet/in.h>
-#ifdef RTE_EXEC_ENV_LINUXAPP
+#ifdef RTE_EXEC_ENV_LINUX
#include <linux/if.h>
#include <linux/if_tun.h>
#endif
#include <string.h>
#include <unistd.h>
+#include <rte_string_fns.h>
+
#include "tap.h"
#define TAP_DEV "/dev/net/tun"
return NULL;
}
-#ifndef RTE_EXEC_ENV_LINUXAPP
+#ifndef RTE_EXEC_ENV_LINUX
struct tap *
tap_create(const char *name __rte_unused)
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI; /* No packet information */
- snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
+ strlcpy(ifr.ifr_name, name, IFNAMSIZ);
status = ioctl(fd, TUNSETIFF, (void *) &ifr);
if (status < 0) {
return NULL;
}
/* Node fill in */
- strncpy(tap->name, name, sizeof(tap->name));
+ strlcpy(tap->name, name, sizeof(tap->name));
tap->fd = fd;
/* Node add to list */