net: Remove IFF_DOWN flag to compatible with Linux/*BSD

turn off interface by checking IFF_UP flag isn't set:
https://github.com/apache/nuttx/issues/1838

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-10-06 15:15:56 +08:00 committed by Xiang Xiao
parent c5f816e16a
commit 002d89885e
4 changed files with 3 additions and 8 deletions

View File

@ -316,7 +316,7 @@ int s32k3xx_tja1153_initialize(int bus)
/* Bring down the interface */ /* Bring down the interface */
ifr.ifr_flags = IFF_DOWN; ifr.ifr_flags = 0;
ret = ioctl(sock, SIOCSIFFLAGS, (unsigned long)&ifr); ret = ioctl(sock, SIOCSIFFLAGS, (unsigned long)&ifr);
if (ret < 0) if (ret < 0)
{ {

View File

@ -921,8 +921,7 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
if (!priv->bc_bifup) if (!priv->bc_bifup)
{ {
wlerr("ERROR: invalid state " wlerr("ERROR: invalid state (unable to execute command: %x)\n", cmd);
"(IFF_DOWN, unable to execute command: %x)\n", cmd);
return -EPERM; return -EPERM;
} }

View File

@ -46,7 +46,6 @@
/* Interface flag bits */ /* Interface flag bits */
#define IFF_DOWN (1 << 0) /* Interface is down */
#define IFF_UP (1 << 1) /* Interface is up */ #define IFF_UP (1 << 1) /* Interface is up */
#define IFF_RUNNING (1 << 2) /* Carrier is available */ #define IFF_RUNNING (1 << 2) /* Carrier is available */
#define IFF_IPv6 (1 << 3) /* Configured for IPv6 packet (vs ARP or IPv4) */ #define IFF_IPv6 (1 << 3) /* Configured for IPv6 packet (vs ARP or IPv4) */

View File

@ -990,10 +990,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
arp_acd_setup(dev); arp_acd_setup(dev);
#endif /* CONFIG_NET_ARP_ACD */ #endif /* CONFIG_NET_ARP_ACD */
} }
else
/* Is this a request to take the interface down? */
else if ((req->ifr_flags & IFF_DOWN) != 0)
{ {
/* Yes.. take the interface down */ /* Yes.. take the interface down */