/* This function will get the first network interface device with the flags in network interface device list. */
struct netdev* netdev_get_first_by_flags(uint16_t flags)
/* This function will get the first network interface device with the flags in network interface device list. */
struct netdev* netdev_get_first_by_flags(uint16_t flags)
{
    slist_t *node = NULL;
    struct netdev *netdev = NULL;
    if (netdev_list == NULL)
    {
        return NULL;
    }
    CPSR_ALLOC();
    RHINO_CPU_INTRPT_DISABLE();
    slist_for_each_entry_safe(&(netdev_list->list), node, netdev, struct netdev, list)
    {
        if (netdev && (netdev->flags & flags) != 0)
        {
            RHINO_CPU_INTRPT_ENABLE();
            return netdev;
        }
    }
    RHINO_CPU_INTRPT_ENABLE();
    return NULL;
}