mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-19 09:43:31 +08:00
commit
c2244a5c57
@ -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;
|
||||
|
@ -394,7 +394,7 @@ static int socket_init(int family, int type, int protocol, struct sal_socket **r
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (netdev_is_up(netdv_def))
|
||||
if (netdev_is_up(netdv_def) && netdev_is_link_up(netdv_def))
|
||||
{
|
||||
/* check default network interface device protocol family */
|
||||
pf = (struct sal_proto_family *) netdv_def->sal_user_data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user