diff --git a/net/Kconfig b/net/Kconfig index da5eab15d2c..49e927193d7 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -136,6 +136,7 @@ config NET_6LOWPAN default n select NETDEV_MULTINIC if NET_ETHERNET || NET_LOOPBACK || NET_SLIP || NET_TUN select NET_MULTILINK if NET_ETHERNET || NET_LOOPBACK || NET_SLIP || NET_TUN + select NETDEV_IOCTL depends on EXPERIMENTAL && NET_IPv6 ---help--- Enable support for IEEE 802.15.4 Low power Wireless Personal Area diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 3b5ca1f4e1b..bc4d6703798 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -70,11 +70,12 @@ #ifdef CONFIG_NETDEV_WIRELESS_IOCTL # include -#ifdef CONFIG_NET_6LOWPAN +#endif + +#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN) # include # include #endif -#endif #include "arp/arp.h" #include "socket/socket.h" @@ -379,7 +380,7 @@ static int netdev_iee802154_ioctl(FAR struct socket *psock, int cmd, FAR char *ifname; int ret = -ENOTTY; - if (req != NULL) + if (arg != 0ul) { /* Verify that this is either a valid IEEE802.15.4 radio IOCTL command * or a valid IEEE802.15.4 MAC IOCTL command. @@ -414,9 +415,15 @@ static int netdev_iee802154_ioctl(FAR struct socket *psock, int cmd, return -ENOTTY; } - /* Perform the device IOCTL */ + /* Find the device with this name */ - ret = dev->d_ioctl(dev, cmd, arg); + dev = netdev_findbyname(ifname); + if (dev != NULL) + { + /* Perform the device IOCTL */ + + ret = dev->d_ioctl(dev, cmd, arg); + } } return ret; @@ -1301,7 +1308,7 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) ret = netdev_ifrioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg)); #if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL) - /* Check a wireless network command */ + /* Check for a wireless network command */ if (ret == -ENOTTY) { @@ -1309,6 +1316,15 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) } #endif +#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN) + /* Check for a IEEE802.15.4 network device command */ + + if (ret == -ENOTTY) + { + ret = netdev_iee802154_ioctl(psock, cmd, arg); + } +#endif + #ifdef CONFIG_NET_IGMP /* Check for address filtering commands */