#!/bin/bash

source ./cmd_utils.sh
source ./kernel_config_utils.sh
source ./net_utils.sh

tuntap_check() {
    if ! kernel_config_check CONFIG_TUN tun; then
        return 1
    fi

    local ifname="dodo"

    netif_delete $ifname

    if ! ${IP_CMD} tuntap add mode tap name $ifname; then
        echo "create tun failed"
        return 1
    fi
    if ! netif_check $ifname; then
        echo "netif not exist: ifname $ifname"
        return 1
    fi

    netif_delete $ifname
    return 0
}

