#include /* * man 7 netdevice * man 4 tap */ void tap_new(void) { int fd; struct ifreq req; fd = open("/dev/net/tun", O_RDWR); if (fd < 0) { return; } memset(&req, 0, sizeof(struct ifreq)); req.ifr_flags = IFF_TAP | IFF_NO_PI; /* * malloc(IFNAMSIZ); * tun_alloc(xxxx, IFF_TAP); */ strncpy(req.ifr_name, "todo", 5); if (ioctl(fd, TUNSETIFF, &req) < 0) { return; } }