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
+8 -2
View File
@@ -124,13 +124,19 @@ FAR struct devif_callback_s *
if (dev) 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 */ /* No.. release the callback structure and fail */
devif_callback_free(NULL, NULL, list); devif_callback_free(NULL, NULL, list);
net_unlock(save);
return NULL; return NULL;
} }
+2 -2
View File
@@ -74,9 +74,9 @@ bool netdev_verify(FAR struct net_driver_s *dev)
if (chkdev == 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; break;
} }
} }
-1
View File
@@ -956,7 +956,6 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
} }
#endif /* CONFIG_NET_ARP_SEND */ #endif /* CONFIG_NET_ARP_SEND */
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR #ifdef CONFIG_NET_ICMPv6_NEIGHBOR
#ifdef CONFIG_NET_ARP_SEND #ifdef CONFIG_NET_ARP_SEND
else else