Update netdev.c

根据family查找netdev时,优先查找family匹配并且已经联网的网卡
再查找family匹配但是未联网的网卡
This commit is contained in:
HubretXie 2019-04-28 15:24:23 +08:00 committed by GitHub
parent f7e5f4cd50
commit 2d82b62111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -269,7 +269,7 @@ struct netdev *netdev_get_by_family(int family)
{
netdev = rt_slist_entry(node, struct netdev, list);
pf = (struct sal_proto_family *) netdev->sal_user_data;
if (pf && pf->skt_ops && pf->family == family && netdev_is_up(netdev))
if (pf && pf->skt_ops && pf->family == family && netdev_is_up(netdev) && netdev_is_link_up(netdev))
{
rt_hw_interrupt_enable(level);
return netdev;