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 3a9c193bf7 ioctl: add SIOCGIWNAME support
3a9c193bf7 is described below

commit 3a9c193bf7e7911cee06c1bdcbc6f657e63215aa
Author: zhanghongyu <zhanghon...@xiaomi.com>
AuthorDate: Wed Nov 1 23:09:37 2023 +0800

    ioctl: add SIOCGIWNAME support
    
    some tools use this command to distinguish which device returned via 
getifaddrs() are wireless network device.
    
    Signed-off-by: zhanghongyu <zhanghon...@xiaomi.com>
---
 net/netdev/netdev_ioctl.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c
index 24bbfd18c9..a7401460fa 100644
--- a/net/netdev/netdev_ioctl.c
+++ b/net/netdev/netdev_ioctl.c
@@ -625,7 +625,20 @@ static int netdev_wifr_ioctl(FAR struct socket *psock, int 
cmd,
       /* Get the wireless device associated with the IOCTL command */
 
       dev = netdev_findbyname(req->ifr_name);
-      if (dev != NULL)
+      if (cmd == SIOCGIWNAME)
+        {
+          if (dev == NULL)
+            {
+              ret = -ENODEV;
+            }
+          else
+            {
+              strcpy((FAR char *)&req->u, "IEEE 802.11");
+              ret = OK;
+            }
+        }
+
+      if (dev != NULL && ret == -ENOTTY)
         {
           /* Just forward the IOCTL to the wireless driver */
 

Reply via email to