mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
Revamp last change. IFF_UP only required when allocating callback, not freeing.
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user