static int netdev_create_tuntap(NetDev *netdev) { struct ifreq ifr = {}; int r; r = netdev_fill_tuntap_message(netdev, &ifr); if (r < 0) return r; return netdev_tuntap_add(netdev, &ifr); }
int netdev_create_tuntap(NetDev *netdev) { struct ifreq ifr; int r; assert(netdev); assert(netdev->ifname); switch(netdev->kind) { case NETDEV_KIND_TUN: case NETDEV_KIND_TAP: break; default: return -ENOTSUP; } r = netdev_fill_tuntap_message(netdev, &ifr); if(r < 0) return r; log_debug_netdev(netdev, "Creating tuntap netdev: %s", netdev_kind_to_string(netdev->kind)); return netdev_tuntap_add(netdev, &ifr); }