Exemplo n.º 1
0
void ui_menu_network_devices::handle()
{
	/* process the menu */
	const ui_menu_event *menu_event = process(0);

	if (menu_event != nullptr && menu_event->itemref != nullptr)
	{
		if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) {
			device_network_interface *network = (device_network_interface *)menu_event->itemref;
			int curr = network->get_interface();
			if (menu_event->iptkey == IPT_UI_LEFT) curr--; else curr++;
			if (curr==-2) curr = netdev_count() - 1;
			network->set_interface(curr);
			reset(UI_MENU_RESET_REMEMBER_REF);
		}
	}
}
Exemplo n.º 2
0
static int netdev_ifrioctl(FAR struct socket *psock, int cmd, struct ifreq *req)
{
  FAR struct uip_driver_s *dev;
  int ret = OK;

  nvdbg("cmd: %d\n", cmd);

  /* Find the network device associated with the device name
   * in the request data.
   */

  dev = netdev_findbyname(req->ifr_name);
  if (!dev)
    {
      ret = -EINVAL;
      goto errout;
    }

  /* Execute the command */

  switch (cmd)
    {
      case SIOCGIFADDR:  /* Get IP address */
        {
          ioctl_getipaddr(&req->ifr_addr, &dev->d_ipaddr);
        }
        break;

      case SIOCSIFADDR:  /* Set IP address */
        {
          ioctl_ifdown(dev);
          ioctl_setipaddr(&dev->d_ipaddr, &req->ifr_addr);
          ioctl_ifup(dev);
        }
        break;

      case SIOCGIFDSTADDR:  /* Get P-to-P address */
        {
          ioctl_getipaddr(&req->ifr_dstaddr, &dev->d_draddr);
        }
        break;

      case SIOCSIFDSTADDR:  /* Set P-to-P address */
        {
          ioctl_setipaddr(&dev->d_draddr, &req->ifr_dstaddr);
        }
        break;

      case SIOCGIFNETMASK:  /* Get network mask */
        {
          ioctl_getipaddr(&req->ifr_addr, &dev->d_netmask);
        }
        break;

      case SIOCSIFNETMASK:  /* Set network mask */
        {
          ioctl_setipaddr(&dev->d_netmask, &req->ifr_addr);
        }
        break;

      case SIOCGIFMTU:  /* Get MTU size */
        {
          req->ifr_mtu = CONFIG_NET_BUFSIZE;
        }
        break;

      case SIOCSIFFLAGS:  /* Sets the interface flags */
        {
          /* Is this a request to bring the interface up? */

          if (req->ifr_flags & IF_FLAG_IFUP)
            {
              /* Yes.. bring the interface up */

              ioctl_ifup(dev);
            }

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

          else if (req->ifr_flags & IF_FLAG_IFDOWN)
            {
              /* Yes.. take the interface down */

              ioctl_ifdown(dev);
            }
        }
        break;

      case SIOCGIFFLAGS:  /* Gets the interface flags */
        {
          req->ifr_flags = 0;

          /* Is the interface running? */

          if (dev->d_flags & IFF_RUNNING)
            {
              /* Yes.. report interface up */

              req->ifr_flags |= IF_FLAG_IFUP;
            }
          else
            {
              /* No.. report interface down */

              req->ifr_flags |= IF_FLAG_IFDOWN;
            }
        }
        break;

      /* MAC address operations only make sense if Ethernet is supported */

#ifdef CONFIG_NET_ETHERNET
      case SIOCGIFHWADDR:  /* Get hardware address */
        {
          req->ifr_hwaddr.sa_family = AF_INETX;
          memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.ether_addr_octet, IFHWADDRLEN);
        }
        break;

      case SIOCSIFHWADDR:  /* Set hardware address -- will not take effect until ifup */
        {
          req->ifr_hwaddr.sa_family = AF_INETX;
          memcpy(dev->d_mac.ether_addr_octet, req->ifr_hwaddr.sa_data, IFHWADDRLEN);
        }
        break;
#endif

      case SIOCDIFADDR:  /* Delete IP address */
        {
          ioctl_ifdown(dev);
          memset(&dev->d_ipaddr, 0, sizeof(uip_ipaddr_t));
        }
        break;

      case SIOCGIFCOUNT:  /* Get number of devices */
        {
          req->ifr_count = netdev_count();
          ret = -ENOSYS;
        }
        break;

      case SIOCGIFBRDADDR:  /* Get broadcast IP address */
      case SIOCSIFBRDADDR:  /* Set broadcast IP address */
        {
          ret = -ENOSYS;
        }
        break;

#ifdef CONFIG_NET_ARPIOCTLS
      case SIOCSARP:  /* Set a ARP mapping */
      case SIOCDARP:  /* Delete an ARP mapping */
      case SIOCGARP:  /* Get an ARP mapping */
# error "IOCTL Commands not implemented"
#endif

      default:
        {
          ret = -EINVAL;
        }
        break;;
    }

