network IOCTL: Clean up some naming and spacing.
This commit is contained in:
parent
78bc1aa6bc
commit
ebf05cb9f5
@ -100,7 +100,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_addipv4route
|
* Name: ioctl_add_ipv4route
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Add an IPv4 route to the routing table.
|
* Add an IPv4 route to the routing table.
|
||||||
@ -111,7 +111,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv4)
|
||||||
static int ioctl_addipv4route(FAR struct rtentry *rtentry)
|
static int ioctl_add_ipv4route(FAR struct rtentry *rtentry)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in *addr;
|
FAR struct sockaddr_in *addr;
|
||||||
in_addr_t target;
|
in_addr_t target;
|
||||||
@ -152,7 +152,7 @@ static int ioctl_addipv4route(FAR struct rtentry *rtentry)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv6)
|
||||||
static int ioctl_addipv6route(FAR struct rtentry *rtentry)
|
static int ioctl_add_ipv4route(FAR struct rtentry *rtentry)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in6 *target;
|
FAR struct sockaddr_in6 *target;
|
||||||
FAR struct sockaddr_in6 *netmask;
|
FAR struct sockaddr_in6 *netmask;
|
||||||
@ -179,7 +179,7 @@ static int ioctl_addipv6route(FAR struct rtentry *rtentry)
|
|||||||
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv6 */
|
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv6 */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_delipv4route
|
* Name: ioctl_del_ipv4route
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Delete an IPv4 route to the routing table.
|
* Delete an IPv4 route to the routing table.
|
||||||
@ -190,7 +190,7 @@ static int ioctl_addipv6route(FAR struct rtentry *rtentry)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv4)
|
||||||
static int ioctl_delipv4route(FAR struct rtentry *rtentry)
|
static int ioctl_del_ipv4route(FAR struct rtentry *rtentry)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in *addr;
|
FAR struct sockaddr_in *addr;
|
||||||
in_addr_t target;
|
in_addr_t target;
|
||||||
@ -207,7 +207,7 @@ static int ioctl_delipv4route(FAR struct rtentry *rtentry)
|
|||||||
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv4 */
|
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv4 */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_delipv6route
|
* Name: ioctl_del_ipv6route
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Delete an IPv6 route to the routing table.
|
* Delete an IPv6 route to the routing table.
|
||||||
@ -218,7 +218,7 @@ static int ioctl_delipv4route(FAR struct rtentry *rtentry)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_ROUTE) && defined(CONFIG_NET_IPv6)
|
||||||
static int ioctl_delipv6route(FAR struct rtentry *rtentry)
|
static int ioctl_del_ipv6route(FAR struct rtentry *rtentry)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in6 *target;
|
FAR struct sockaddr_in6 *target;
|
||||||
FAR struct sockaddr_in6 *netmask;
|
FAR struct sockaddr_in6 *netmask;
|
||||||
@ -231,7 +231,7 @@ static int ioctl_delipv6route(FAR struct rtentry *rtentry)
|
|||||||
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv6 */
|
#endif /* CONFIG_NET_ROUTE && CONFIG_NET_IPv6 */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_getipv4addr
|
* Name: ioctl_get_ipv4addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy IP addresses from device structure to user memory.
|
* Copy IP addresses from device structure to user memory.
|
||||||
@ -243,7 +243,8 @@ static int ioctl_delipv6route(FAR struct rtentry *rtentry)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
static void ioctl_getipv4addr(FAR struct sockaddr *outaddr, in_addr_t inaddr)
|
static void ioctl_get_ipv4addr(FAR struct sockaddr *outaddr,
|
||||||
|
in_addr_t inaddr)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in *dest = (FAR struct sockaddr_in *)outaddr;
|
FAR struct sockaddr_in *dest = (FAR struct sockaddr_in *)outaddr;
|
||||||
dest->sin_family = AF_INET;
|
dest->sin_family = AF_INET;
|
||||||
@ -253,7 +254,7 @@ static void ioctl_getipv4addr(FAR struct sockaddr *outaddr, in_addr_t inaddr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_getipv6addr
|
* Name: ioctl_get_ipv6addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy IP addresses from device structure to user memory.
|
* Copy IP addresses from device structure to user memory.
|
||||||
@ -265,8 +266,8 @@ static void ioctl_getipv4addr(FAR struct sockaddr *outaddr, in_addr_t inaddr)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
static void ioctl_getipv6addr(FAR struct sockaddr_storage *outaddr,
|
static void ioctl_get_ipv6addr(FAR struct sockaddr_storage *outaddr,
|
||||||
FAR const net_ipv6addr_t inaddr)
|
FAR const net_ipv6addr_t inaddr)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_in6 *dest = (FAR struct sockaddr_in6 *)outaddr;
|
FAR struct sockaddr_in6 *dest = (FAR struct sockaddr_in6 *)outaddr;
|
||||||
dest->sin6_family = AF_INET6;
|
dest->sin6_family = AF_INET6;
|
||||||
@ -276,7 +277,7 @@ static void ioctl_getipv6addr(FAR struct sockaddr_storage *outaddr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_setipv4addr
|
* Name: ioctl_set_ipv4addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy IP addresses from user memory into the device structure
|
* Copy IP addresses from user memory into the device structure
|
||||||
@ -289,8 +290,8 @@ static void ioctl_getipv6addr(FAR struct sockaddr_storage *outaddr,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
static void ioctl_setipv4addr(FAR in_addr_t *outaddr,
|
static void ioctl_set_ipv4addr(FAR in_addr_t *outaddr,
|
||||||
FAR const struct sockaddr *inaddr)
|
FAR const struct sockaddr *inaddr)
|
||||||
{
|
{
|
||||||
FAR const struct sockaddr_in *src = (FAR const struct sockaddr_in *)inaddr;
|
FAR const struct sockaddr_in *src = (FAR const struct sockaddr_in *)inaddr;
|
||||||
*outaddr = src->sin_addr.s_addr;
|
*outaddr = src->sin_addr.s_addr;
|
||||||
@ -298,7 +299,7 @@ static void ioctl_setipv4addr(FAR in_addr_t *outaddr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ioctl_setipv6addr
|
* Name: ioctl_set_ipv6addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Copy IP addresses from user memory into the device structure
|
* Copy IP addresses from user memory into the device structure
|
||||||
@ -311,8 +312,8 @@ static void ioctl_setipv4addr(FAR in_addr_t *outaddr,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
static void ioctl_setipv6addr(FAR net_ipv6addr_t outaddr,
|
static void ioctl_set_ipv6addr(FAR net_ipv6addr_t outaddr,
|
||||||
FAR const struct sockaddr_storage *inaddr)
|
FAR const struct sockaddr_storage *inaddr)
|
||||||
{
|
{
|
||||||
FAR const struct sockaddr_in6 *src = (FAR const struct sockaddr_in6 *)inaddr;
|
FAR const struct sockaddr_in6 *src = (FAR const struct sockaddr_in6 *)inaddr;
|
||||||
memcpy(outaddr, src->sin6_addr.in6_u.u6_addr8, 16);
|
memcpy(outaddr, src->sin6_addr.in6_u.u6_addr8, 16);
|
||||||
@ -320,7 +321,7 @@ static void ioctl_setipv6addr(FAR net_ipv6addr_t outaddr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_wifrdev
|
* Name: netdev_wifr_dev
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Verify the struct iwreq and get the Wireless device.
|
* Verify the struct iwreq and get the Wireless device.
|
||||||
@ -334,7 +335,7 @@ static void ioctl_setipv6addr(FAR net_ipv6addr_t outaddr,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
||||||
static FAR struct net_driver_s *netdev_wifrdev(FAR struct iwreq *req)
|
static FAR struct net_driver_s *netdev_wifr_dev(FAR struct iwreq *req)
|
||||||
{
|
{
|
||||||
if (req != NULL)
|
if (req != NULL)
|
||||||
{
|
{
|
||||||
@ -350,7 +351,7 @@ static FAR struct net_driver_s *netdev_wifrdev(FAR struct iwreq *req)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_wifrioctl
|
* Name: netdev_wifr_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform wireless network device specific operations.
|
* Perform wireless network device specific operations.
|
||||||
@ -368,8 +369,8 @@ static FAR struct net_driver_s *netdev_wifrdev(FAR struct iwreq *req)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
||||||
static int netdev_wifrioctl(FAR struct socket *psock, int cmd,
|
static int netdev_wifr_ioctl(FAR struct socket *psock, int cmd,
|
||||||
FAR struct iwreq *req)
|
FAR struct iwreq *req)
|
||||||
{
|
{
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
int ret = -ENOTTY;
|
int ret = -ENOTTY;
|
||||||
@ -380,7 +381,7 @@ static int netdev_wifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
{
|
{
|
||||||
/* Get the wireless device associated with the IOCTL command */
|
/* Get the wireless device associated with the IOCTL command */
|
||||||
|
|
||||||
dev = netdev_wifrdev(req);
|
dev = netdev_wifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
/* Just forward the IOCTL to the wireless driver */
|
/* Just forward the IOCTL to the wireless driver */
|
||||||
@ -394,7 +395,7 @@ static int netdev_wifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_ifrdev
|
* Name: netdev_ifr_dev
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Verify the struct ifreq and get the Ethernet device.
|
* Verify the struct ifreq and get the Ethernet device.
|
||||||
@ -407,7 +408,7 @@ static int netdev_wifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static FAR struct net_driver_s *netdev_ifrdev(FAR struct ifreq *req)
|
static FAR struct net_driver_s *netdev_ifr_dev(FAR struct ifreq *req)
|
||||||
{
|
{
|
||||||
if (req != NULL)
|
if (req != NULL)
|
||||||
{
|
{
|
||||||
@ -422,7 +423,7 @@ static FAR struct net_driver_s *netdev_ifrdev(FAR struct ifreq *req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_ifrioctl
|
* Name: netdev_ifr_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform network device specific operations.
|
* Perform network device specific operations.
|
||||||
@ -438,8 +439,8 @@ static FAR struct net_driver_s *netdev_ifrdev(FAR struct ifreq *req)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||||
FAR struct ifreq *req)
|
FAR struct ifreq *req)
|
||||||
{
|
{
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
@ -453,10 +454,10 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCGIFADDR: /* Get IP address */
|
case SIOCGIFADDR: /* Get IP address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ioctl_getipv4addr(&req->ifr_addr, dev->d_ipaddr);
|
ioctl_get_ipv4addr(&req->ifr_addr, dev->d_ipaddr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,11 +468,11 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCSIFADDR: /* Set IP address */
|
case SIOCSIFADDR: /* Set IP address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
netdev_ifdown(dev);
|
netdev_ifdown(dev);
|
||||||
ioctl_setipv4addr(&dev->d_ipaddr, &req->ifr_addr);
|
ioctl_set_ipv4addr(&dev->d_ipaddr, &req->ifr_addr);
|
||||||
netdev_ifup(dev);
|
netdev_ifup(dev);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
@ -482,10 +483,10 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCGIFDSTADDR: /* Get P-to-P address */
|
case SIOCGIFDSTADDR: /* Get P-to-P address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ioctl_getipv4addr(&req->ifr_dstaddr, dev->d_draddr);
|
ioctl_get_ipv4addr(&req->ifr_dstaddr, dev->d_draddr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,10 +496,10 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCSIFDSTADDR: /* Set P-to-P address */
|
case SIOCSIFDSTADDR: /* Set P-to-P address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ioctl_setipv4addr(&dev->d_draddr, &req->ifr_dstaddr);
|
ioctl_set_ipv4addr(&dev->d_draddr, &req->ifr_dstaddr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,10 +518,10 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCGIFNETMASK: /* Get network mask */
|
case SIOCGIFNETMASK: /* Get network mask */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ioctl_getipv4addr(&req->ifr_addr, dev->d_netmask);
|
ioctl_get_ipv4addr(&req->ifr_addr, dev->d_netmask);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -530,10 +531,10 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
case SIOCSIFNETMASK: /* Set network mask */
|
case SIOCSIFNETMASK: /* Set network mask */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ioctl_setipv4addr(&dev->d_netmask, &req->ifr_addr);
|
ioctl_set_ipv4addr(&dev->d_netmask, &req->ifr_addr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,12 +544,12 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCGLIFADDR: /* Get IP address */
|
case SIOCGLIFADDR: /* Get IP address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
|
|
||||||
ioctl_getipv6addr(&lreq->lifr_addr, dev->d_ipv6addr);
|
ioctl_get_ipv6addr(&lreq->lifr_addr, dev->d_ipv6addr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,13 +559,13 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCSLIFADDR: /* Set IP address */
|
case SIOCSLIFADDR: /* Set IP address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
|
|
||||||
netdev_ifdown(dev);
|
netdev_ifdown(dev);
|
||||||
ioctl_setipv6addr(dev->d_ipv6addr, &lreq->lifr_addr);
|
ioctl_set_ipv6addr(dev->d_ipv6addr, &lreq->lifr_addr);
|
||||||
netdev_ifup(dev);
|
netdev_ifup(dev);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
@ -575,12 +576,12 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCGLIFDSTADDR: /* Get P-to-P address */
|
case SIOCGLIFDSTADDR: /* Get P-to-P address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
|
|
||||||
ioctl_getipv6addr(&lreq->lifr_dstaddr, dev->d_ipv6draddr);
|
ioctl_get_ipv6addr(&lreq->lifr_dstaddr, dev->d_ipv6draddr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -590,12 +591,12 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCSLIFDSTADDR: /* Set P-to-P address */
|
case SIOCSLIFDSTADDR: /* Set P-to-P address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
|
|
||||||
ioctl_setipv6addr(dev->d_ipv6draddr, &lreq->lifr_dstaddr);
|
ioctl_set_ipv6addr(dev->d_ipv6draddr, &lreq->lifr_dstaddr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -614,12 +615,12 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCGLIFNETMASK: /* Get network mask */
|
case SIOCGLIFNETMASK: /* Get network mask */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
|
|
||||||
ioctl_getipv6addr(&lreq->lifr_addr, dev->d_ipv6netmask);
|
ioctl_get_ipv6addr(&lreq->lifr_addr, dev->d_ipv6netmask);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,11 +630,11 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
case SIOCSLIFNETMASK: /* Set network mask */
|
case SIOCSLIFNETMASK: /* Set network mask */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
FAR struct lifreq *lreq = (FAR struct lifreq *)req;
|
||||||
ioctl_setipv6addr(dev->d_ipv6netmask, &lreq->lifr_addr);
|
ioctl_set_ipv6addr(dev->d_ipv6netmask, &lreq->lifr_addr);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -643,7 +644,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
case SIOCGLIFMTU: /* Get MTU size */
|
case SIOCGLIFMTU: /* Get MTU size */
|
||||||
case SIOCGIFMTU: /* Get MTU size */
|
case SIOCGIFMTU: /* Get MTU size */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
req->ifr_mtu = NET_DEV_MTU(dev);
|
req->ifr_mtu = NET_DEV_MTU(dev);
|
||||||
@ -655,7 +656,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
|
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
|
||||||
case SIOCIFAUTOCONF: /* Perform ICMPv6 auto-configuration */
|
case SIOCIFAUTOCONF: /* Perform ICMPv6 auto-configuration */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
ret = icmpv6_autoconfig(dev);
|
ret = icmpv6_autoconfig(dev);
|
||||||
@ -668,7 +669,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
{
|
{
|
||||||
/* Is this a request to bring the interface up? */
|
/* Is this a request to bring the interface up? */
|
||||||
|
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
if ((req->ifr_flags & IFF_UP) != 0)
|
if ((req->ifr_flags & IFF_UP) != 0)
|
||||||
@ -694,7 +695,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
|
|
||||||
case SIOCGIFFLAGS: /* Gets the interface flags */
|
case SIOCGIFFLAGS: /* Gets the interface flags */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
req->ifr_flags = dev->d_flags;
|
req->ifr_flags = dev->d_flags;
|
||||||
@ -709,7 +710,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN)
|
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN)
|
||||||
case SIOCGIFHWADDR: /* Get hardware address */
|
case SIOCGIFHWADDR: /* Get hardware address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_ETHERNET
|
#ifdef CONFIG_NET_ETHERNET
|
||||||
@ -753,7 +754,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
|
|
||||||
case SIOCSIFHWADDR: /* Set hardware address -- will not take effect until ifup */
|
case SIOCSIFHWADDR: /* Set hardware address -- will not take effect until ifup */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_ETHERNET
|
#ifdef CONFIG_NET_ETHERNET
|
||||||
@ -797,7 +798,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
|
|
||||||
case SIOCDIFADDR: /* Delete IP address */
|
case SIOCDIFADDR: /* Delete IP address */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
netdev_ifdown(dev);
|
netdev_ifdown(dev);
|
||||||
@ -823,7 +824,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
#ifdef CONFIG_ARCH_PHY_INTERRUPT
|
#ifdef CONFIG_ARCH_PHY_INTERRUPT
|
||||||
case SIOCMIINOTIFY: /* Set up for PHY event notifications */
|
case SIOCMIINOTIFY: /* Set up for PHY event notifications */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev && dev->d_ioctl)
|
if (dev && dev->d_ioctl)
|
||||||
{
|
{
|
||||||
struct mii_iotcl_notify_s *notify = &req->ifr_ifru.ifru_mii_notify;
|
struct mii_iotcl_notify_s *notify = &req->ifr_ifru.ifru_mii_notify;
|
||||||
@ -837,7 +838,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
case SIOCGMIIREG: /* Get MII register via MDIO */
|
case SIOCGMIIREG: /* Get MII register via MDIO */
|
||||||
case SIOCSMIIREG: /* Set MII register via MDIO */
|
case SIOCSMIIREG: /* Set MII register via MDIO */
|
||||||
{
|
{
|
||||||
dev = netdev_ifrdev(req);
|
dev = netdev_ifr_dev(req);
|
||||||
if (dev && dev->d_ioctl)
|
if (dev && dev->d_ioctl)
|
||||||
{
|
{
|
||||||
struct mii_ioctl_data_s *mii_data = &req->ifr_ifru.ifru_mii_data;
|
struct mii_ioctl_data_s *mii_data = &req->ifr_ifru.ifru_mii_data;
|
||||||
@ -888,7 +889,7 @@ static FAR struct net_driver_s *netdev_imsfdev(FAR struct ip_msfilter *imsf)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_imsfioctl
|
* Name: netdev_imsf_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform network device specific operations.
|
* Perform network device specific operations.
|
||||||
@ -906,8 +907,8 @@ static FAR struct net_driver_s *netdev_imsfdev(FAR struct ip_msfilter *imsf)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
static int netdev_imsfioctl(FAR struct socket *psock, int cmd,
|
static int netdev_imsf_ioctl(FAR struct socket *psock, int cmd,
|
||||||
FAR struct ip_msfilter *imsf)
|
FAR struct ip_msfilter *imsf)
|
||||||
{
|
{
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
@ -947,7 +948,7 @@ static int netdev_imsfioctl(FAR struct socket *psock, int cmd,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_arpioctl
|
* Name: netdev_arp_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform ARP table specific operations.
|
* Perform ARP table specific operations.
|
||||||
@ -965,8 +966,8 @@ static int netdev_imsfioctl(FAR struct socket *psock, int cmd,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ARP
|
#ifdef CONFIG_NET_ARP
|
||||||
static int netdev_arpioctl(FAR struct socket *psock, int cmd,
|
static int netdev_arp_ioctl(FAR struct socket *psock, int cmd,
|
||||||
FAR struct arpreq *req)
|
FAR struct arpreq *req)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1070,7 +1071,7 @@ static int netdev_arpioctl(FAR struct socket *psock, int cmd,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netdev_rtioctl
|
* Name: netdev_rt_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform routing table specific operations.
|
* Perform routing table specific operations.
|
||||||
@ -1088,8 +1089,8 @@ static int netdev_arpioctl(FAR struct socket *psock, int cmd,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ROUTE
|
#ifdef CONFIG_NET_ROUTE
|
||||||
static int netdev_rtioctl(FAR struct socket *psock, int cmd,
|
static int netdev_rt_ioctl(FAR struct socket *psock, int cmd,
|
||||||
FAR struct rtentry *rtentry)
|
FAR struct rtentry *rtentry)
|
||||||
{
|
{
|
||||||
int ret = -EAFNOSUPPORT;
|
int ret = -EAFNOSUPPORT;
|
||||||
|
|
||||||
@ -1111,7 +1112,7 @@ static int netdev_rtioctl(FAR struct socket *psock, int cmd,
|
|||||||
if (rtentry->rt_target->ss_family == AF_INET)
|
if (rtentry->rt_target->ss_family == AF_INET)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = ioctl_addipv4route(rtentry);
|
ret = ioctl_add_ipv4route(rtentry);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_IPv4 */
|
#endif /* CONFIG_NET_IPv4 */
|
||||||
|
|
||||||
@ -1140,7 +1141,7 @@ static int netdev_rtioctl(FAR struct socket *psock, int cmd,
|
|||||||
if (rtentry->rt_target->ss_family == AF_INET)
|
if (rtentry->rt_target->ss_family == AF_INET)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = ioctl_delipv4route(rtentry);
|
ret = ioctl_del_ipv4route(rtentry);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_IPv4 */
|
#endif /* CONFIG_NET_IPv4 */
|
||||||
|
|
||||||
@ -1149,7 +1150,7 @@ static int netdev_rtioctl(FAR struct socket *psock, int cmd,
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = ioctl_delipv6route(rtentry);
|
ret = ioctl_del_ipv6route(rtentry);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_IPv6 */
|
#endif /* CONFIG_NET_IPv6 */
|
||||||
}
|
}
|
||||||
@ -1224,14 +1225,15 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
/* Execute the command. First check for a standard network IOCTL command. */
|
/* Execute the command. First check for a standard network IOCTL command. */
|
||||||
|
|
||||||
ret = netdev_ifrioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg));
|
ret = netdev_ifr_ioctl(psock, cmd, (FAR struct ifreq *)((uintptr_t)arg));
|
||||||
|
|
||||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_WIRELESS_IOCTL)
|
||||||
/* Check a wireless network command */
|
/* Check a wireless network command */
|
||||||
|
|
||||||
if (ret == -ENOTTY)
|
if (ret == -ENOTTY)
|
||||||
{
|
{
|
||||||
ret = netdev_wifrioctl(psock, cmd, (FAR struct iwreq *)((uintptr_t)arg));
|
ret = netdev_wifr_ioctl(psock, cmd,
|
||||||
|
(FAR struct iwreq *)((uintptr_t)arg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1240,7 +1242,8 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
if (ret == -ENOTTY)
|
if (ret == -ENOTTY)
|
||||||
{
|
{
|
||||||
ret = netdev_imsfioctl(psock, cmd, (FAR struct ip_msfilter *)((uintptr_t)arg));
|
ret = netdev_imsf_ioctl(psock, cmd,
|
||||||
|
(FAR struct ip_msfilter *)((uintptr_t)arg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1249,7 +1252,8 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
if (ret == -ENOTTY)
|
if (ret == -ENOTTY)
|
||||||
{
|
{
|
||||||
ret = netdev_arpioctl(psock, cmd, (FAR struct arpreq *)((uintptr_t)arg));
|
ret = netdev_arp_ioctl(psock, cmd,
|
||||||
|
(FAR struct arpreq *)((uintptr_t)arg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1258,7 +1262,8 @@ int psock_ioctl(FAR struct socket *psock, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
if (ret == -ENOTTY)
|
if (ret == -ENOTTY)
|
||||||
{
|
{
|
||||||
ret = netdev_rtioctl(psock, cmd, (FAR struct rtentry *)((uintptr_t)arg));
|
ret = netdev_rt_ioctl(psock, cmd,
|
||||||
|
(FAR struct rtentry *)((uintptr_t)arg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user