To be valid, a network device must not only exist, but be in the UP state

This commit is contained in:
Gregory Nutt 2015-05-30 12:54:18 -06:00
parent 7bbaaf41ca
commit 28b46c7bfa

View File

@ -65,12 +65,18 @@ bool netdev_verify(FAR struct net_driver_s *dev)
FAR struct net_driver_s *chkdev;
bool valid = false;
/* Search the list of registered devices */
netdev_semtake();
for (chkdev = g_netdevices; chkdev != NULL; chkdev = chkdev->flink)
{
/* Is the the network device that we are looking for? */
if (chkdev == dev)
{
valid = true;
/* Yes.. return true if the interface is in the UP state */
valid = ((dev->d_flags & IFF_UP) != 0);
break;
}
}