diff options
Diffstat (limited to 'nuttx/net/netdev-ioctl.c')
-rw-r--r-- | nuttx/net/netdev-ioctl.c | 47 |
1 files changed, 4 insertions, 43 deletions
diff --git a/nuttx/net/netdev-ioctl.c b/nuttx/net/netdev-ioctl.c index f093e6133..3825a5f7b 100644 --- a/nuttx/net/netdev-ioctl.c +++ b/nuttx/net/netdev-ioctl.c @@ -106,17 +106,17 @@ static void ioctl_setipaddr(uip_ipaddr_t *outaddr, struct sockaddr *inaddr) static void ioctl_ifup(FAR struct uip_driver_s *dev) { - if (dev->ifup) + if (dev->d_ifup) { - dev->ifup(dev); + dev->d_ifup(dev); } } static void ioctl_ifdown(FAR struct uip_driver_s *dev) { - if (dev->ifdown) + if (dev->d_ifdown) { - dev->ifdown(dev); + dev->d_ifdown(dev); } } @@ -190,95 +190,56 @@ int netdev_ioctl(int sockfd, int cmd, struct ifreq *req) { case SIOCGIFADDR: /* Get IP address */ ioctl_getipaddr(&req->ifr_addr, &dev->d_ipaddr); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); break; case SIOCSIFADDR: /* Set IP address */ ioctl_ifdown(dev); ioctl_setipaddr(&dev->d_ipaddr, &req->ifr_addr); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); ioctl_ifup(dev); break; case SIOCGIFDSTADDR: /* Get P-to-P address */ ioctl_getipaddr(&req->ifr_dstaddr, &dev->d_draddr); - dbg("Dev: %s Default router: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_draddr >> 24) & 0xff, (dev->d_draddr >> 16) & 0xff, - (dev->d_draddr >> 8) & 0xff, dev->d_draddr & 0xff); break; case SIOCSIFDSTADDR: /* Set P-to-P address */ ioctl_setipaddr(&dev->d_draddr, &req->ifr_dstaddr); - dbg("Dev: %s Default router: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_draddr >> 24) & 0xff, (dev->d_draddr >> 16) & 0xff, - (dev->d_draddr >> 8) & 0xff, dev->d_draddr & 0xff); break; case SIOCGIFNETMASK: /* Get network mask */ ioctl_getipaddr(&req->ifr_addr, &dev->d_netmask); - dbg("Dev: %s Netmask: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_netmask >> 24) & 0xff, (dev->d_netmask >> 16) & 0xff, - (dev->d_netmask >> 8) & 0xff, dev->d_netmask & 0xff); break; case SIOCSIFNETMASK: /* Set network mask */ ioctl_setipaddr(&dev->d_netmask, &req->ifr_addr); - dbg("Dev: %s Netmask: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_netmask >> 24) & 0xff, (dev->d_netmask >> 16) & 0xff, - (dev->d_netmask >> 8) & 0xff, dev->d_netmask & 0xff); break; case SIOCGIFMTU: /* Get MTU size */ req->ifr_mtu = UIP_BUFSIZE; - dbg("Dev: %s MTU: %d\n", dev->d_ifname, UIP_BUFSIZE); break; case SIOCGIFHWADDR: /* Get hardware address */ req->ifr_hwaddr.sa_family = AF_INETX; memcpy(req->ifr_hwaddr.sa_data, dev->d_mac.addr, IFHWADDRLEN); - dbg("Dev: %s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - dev->d_ifname, - dev->d_mac.addr[0], dev->d_mac.addr[1], dev->d_mac.addr[2], - dev->d_mac.addr[3], dev->d_mac.addr[4], dev->d_mac.addr[5]); break; case SIOCSIFHWADDR: /* Set hardware address */ req->ifr_hwaddr.sa_family = AF_INETX; memcpy(dev->d_mac.addr, req->ifr_hwaddr.sa_data, IFHWADDRLEN); - dbg("Dev: %s MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", - dev->d_ifname, - dev->d_mac.addr[0], dev->d_mac.addr[1], dev->d_mac.addr[2], - dev->d_mac.addr[3], dev->d_mac.addr[4], dev->d_mac.addr[5]); break; case SIOCDIFADDR: /* Delete IP address */ ioctl_ifdown(dev); memset(&dev->d_ipaddr, 0, sizeof(uip_ipaddr_t)); - dbg("Dev: %s IP: %d.%d.%d.%d\n", - dev->d_ifname, - (dev->d_ipaddr >> 24) & 0xff, (dev->d_ipaddr >> 16) & 0xff, - (dev->d_ipaddr >> 8) & 0xff, dev->d_ipaddr & 0xff); break; case SIOCGIFCOUNT: /* Get number of devices */ req->ifr_count = netdev_count(); - dbg("Dev: %s I/F count: %d\n", netdev_count()); err = ENOSYS; break; case SIOCGIFBRDADDR: /* Get broadcast IP address */ case SIOCSIFBRDADDR: /* Set broadcast IP address */ - dbg("Dev: %s Broadcast: 255.255.255.255d\n", dev->d_ifname); err = ENOSYS; goto errout; |