mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
net/dev: check the available address further
check the available address further to avoid obtain unusable device Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -73,7 +73,8 @@ FAR struct net_driver_s *netdev_findby_lipv4addr(in_addr_t lipaddr)
|
|||||||
{
|
{
|
||||||
/* Is the interface in the "up" state? */
|
/* Is the interface in the "up" state? */
|
||||||
|
|
||||||
if ((dev->d_flags & IFF_UP) != 0)
|
if ((dev->d_flags & IFF_UP) != 0 &&
|
||||||
|
!net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
|
||||||
{
|
{
|
||||||
/* Yes.. check for an address match (under the netmask) */
|
/* Yes.. check for an address match (under the netmask) */
|
||||||
|
|
||||||
@@ -125,7 +126,8 @@ FAR struct net_driver_s *netdev_findby_lipv6addr(
|
|||||||
{
|
{
|
||||||
/* Is the interface in the "up" state? */
|
/* Is the interface in the "up" state? */
|
||||||
|
|
||||||
if ((dev->d_flags & IFF_UP) != 0)
|
if ((dev->d_flags & IFF_UP) != 0 &&
|
||||||
|
!net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_unspecaddr))
|
||||||
{
|
{
|
||||||
/* Yes.. check for an address match (under the netmask) */
|
/* Yes.. check for an address match (under the netmask) */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user