Skip to content
Snippets Groups Projects
Commit 28b46c7b authored by Gregory Nutt's avatar Gregory Nutt
Browse files

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

parent 7bbaaf41
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment