mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
net:modify check condition from IFF_UP to IFF_RUNNING in the sending process
Modify check condition from IFF_UP to IFF_RUNNING in the sending process Signed-off-by: wangchen <wangchen41@xiaomi.com>
This commit is contained in:
+1
-1
@@ -270,7 +270,7 @@ void arp_acd_set_addr(FAR struct net_driver_s *dev)
|
||||
if (!net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
|
||||
{
|
||||
dev->d_acd.need_announce = true;
|
||||
if (IFF_IS_UP(dev->d_flags))
|
||||
if (IFF_IS_RUNNING(dev->d_flags))
|
||||
{
|
||||
arp_acd_setup(dev);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ int igmp_leavegroup(struct net_driver_s *dev,
|
||||
|
||||
/* Send a leave if the flag is set according to the state diagram */
|
||||
|
||||
if (IFF_IS_UP(dev->d_flags) && IS_LASTREPORT(group->flags))
|
||||
if (IFF_IS_RUNNING(dev->d_flags) && IS_LASTREPORT(group->flags))
|
||||
{
|
||||
ninfo("Schedule Leave Group message\n");
|
||||
IGMP_STATINCR(g_netstats.igmp.leave_sched);
|
||||
|
||||
@@ -371,9 +371,10 @@ static int ipv4_forward_callback(FAR struct net_driver_s *fwddev,
|
||||
|
||||
DEBUGASSERT(fwddev != NULL);
|
||||
|
||||
/* Only IFF_UP device and non-loopback device need forward packet */
|
||||
/* Only IFF_RUNNING device and non-loopback device need forward packet */
|
||||
|
||||
if (!IFF_IS_UP(fwddev->d_flags) || fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
if (!IFF_IS_RUNNING(fwddev->d_flags) ||
|
||||
fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -361,11 +361,11 @@ static int ipv6_dev_forward(FAR struct net_driver_s *dev,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the interface isn't "up", we can't forward. */
|
||||
/* If the interface isn't "running", we can't forward. */
|
||||
|
||||
if ((fwddev->d_flags & IFF_UP) == 0)
|
||||
if (IFF_IS_RUNNING(fwddev->d_flags) == 0)
|
||||
{
|
||||
nwarn("WARNING: device is DOWN\n");
|
||||
nwarn("WARNING: device is not running\n");
|
||||
ret = -EHOSTUNREACH;
|
||||
goto errout;
|
||||
}
|
||||
@@ -510,9 +510,10 @@ static int ipv6_forward_callback(FAR struct net_driver_s *fwddev,
|
||||
|
||||
DEBUGASSERT(fwddev != NULL);
|
||||
|
||||
/* Only IFF_UP device and non-loopback device need forward packet */
|
||||
/* Only IFF_RUNNING device and non-loopback device need forward packet */
|
||||
|
||||
if (!IFF_IS_UP(fwddev->d_flags) || fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
if (!IFF_IS_RUNNING(fwddev->d_flags) ||
|
||||
fwddev->d_lltype == NET_LL_LOOPBACK)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ int netdown_notifier_setup(worker_t worker, FAR struct net_driver_s *dev,
|
||||
|
||||
DEBUGASSERT(worker != NULL);
|
||||
|
||||
/* If network driver is already down, then return zero without setting up
|
||||
* the notification.
|
||||
/* If network driver is already not yet running,
|
||||
* then return zero without setting up the notification.
|
||||
*/
|
||||
|
||||
if ((dev->d_flags & IFF_UP) == 0)
|
||||
if (IFF_IS_RUNNING(dev->d_flags) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
||||
|
||||
/* Get the interface status: RUNNING, UP, or DOWN */
|
||||
|
||||
if ((dev->d_flags & IFF_RUNNING) != 0)
|
||||
if (IFF_IS_RUNNING(dev->d_flags) != 0)
|
||||
{
|
||||
status = "RUNNING";
|
||||
}
|
||||
|
||||
@@ -295,9 +295,9 @@ static int sendto_next_transfer(FAR struct udp_conn_s *conn)
|
||||
|
||||
/* Make sure that the device is in the UP state */
|
||||
|
||||
if ((dev->d_flags & IFF_UP) == 0)
|
||||
if (IFF_IS_RUNNING(dev->d_flags) == 0)
|
||||
{
|
||||
nwarn("WARNING: device is DOWN\n");
|
||||
nwarn("WARNING: device is not RUNNING\n");
|
||||
return -EHOSTUNREACH;
|
||||
}
|
||||
|
||||
|
||||
@@ -457,9 +457,9 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
||||
|
||||
/* Make sure that the device is in the UP state */
|
||||
|
||||
if ((state.st_dev->d_flags & IFF_UP) == 0)
|
||||
if (IFF_IS_RUNNING(state.st_dev->d_flags) == 0)
|
||||
{
|
||||
nwarn("WARNING: device is DOWN\n");
|
||||
nwarn("WARNING: device is not running\n");
|
||||
return -EHOSTUNREACH;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user