Skip to content

Commit

Permalink
net: Remove IFF_DOWN flag to compatible with Linux/*BSD
Browse files Browse the repository at this point in the history
turn off interface by checking IFF_UP flag isn't set:
apache#1838

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Oct 7, 2024
1 parent 79be76a commit 8770e7e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_tja1153.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int s32k3xx_tja1153_initialize(int bus)

/* Bring down the interface */

ifr.ifr_flags = IFF_DOWN;
ifr.ifr_flags = 0;
ret = ioctl(sock, SIOCSIFFLAGS, (unsigned long)&ifr);
if (ret < 0)
{
Expand Down
3 changes: 1 addition & 2 deletions drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,7 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,

if (!priv->bc_bifup)
{
wlerr("ERROR: invalid state "
"(IFF_DOWN, unable to execute command: %x)\n", cmd);
wlerr("ERROR: invalid state (unable to execute command: %x)\n", cmd);
return -EPERM;
}

Expand Down
1 change: 0 additions & 1 deletion include/net/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

/* Interface flag bits */

#define IFF_DOWN (1 << 0) /* Interface is down */
#define IFF_UP (1 << 1) /* Interface is up */
#define IFF_RUNNING (1 << 2) /* Carrier is available */
#define IFF_IPv6 (1 << 3) /* Configured for IPv6 packet (vs ARP or IPv4) */
Expand Down
5 changes: 1 addition & 4 deletions net/netdev/netdev_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
arp_acd_setup(dev);
#endif /* CONFIG_NET_ARP_ACD */
}

/* Is this a request to take the interface down? */

else if ((req->ifr_flags & IFF_DOWN) != 0)
else
{
/* Yes.. take the interface down */

Expand Down

0 comments on commit 8770e7e

Please sign in to comment.