errout:
  return ret;
}
Exemplo n.º 3
0
static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
                           FAR struct ifreq *req)
{
  FAR struct net_driver_s *dev;
  int ret = -EINVAL;

  nvdbg("cmd: %d\n", cmd);

  /* Execute the command */

  switch (cmd)
    {
#ifdef CONFIG_NET_IPv4
      case SIOCGIFADDR:  /* Get IP address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ioctl_getipv4addr(&req->ifr_addr, dev->d_ipaddr);
              ret = OK;
            }
        }
        break;
#endif


#ifdef CONFIG_NET_IPv4
      case SIOCSIFADDR:  /* Set IP address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              netdev_ifdown(dev);
              ioctl_setipv4addr(&dev->d_ipaddr, &req->ifr_addr);
              netdev_ifup(dev);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFDSTADDR:  /* Get P-to-P address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ioctl_getipv4addr(&req->ifr_dstaddr, dev->d_draddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCSIFDSTADDR:  /* Set P-to-P address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ioctl_setipv4addr(&dev->d_draddr, &req->ifr_dstaddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFBRDADDR:  /* Get broadcast IP address */
      case SIOCSIFBRDADDR:  /* Set broadcast IP address */
        {
          ret = -ENOSYS;
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFNETMASK:  /* Get network mask */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ioctl_getipv4addr(&req->ifr_addr, dev->d_netmask);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCSIFNETMASK:  /* Set network mask */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ioctl_setipv4addr(&dev->d_netmask, &req->ifr_addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFADDR:  /* Get IP address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_getipv6addr(&lreq->lifr_addr, dev->d_ipv6addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFADDR:  /* Set IP address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              netdev_ifdown(dev);
              ioctl_setipv6addr(dev->d_ipv6addr, &lreq->lifr_addr);
              netdev_ifup(dev);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFDSTADDR:  /* Get P-to-P address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_getipv6addr(&lreq->lifr_dstaddr, dev->d_ipv6draddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFDSTADDR:  /* Set P-to-P address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_setipv6addr(dev->d_ipv6draddr, &lreq->lifr_dstaddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFBRDADDR:  /* Get broadcast IP address */
      case SIOCSLIFBRDADDR:  /* Set broadcast IP address */
        {
          ret = -ENOSYS;
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFNETMASK:  /* Get network mask */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_getipv6addr(&lreq->lifr_addr, dev->d_ipv6netmask);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFNETMASK:  /* Set network mask */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;
              ioctl_setipv6addr(dev->d_ipv6netmask, &lreq->lifr_addr);
              ret = OK;
            }
        }
        break;
#endif

      case SIOCGLIFMTU:  /* Get MTU size */
      case SIOCGIFMTU:   /* Get MTU size */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              req->ifr_mtu = NET_DEV_MTU(dev);
              ret = OK;
            }
        }
        break;

#ifdef CONFIG_NET_ICMPv6_AUTOCONF
      case SIOCIFAUTOCONF:  /* Perform ICMPv6 auto-configuration */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              ret = icmpv6_autoconfig(dev);
            }
        }
        break;
