From c2774ba1ec77d493c72d8fa29e21ce29f92c1b01 Mon Sep 17 00:00:00 2001 From: wangchen Date: Mon, 16 Dec 2024 10:32:49 +0800 Subject: [PATCH] netdev:When running, proto stack can exchange packets with device netdev:when network device is running status,the network protocol stack is allowed to send packet to the network device and to receive from the network device Signed-off-by: wangchen --- net/netdev/netdev_default.c | 4 ++-- net/netdev/netdev_findbyaddr.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/netdev/netdev_default.c b/net/netdev/netdev_default.c index 99c520f11ee..3ffdb533393 100644 --- a/net/netdev/netdev_default.c +++ b/net/netdev/netdev_default.c @@ -66,9 +66,9 @@ FAR struct net_driver_s *netdev_default(void) netdev_list_lock(); for (dev = g_netdevices; dev; dev = dev->flink) { - /* Is the interface in the "up" state? */ + /* Is the interface in the "running" state? */ - if ((dev->d_flags & IFF_UP) != 0) + if (IFF_IS_RUNNING(dev->d_flags) != 0) { /* Return a reference to the first device that we find in the UP * state (but not the loopback device unless it is the only diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c index 1c5a3075361..6c76a23d8e6 100644 --- a/net/netdev/netdev_findbyaddr.c +++ b/net/netdev/netdev_findbyaddr.c @@ -83,9 +83,9 @@ netdev_prefixlen_findby_lipv4addr(in_addr_t lipaddr, FAR int8_t *prefixlen) netdev_list_lock(); for (dev = g_netdevices; dev; dev = dev->flink) { - /* Is the interface in the "up" state? */ + /* Is the interface in the "running" state? */ - if ((dev->d_flags & IFF_UP) != 0 && + if (IFF_IS_RUNNING(dev->d_flags) != 0 && !net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY)) { #ifndef CONFIG_ROUTE_LONGEST_MATCH @@ -194,9 +194,9 @@ netdev_prefixlen_findby_lipv6addr(const net_ipv6addr_t lipaddr, for (dev = g_netdevices; dev; dev = dev->flink) { - /* Is the interface in the "up" state? */ + /* Is the interface in the "running" state? */ - if ((dev->d_flags & IFF_UP) != 0 && NETDEV_HAS_V6ADDR(dev)) + if (IFF_IS_RUNNING(dev->d_flags) != 0 && NETDEV_HAS_V6ADDR(dev)) { #ifndef CONFIG_ROUTE_LONGEST_MATCH /* Yes.. check for an address match (under the netmask) */