Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lte/alt1250/alt1250_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void alt1250_netdev_unregister(FAR struct alt1250_s *dev)

void alt1250_netdev_ifdown(FAR struct alt1250_s *dev)
{
dev->net_dev.d_flags = IFF_DOWN;
dev->net_dev.d_flags = ~IFF_UP;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaoxiang781216
Sorry for the delay, let me confirm.
Is this as you intended? Or is it a mistake?
dev->net_dev.d_flags &= ~IFF_UP;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's intended to follow how other POSIX OS turn off netdev. After IFF_DOWN is removed, ~IFF_UP represent down.

#ifdef CONFIG_NET_IPv4
memset(&dev->net_dev.d_ipaddr, 0, sizeof(dev->net_dev.d_ipaddr));
memset(&dev->net_dev.d_draddr, 0, sizeof(dev->net_dev.d_draddr));
Expand Down
7 changes: 1 addition & 6 deletions lte/alt1250/usock_handlers/alt1250_ioctl_ifreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,9 @@ int usockreq_ioctl_ifreq(FAR struct alt1250_s *dev,
{
ret = do_ifup(dev, req, usock_result, usock_xid, ackinfo);
}
else if (if_req->ifr_flags & IFF_DOWN)
{
ret = do_ifdown(dev, req, usock_result, usock_xid, ackinfo);
}
else
{
dbg_alt1250("unexpected ifr_flags:0x%02x\n", if_req->ifr_flags);
*usock_result = -EINVAL;
ret = do_ifdown(dev, req, usock_result, usock_xid, ackinfo);
}

return ret;
Expand Down
2 changes: 1 addition & 1 deletion netutils/netinit/netinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ static int netinit_monitor(void)

ninfo("Taking the link down\n");

ifr.ifr_flags = IFF_DOWN;
ifr.ifr_flags = 0;
ret = ioctl(sd, SIOCSIFFLAGS, (unsigned long)&ifr);
if (ret < 0)
{
Expand Down
2 changes: 0 additions & 2 deletions netutils/netlib/netlib_setifstatus.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ int netlib_ifdown(const char *ifname)

/* Perform the ioctl to ifup flag */

req.ifr_flags |= IFF_DOWN;

ret = ioctl(sockfd, SIOCSIFFLAGS, (unsigned long)&req);
close(sockfd);
}
Expand Down