#!/bin/bash

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

vxlan_check() {
    if ! kernel_config_check CONFIG_VXLAN vxlan; then
        return 1
    fi

    ifname="dodo"

    netif_delete $ifname

    if ! ${IP_CMD} link add $ifname type vxlan id 66 group 239.1.1.1 dev lo dstport 4789; 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
}

