This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 96fcc8bb1d1 net:modify check condition from IFF_UP to IFF_RUNNING in
the sending process
96fcc8bb1d1 is described below
commit 96fcc8bb1d1d7818b21274aa40f86f3704b1520d
Author: wangchen <[email protected]>
AuthorDate: Fri Sep 6 16:28:12 2024 +0800
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 <[email protected]>
---
net/arp/arp_acd.c | 2 +-
net/igmp/igmp_leave.c | 2 +-
net/ipforward/ipv4_forward.c | 5 +++--
net/ipforward/ipv6_forward.c | 11 ++++++-----
net/netdev/netdown_notifier.c | 6 +++---
net/procfs/netdev_statistics.c | 2 +-
net/udp/udp_sendto_buffered.c | 4 ++--
net/udp/udp_sendto_unbuffered.c | 4 ++--
8 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/net/arp/arp_acd.c b/net/arp/arp_acd.c
index 38f3acf2437..78f800d130c 100644
--- a/net/arp/arp_acd.c
+++ b/net/arp/arp_acd.c
@@ -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);
}
diff --git a/net/igmp/igmp_leave.c b/net/igmp/igmp_leave.c
index 75559ecf6f5..7a616ec0e9e 100644
--- a/net/igmp/igmp_leave.c
+++ b/net/igmp/igmp_leave.c
@@ -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);
diff --git a/net/ipforward/ipv4_forward.c b/net/ipforward/ipv4_forward.c
index b3333d7bf27..96dc64f88df 100644
--- a/net/ipforward/ipv4_forward.c
+++ b/net/ipforward/ipv4_forward.c
@@ -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;
}
diff --git a/net/ipforward/ipv6_forward.c b/net/ipforward/ipv6_forward.c
index bee70820e53..c56d5d8a5ef 100644
--- a/net/ipforward/ipv6_forward.c
+++ b/net/ipforward/ipv6_forward.c
@@ -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;
}
diff --git a/net/netdev/netdown_notifier.c b/net/netdev/netdown_notifier.c
index f007c94433a..0472cc80f20 100644
--- a/net/netdev/netdown_notifier.c
+++ b/net/netdev/netdown_notifier.c
@@ -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;
}
diff --git a/net/procfs/netdev_statistics.c b/net/procfs/netdev_statistics.c
index 8c7211df350..48166b3cd55 100644
--- a/net/procfs/netdev_statistics.c
+++ b/net/procfs/netdev_statistics.c
@@ -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";
}
diff --git a/net/udp/udp_sendto_buffered.c b/net/udp/udp_sendto_buffered.c
index d78dd2bf041..3ca2f142e39 100644
--- a/net/udp/udp_sendto_buffered.c
+++ b/net/udp/udp_sendto_buffered.c
@@ -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;
}
diff --git a/net/udp/udp_sendto_unbuffered.c b/net/udp/udp_sendto_unbuffered.c
index c6540a26f38..a8c469fb198 100644
--- a/net/udp/udp_sendto_unbuffered.c
+++ b/net/udp/udp_sendto_unbuffered.c
@@ -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;
}