From 2d82b621118773fe3d21177adeba0f6e6d41acb6 Mon Sep 17 00:00:00 2001 From: HubretXie Date: Sun, 28 Apr 2019 15:24:23 +0800 Subject: [PATCH] Update netdev.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据family查找netdev时,优先查找family匹配并且已经联网的网卡 再查找family匹配但是未联网的网卡 --- components/net/netdev/src/netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index e4a88ca022..bfefc2d1de 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -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;