#endif

      case SIOCSIFFLAGS:  /* Sets the interface flags */
        {
          /* Is this a request to bring the interface up? */

          dev = netdev_ifrdev(req);
          if (dev)
            {
              if (req->ifr_flags & IFF_UP)
                {
                  /* Yes.. bring the interface up */

                  netdev_ifup(dev);
                }

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

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

                  netdev_ifdown(dev);
                }
            }

          ret = OK;
        }
        break;

      case SIOCGIFFLAGS:  /* Gets the interface flags */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              req->ifr_flags = dev->d_flags;
            }

          ret = OK;
        }
        break;

      /* MAC address operations only make sense if Ethernet is supported */

#ifdef CONFIG_NET_ETHERNET
      case SIOCGIFHWADDR:  /* Get hardware address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              req->ifr_hwaddr.sa_family = AF_INETX;
              memcpy(req->ifr_hwaddr.sa_data,
                     dev->d_mac.ether_addr_octet, IFHWADDRLEN);
              ret = OK;
            }
        }
        break;

      case SIOCSIFHWADDR:  /* Set hardware address -- will not take effect until ifup */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              memcpy(dev->d_mac.ether_addr_octet,
                     req->ifr_hwaddr.sa_data, IFHWADDRLEN);
              ret = OK;
            }
        }
        break;
#endif

      case SIOCDIFADDR:  /* Delete IP address */
        {
          dev = netdev_ifrdev(req);
          if (dev)
            {
              netdev_ifdown(dev);
#ifdef CONFIG_NET_IPv4
              dev->d_ipaddr = 0;
#endif
#ifdef CONFIG_NET_IPv6
              memset(&dev->d_ipv6addr, 0, sizeof(net_ipv6addr_t));
#endif
              ret = OK;
            }
        }
        break;

      case SIOCGIFCOUNT:  /* Get number of devices */
        {
          req->ifr_count = netdev_count();
          ret = -ENOSYS;
        }
        break;

#ifdef CONFIG_NET_ARPIOCTLS
      case SIOCSARP:  /* Set a ARP mapping */
      case SIOCDARP:  /* Delete an ARP mapping */
      case SIOCGARP:  /* Get an ARP mapping */
# error "IOCTL Commands not implemented"
#endif

#ifdef CONFIG_NETDEV_PHY_IOCTL
#ifdef CONFIG_ARCH_PHY_INTERRUPT
      case SIOCMIINOTIFY: /* Set up for PHY event notifications */
        {
          dev = netdev_ifrdev(req);
          if (dev && dev->d_ioctl)
            {
              struct mii_iotcl_notify_s *notify = &req->ifr_ifru.ifru_mii_notify;
              ret = dev->d_ioctl(dev, cmd, ((long)(uintptr_t)notify));
            }
        }
        break;
#endif

      case SIOCGMIIPHY: /* Get address of MII PHY in use */
      case SIOCGMIIREG: /* Get MII register via MDIO */
      case SIOCSMIIREG: /* Set MII register via MDIO */
        {
          dev = netdev_ifrdev(req);
          if (dev && dev->d_ioctl)
            {
              struct mii_ioctl_data_s *mii_data = &req->ifr_ifru.ifru_mii_data;
              ret = dev->d_ioctl(dev, cmd, ((long)(uintptr_t)mii_data));
            }
        }
        break;
