Revamp last change. IFF_UP only required when allocating callback, not freeing.

This commit is contained in:
Gregory Nutt 2015-05-30 21:13:58 -06:00
parent 28b46c7bfa
commit 6687e156e6
3 changed files with 10 additions and 5 deletions

View File

@ -124,13 +124,19 @@ FAR struct devif_callback_s *
if (dev)
{
/* Verify that the device is valid */
/* Verify that the device pointer is valid, i.e., that it still
* points to a registered network device and also that the network
* device in in the UP state.
*
* And if it does, should that device also not be in the UP state?
*/
if (!netdev_verify(dev))
if (!netdev_verify(dev) && (dev->d_flags & IFF_UP) != 0)
{
/* No.. release the callback structure and fail */
devif_callback_free(NULL, NULL, list);
net_unlock(save);
return NULL;
}

View File

@ -74,9 +74,9 @@ bool netdev_verify(FAR struct net_driver_s *dev)
if (chkdev == dev)
{
/* Yes.. return true if the interface is in the UP state */
/* Yes.. return true */
valid = ((dev->d_flags & IFF_UP) != 0);
valid = true;
break;
}
}

View File

@ -956,7 +956,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
}
#endif /* CONFIG_NET_ARP_SEND */
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR
#ifdef CONFIG_NET_ARP_SEND
else