mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
include/sys/sockio.h, net/netdev/netdev_ioctl.c: Fix a compile error introducted with commit 34db6d1433. That commit added the semi-standard ip_msfilter structure to netinet/in.h. Howver, there was a non-standard version of that structure in sys/sockio.h. This commit removes the non-standard version of struct ip_msfilter and adapts the IOCTL and device lookup logic in net/netdev to work with the new, semi-standard version in netinet/in.h.
This commit is contained in:
+45
-4
@@ -178,12 +178,53 @@ FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname);
|
||||
|
||||
int netdev_foreach(netdev_callback_t callback, FAR void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_finddevice_ipv4addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching a local address
|
||||
* with the subnet served by the device. Only "up" devices are considered
|
||||
* (since a "down" device has no meaningful address).
|
||||
*
|
||||
* Input Parameters:
|
||||
* ripaddr - Remote address of a connection to use in the lookup
|
||||
*
|
||||
* Returned Value:
|
||||
* Pointer to driver on success; null on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
FAR struct net_driver_s *netdev_finddevice_ipv4addr(in_addr_t ripaddr);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_finddevice_ipv6addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching a local address
|
||||
* with the subnet served by the device. Only "up" devices are considered
|
||||
* (since a "down" device has no meaningful address).
|
||||
*
|
||||
* Input Parameters:
|
||||
* ripaddr - Remote address of a connection to use in the lookup
|
||||
*
|
||||
* Returned Value:
|
||||
* Pointer to driver on success; null on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
FAR struct net_driver_s *
|
||||
netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_findby_ipv4addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching an arbitrary
|
||||
* IPv4 address.
|
||||
* Find a previously registered network device by matching the remote
|
||||
* IPv4 address that can be reached by the device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lipaddr - Local, bound address of a connection.
|
||||
@@ -204,8 +245,8 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t lipaddr,
|
||||
* Name: netdev_findby_ipv6addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching an arbitrary
|
||||
* IPv6 address.
|
||||
* Find a previously registered network device by matching the remote
|
||||
* IPv6 address that can be reached by the device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lipaddr - Local, bound address of a connection.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* net/netdev/netdev_findbyaddr.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014-2015, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -57,7 +58,7 @@
|
||||
#include "netdev/netdev.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@@ -77,7 +78,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
static FAR struct net_driver_s *netdev_finddevice_ipv4addr(in_addr_t ripaddr)
|
||||
FAR struct net_driver_s *netdev_finddevice_ipv4addr(in_addr_t ripaddr)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
|
||||
@@ -127,7 +128,7 @@ static FAR struct net_driver_s *netdev_finddevice_ipv4addr(in_addr_t ripaddr)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
static FAR struct net_driver_s *
|
||||
FAR struct net_driver_s *
|
||||
netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
@@ -161,16 +162,12 @@ netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr)
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_findby_ipv4addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching an arbitrary
|
||||
* IPv4 address.
|
||||
* Find a previously registered network device by matching the remote
|
||||
* IPv4 address that can be reached by the device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lipaddr - Local, bound address of a connection.
|
||||
@@ -258,8 +255,8 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t lipaddr,
|
||||
* Name: netdev_findby_ipv6addr
|
||||
*
|
||||
* Description:
|
||||
* Find a previously registered network device by matching an arbitrary
|
||||
* IPv6 address.
|
||||
* Find a previously registered network device by matching the remote
|
||||
* IPv6 address that can be reached by the device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lipaddr - Local, bound address of a connection.
|
||||
|
||||
@@ -1125,16 +1125,16 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
static FAR struct net_driver_s *netdev_imsfdev(FAR struct ip_msfilter *imsf)
|
||||
{
|
||||
if (!imsf)
|
||||
if (imsf == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the network device associated with the device name
|
||||
* in the request data.
|
||||
/* Find the network device associated with the address of the IP address
|
||||
* of the local device.
|
||||
*/
|
||||
|
||||
return netdev_findbyname(imsf->imsf_name);
|
||||
return netdev_finddevice_ipv4addr(imsf->imsf_interface.s_addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1507,6 +1507,7 @@ ssize_t net_ioctl_arglen(int cmd)
|
||||
case SIOCSIFFLAGS:
|
||||
case SIOCGIFFLAGS:
|
||||
return sizeof(struct ifreq);
|
||||
|
||||
case SIOCGLIFADDR:
|
||||
case SIOCSLIFADDR:
|
||||
case SIOCGLIFDSTADDR:
|
||||
@@ -1518,26 +1519,34 @@ ssize_t net_ioctl_arglen(int cmd)
|
||||
case SIOCGLIFMTU:
|
||||
case SIOCIFAUTOCONF:
|
||||
return sizeof(struct lifreq);
|
||||
|
||||
case SIOCGIFCONF:
|
||||
return sizeof(struct ifconf);
|
||||
|
||||
case SIOCGLIFCONF:
|
||||
return sizeof(struct lifconf);
|
||||
|
||||
case SIOCGIPMSFILTER:
|
||||
case SIOCSIPMSFILTER:
|
||||
return sizeof(struct ip_msfilter);
|
||||
|
||||
case SIOCSARP:
|
||||
case SIOCDARP:
|
||||
case SIOCGARP:
|
||||
return sizeof(struct arpreq);
|
||||
|
||||
case SIOCADDRT:
|
||||
case SIOCDELRT:
|
||||
return sizeof(struct rtentry);
|
||||
|
||||
case SIOCMIINOTIFY:
|
||||
return sizeof(struct mii_iotcl_notify_s);
|
||||
|
||||
case SIOCGMIIPHY:
|
||||
case SIOCGMIIREG:
|
||||
case SIOCSMIIREG:
|
||||
return sizeof(struct mii_ioctl_data_s);
|
||||
|
||||
default:
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
# ifdef CONFIG_NETDEV_WIRELESS_IOCTL
|
||||
|
||||
Reference in New Issue
Block a user