#endif

      default:
        {
          ret = -ENOTTY;
        }
        break;;
    }

  return ret;
}
Exemplo n.º 4
0
static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
                            FAR struct ifreq *req)
{
  FAR struct net_driver_s *dev;
  int ret = -EINVAL;

  ninfo("cmd: %d\n", cmd);

  /* Execute the command */

  switch (cmd)
    {
#ifdef CONFIG_NET_IPv4
      case SIOCGIFADDR:  /* Get IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_get_ipv4addr(&req->ifr_addr, dev->d_ipaddr);
              ret = OK;
            }
        }
        break;
#endif


#ifdef CONFIG_NET_IPv4
      case SIOCSIFADDR:  /* Set IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_set_ipv4addr(&dev->d_ipaddr, &req->ifr_addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFDSTADDR:  /* Get P-to-P address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_get_ipv4addr(&req->ifr_dstaddr, dev->d_draddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCSIFDSTADDR:  /* Set P-to-P address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_set_ipv4addr(&dev->d_draddr, &req->ifr_dstaddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFBRDADDR:  /* Get broadcast IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_get_ipv4broadcast(&req->ifr_broadaddr, dev->d_ipaddr,
                                      dev->d_netmask);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCSIFBRDADDR:  /* Set broadcast IP address */
        {
          ret = -ENOSYS;
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCGIFNETMASK:  /* Get network mask */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_get_ipv4addr(&req->ifr_addr, dev->d_netmask);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv4
      case SIOCSIFNETMASK:  /* Set network mask */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ioctl_set_ipv4addr(&dev->d_netmask, &req->ifr_addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFADDR:  /* Get IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_get_ipv6addr(&lreq->lifr_addr, dev->d_ipv6addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFADDR:  /* Set IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_set_ipv6addr(dev->d_ipv6addr, &lreq->lifr_addr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFDSTADDR:  /* Get P-to-P address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_get_ipv6addr(&lreq->lifr_dstaddr, dev->d_ipv6draddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFDSTADDR:  /* Set P-to-P address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_set_ipv6addr(dev->d_ipv6draddr, &lreq->lifr_dstaddr);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFBRDADDR:  /* Get broadcast IP address */
      case SIOCSLIFBRDADDR:  /* Set broadcast IP address */
        {
          ret = -ENOSYS;
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFNETMASK:  /* Get network mask */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;

              ioctl_get_ipv6addr(&lreq->lifr_addr, dev->d_ipv6netmask);
              ret = OK;
            }
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCSLIFNETMASK:  /* Set network mask */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              FAR struct lifreq *lreq = (FAR struct lifreq *)req;
              ioctl_set_ipv6addr(dev->d_ipv6netmask, &lreq->lifr_addr);
              ret = OK;
            }
        }
        break;
#endif

      case SIOCGLIFMTU:  /* Get MTU size */
      case SIOCGIFMTU:   /* Get MTU size */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              req->ifr_mtu = NETDEV_PKTSIZE(dev);
              ret = OK;
            }
        }
        break;

#ifdef CONFIG_NET_ICMPv6_AUTOCONF
      case SIOCIFAUTOCONF:  /* Perform ICMPv6 auto-configuration */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              ret = icmpv6_autoconfig(dev);
            }
        }
        break;
#endif

      case SIOCSIFFLAGS:  /* Sets the interface flags */
        {
          /* Is this a request to bring the interface up? */

          dev = netdev_ifr_dev(req);
          if (dev)
            {
              if ((req->ifr_flags & IFF_UP) != 0)
                {
                  /* Yes.. bring the interface up */

                  netdev_ifup(dev);
                }

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

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

                  netdev_ifdown(dev);
                }
            }

          ret = OK;
        }
        break;

      case SIOCGIFFLAGS:  /* Gets the interface flags */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
              req->ifr_flags = dev->d_flags;
            }

          ret = OK;
        }
        break;

      /* MAC address operations only make sense if Ethernet or 6LoWPAN are
       * supported.
       */

#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN)
      case SIOCGIFHWADDR:  /* Get hardware address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
#ifdef CONFIG_NET_ETHERNET
              if (dev->d_lltype == NET_LL_ETHERNET ||
                  dev->d_lltype == NET_LL_IEEE80211)
                {
                  req->ifr_hwaddr.sa_family = AF_INETX;
                  memcpy(req->ifr_hwaddr.sa_data,
                         dev->d_mac.ether.ether_addr_octet, IFHWADDRLEN);
                  ret = OK;
                }
              else
#endif

#ifdef CONFIG_NET_6LOWPAN
              if (dev->d_lltype == NET_LL_IEEE802154 ||
                  dev->d_lltype == NET_LL_PKTRADIO)
                {
                  req->ifr_hwaddr.sa_family = AF_INETX;
                  memcpy(req->ifr_hwaddr.sa_data,
                         dev->d_mac.radio.nv_addr,
                         dev->d_mac.radio.nv_addrlen);
                  ret = OK;
                }
               else
#endif
                {
                  nerr("Unsupported link layer\n");
                }
            }
        }
        break;

      case SIOCSIFHWADDR:  /* Set hardware address -- will not take effect until ifup */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
