mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 10:36:04 +08:00
[net][at] Fix socket create failed issue when default netdev mismatch.
Signed-off-by: chenyong <1521761801@qq.com>
This commit is contained in:
@@ -138,6 +138,7 @@ struct netdev *netdev_get_by_ipaddr(ip_addr_t *ip_addr);
|
||||
struct netdev *netdev_get_by_name(const char *name);
|
||||
#ifdef RT_USING_SAL
|
||||
struct netdev *netdev_get_by_family(int family);
|
||||
int netdev_family_get(struct netdev *netdev);
|
||||
#endif /* RT_USING_SAL */
|
||||
|
||||
/* Set default network interface device in list */
|
||||
|
||||
@@ -294,6 +294,20 @@ struct netdev *netdev_get_by_family(int family)
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will get the family type from network interface device
|
||||
*
|
||||
* @param netdev network interface device object
|
||||
*
|
||||
* @return the network interface device family type
|
||||
*/
|
||||
int netdev_family_get(struct netdev *netdev)
|
||||
{
|
||||
RT_ASSERT(netdev);
|
||||
|
||||
return ((struct sal_proto_family *)netdev->sal_user_data)->family;
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SAL */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user