예제 #1
0
파일: tuntap.c 프로젝트: Keruspe/systemd
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);
}
예제 #2
0
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);
}