#ifdef CONFIG_NET_ETHERNET
              if (dev->d_lltype == NET_LL_ETHERNET)
                {
                  memcpy(dev->d_mac.ether.ether_addr_octet,
                         req->ifr_hwaddr.sa_data, IFHWADDRLEN);
                  ret = OK;
                }
              else
#endif

#ifdef CONFIG_NET_6LOWPAN
              if (dev->d_lltype == NET_LL_IEEE802154 ||
                  dev->d_lltype == NET_LL_PKTRADIO)
                {
                  FAR struct radio_driver_s *radio;
                  struct radiodev_properties_s properties;

                  /* Get the radio properties */

                  radio = (FAR struct radio_driver_s *)dev;
                  DEBUGASSERT(radio->r_properties != NULL);

                  ret = radio->r_properties(radio, &properties);
                  if (ret >= 0)
                    {
                      dev->d_mac.radio.nv_addrlen = properties.sp_addrlen;
                      memcpy(dev->d_mac.radio.nv_addr,
                             req->ifr_hwaddr.sa_data, NET_6LOWPAN_ADDRSIZE);
                    }
                }
              else
#endif
                {
                  nerr("Unsupported link layer\n");
                }
            }
        }
        break;
#endif

      case SIOCDIFADDR:  /* Delete IP address */
        {
          dev = netdev_ifr_dev(req);
          if (dev)
            {
#ifdef CONFIG_NET_IPv4
              dev->d_ipaddr = 0;
#endif
#ifdef CONFIG_NET_IPv6
              memset(&dev->d_ipv6addr, 0, sizeof(net_ipv6addr_t));
#endif
              ret = OK;
            }
        }
        break;

      case SIOCGIFCOUNT:  /* Get number of devices */
        {
          req->ifr_count = netdev_count();
          ret = -ENOSYS;
        }
        break;

#ifdef CONFIG_NET_IPv4
      case SIOCGIFCONF:  /* Return an interface list (IPv4) */
        {
          ret = netdev_ipv4_ifconf((FAR struct ifconf *)req);
        }
        break;
#endif

#ifdef CONFIG_NET_IPv6
      case SIOCGLIFCONF:  /* Return an interface list (IPv6) */
        {
          ret = netdev_ipv6_ifconf((FAR struct lifconf *)req);
        }
        break;
#endif

#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_PHY_IOCTL)
#ifdef CONFIG_ARCH_PHY_INTERRUPT
      case SIOCMIINOTIFY: /* Set up for PHY event notifications */
        {
          dev = netdev_ifr_dev(req);
          if (dev && dev->d_ioctl)
            {
              struct mii_iotcl_notify_s *notify = &req->ifr_ifru.ifru_mii_notify;
              ret = dev->d_ioctl(dev, cmd, ((unsigned long)(uintptr_t)notify));
            }
        }
        break;
#endif

      case SIOCGMIIPHY: /* Get address of MII PHY in use */
      case SIOCGMIIREG: /* Get MII register via MDIO */
      case SIOCSMIIREG: /* Set MII register via MDIO */
        {
          dev = netdev_ifr_dev(req);
          if (dev && dev->d_ioctl)
            {
              struct mii_ioctl_data_s *mii_data = &req->ifr_ifru.ifru_mii_data;
              ret = dev->d_ioctl(dev, cmd, ((unsigned long)(uintptr_t)mii_data));
            }
        }
        break;
#endif

      default:
        {
          ret = -ENOTTY;
        }
        break;
    }

  return ret;
}