提交 2721e718 编写于 作者: Lawlieta's avatar Lawlieta

[net][netdev] Fix netdev link_down status, socket create failed issue

Signed-off-by: Lawlieta's avatarchenyong <1521761801@qq.com>
上级 c0a400cc
......@@ -269,8 +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) && netdev_is_link_up(netdev))
if (pf && pf->skt_ops && pf->family == family && netdev_is_up(netdev))
{
rt_hw_interrupt_enable(level);
return netdev;
......@@ -281,8 +280,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->sec_family == family &&
netdev_is_up(netdev) && netdev_is_link_up(netdev))
if (pf && pf->skt_ops && pf->sec_family == family && netdev_is_up(netdev))
{
rt_hw_interrupt_enable(level);
return netdev;
......
......@@ -388,9 +388,7 @@ static int socket_init(int family, int type, int protocol, struct sal_socket **r
sock->protocol = protocol;
/* get socket operations from network interface device */
if (netdv_def)
{
if (netdev_is_up(netdv_def) && netdev_is_link_up(netdv_def))
if (netdv_def && netdev_is_up(netdv_def))
{
/* check default network interface device protocol family */
pf = (struct sal_proto_family *) netdv_def->sal_user_data;
......@@ -400,7 +398,6 @@ static int socket_init(int family, int type, int protocol, struct sal_socket **r
falgs = RT_TRUE;
}
}
}
else
{
LOG_E("not find default network interface device for socket create.");
......@@ -516,8 +513,6 @@ int sal_accept(int socket, struct sockaddr *addr, socklen_t *addrlen)
/* get the socket object by socket descriptor */
SAL_SOCKET_OBJ_GET(sock, socket);
/* check the network interface is commonicable */
SAL_NETDEV_IS_COMMONICABLE(sock->netdev);
/* check the network interface socket operations */
SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, accept);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册