First round of compile fixes for IPv6
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4813 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1b7be5f0e0
commit
4f8e4d2308
@ -1182,8 +1182,10 @@ int mountnfs(struct nfs_args *argp, void **handle)
|
||||
nmp->nm_acregmax = NFS_MAXATTRTIMO;
|
||||
nmp->nm_acdirmin = NFS_MINATTRTIMO;
|
||||
nmp->nm_acdirmax = NFS_MAXATTRTIMO;
|
||||
|
||||
strncpy(nmp->nm_path, argp->path, 90);
|
||||
nmp->nm_nam = argp->addr;
|
||||
memcpy(&nmp->nm_nam, &argp->addr, argp->addrlen);
|
||||
|
||||
nfs_decode_args(nmp, argp);
|
||||
|
||||
/* Set up the sockets and per-host congestion */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/****************************************************************************
|
||||
/*******************************************************************************************
|
||||
* include/net/if.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
|
||||
@ -31,20 +31,20 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
*******************************************************************************************/
|
||||
|
||||
#ifndef __NET_IF_H
|
||||
#define __NET_IF_H
|
||||
|
||||
/****************************************************************************
|
||||
/*******************************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
*******************************************************************************************/
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
/****************************************************************************
|
||||
/*******************************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
*******************************************************************************************/
|
||||
|
||||
/* Sizing parameters */
|
||||
|
||||
@ -52,35 +52,82 @@
|
||||
#define IF_NAMESIZE 6 /* Newer naming standard */
|
||||
#define IFHWADDRLEN 6
|
||||
|
||||
/****************************************************************************
|
||||
/*******************************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
*******************************************************************************************/
|
||||
|
||||
struct ifreq
|
||||
/* This is the newer form if the I/F request structure that can be used with both IPv4
|
||||
* and IPv6.
|
||||
*/
|
||||
|
||||
struct lifreq
|
||||
{
|
||||
char ifr_name[IFNAMSIZ]; /* Network device name (e.g. "eth0") */
|
||||
char lifr_name[IFNAMSIZ]; /* Network device name (e.g. "eth0") */
|
||||
union
|
||||
{
|
||||
struct sockaddr ifru_addr; /* IP Address */
|
||||
struct sockaddr ifru_dstaddr; /* P-to-P Address */
|
||||
struct sockaddr ifru_broadaddr; /* Broadcast address */
|
||||
struct sockaddr ifru_netmask; /* Netmask */
|
||||
struct sockaddr ifru_hwaddr; /* MAC address */
|
||||
int ifru_count; /* Number of devices */
|
||||
int ifru_mtu; /* MTU size */
|
||||
struct sockaddr_storage lifru_addr; /* IP Address */
|
||||
struct sockaddr_storage lifru_dstaddr; /* P-to-P Address */
|
||||
struct sockaddr_storage lifru_broadaddr; /* Broadcast address */
|
||||
struct sockaddr_storage lifru_netmask; /* Netmask */
|
||||
struct sockaddr_storage lifru_hwaddr; /* MAC address */
|
||||
int lifru_count; /* Number of devices */
|
||||
int lifru_mtu; /* MTU size */
|
||||
} lifr_ifru;
|
||||
};
|
||||
|
||||
#define lifr_addr lifr_ifru.lifru_addr /* IP address */
|
||||
#define lifr_dstaddr lifr_ifru.lifru_dstaddr /* P-to-P Address */
|
||||
#define lifr_broadaddr lifr_ifru.lifru_broadaddr /* Broadcast address */
|
||||
#define lifr_netmask lifr_ifru.lifru_netmask /* Interface net mask */
|
||||
#define lifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define lifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define lifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
|
||||
/* This is the older I/F request that should only be used with IPv4. However, since
|
||||
* NuttX only supports IPv4 or 6 (not both), we can force the older structure to
|
||||
* be compatible when IPv6 is enabled.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
struct ifreq
|
||||
{
|
||||
char ifr_name[IFNAMSIZ]; /* Network device name (e.g. "eth0") */
|
||||
union
|
||||
{
|
||||
struct sockaddr ifru_addr; /* IP Address */
|
||||
struct sockaddr ifru_dstaddr; /* P-to-P Address */
|
||||
struct sockaddr ifru_broadaddr; /* Broadcast address */
|
||||
struct sockaddr ifru_netmask; /* Netmask */
|
||||
struct sockaddr ifru_hwaddr; /* MAC address */
|
||||
int ifru_count; /* Number of devices */
|
||||
int ifru_mtu; /* MTU size */
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* IP address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* P-to-P Address */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* Broadcast address */
|
||||
#define ifr_netmask ifr_ifru.ifru_netmask /* Interface net mask */
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* MTU */
|
||||
#define ifr_count ifr_ifru.ifru_count /* Number of devices */
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* IP address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* P-to-P Address */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* Broadcast address */
|
||||
#define ifr_netmask ifr_ifru.ifru_netmask /* Interface net mask */
|
||||
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* MTU */
|
||||
#define ifr_count ifr_ifru.ifru_count /* Number of devices */
|
||||
|
||||
/****************************************************************************
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
|
||||
#define ifreq lifreq /* Replace ifreq with lifreq */
|
||||
#define ifr_name lifr_name /* Network device name */
|
||||
#define ifr_addr lifr_ifru.lifru_addr /* IP address */
|
||||
#define ifr_dstaddr lifr_ifru.lifru_dstaddr /* P-to-P Address */
|
||||
#define ifr_broadaddr lifr_ifru.lifru_broadaddr /* Broadcast address */
|
||||
#define ifr_netmask lifr_ifru.lifru_netmask /* Interface net mask */
|
||||
#define ifr_hwaddr lifr_ifru.lifru_hwaddr /* MAC address */
|
||||
#define ifr_mtu lifr_ifru.lifru_mtu /* MTU */
|
||||
#define ifr_count lifr_ifru.lifru_count /* Number of devices */
|
||||
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/*******************************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
*******************************************************************************************/
|
||||
|
||||
#endif /* __NET_IF_H */
|
||||
|
@ -63,26 +63,26 @@
|
||||
|
||||
struct nfs_args
|
||||
{
|
||||
uint8_t version; /* Args structure version number */
|
||||
uint8_t addrlen; /* Length of address */
|
||||
uint8_t sotype; /* Socket type */
|
||||
uint8_t proto; /* and Protocol */
|
||||
int flags; /* Flags */
|
||||
int wsize; /* Write size in bytes */
|
||||
int rsize; /* Read size in bytes */
|
||||
int readdirsize; /* readdir size in bytes */
|
||||
int timeo; /* Initial timeout in .1 secs */
|
||||
int retrans; /* Times to retry send */
|
||||
//int maxgrouplist; /* Max. size of group list */
|
||||
//int readahead; /* # of blocks to readahead */
|
||||
//int leaseterm; /* Term (sec) of lease */
|
||||
//int deadthresh; /* Retrans threshold */
|
||||
char *path; /* Server's path of the directory being mount */
|
||||
int acregmin; /* Cache attrs for reg files min time */
|
||||
int acregmax; /* Cache attrs for reg files max time */
|
||||
int acdirmin; /* Cache attrs for dirs min time */
|
||||
int acdirmax; /* Cache attrs for dirs max time */
|
||||
struct sockaddr addr; /* File server address (requires 32-bit alignment) */
|
||||
uint8_t version; /* Args structure version number */
|
||||
uint8_t addrlen; /* Length of address */
|
||||
uint8_t sotype; /* Socket type */
|
||||
uint8_t proto; /* and Protocol */
|
||||
int flags; /* Flags */
|
||||
int wsize; /* Write size in bytes */
|
||||
int rsize; /* Read size in bytes */
|
||||
int readdirsize; /* readdir size in bytes */
|
||||
int timeo; /* Initial timeout in .1 secs */
|
||||
int retrans; /* Times to retry send */
|
||||
//int maxgrouplist; /* Max. size of group list */
|
||||
//int readahead; /* # of blocks to readahead */
|
||||
//int leaseterm; /* Term (sec) of lease */
|
||||
//int deadthresh; /* Retrans threshold */
|
||||
char *path; /* Server's path of the directory being mount */
|
||||
int acregmin; /* Cache attrs for reg files min time */
|
||||
int acregmax; /* Cache attrs for reg files max time */
|
||||
int acdirmin; /* Cache attrs for dirs min time */
|
||||
int acdirmax; /* Cache attrs for dirs max time */
|
||||
struct sockaddr_storage addr; /* File server address (requires 32-bit alignment) */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -71,6 +71,20 @@
|
||||
#define SIOCGIPMSFILTER _SIOC(0x000e) /* Retrieve source filter addresses */
|
||||
#define SIOCSIPMSFILTER _SIOC(0x000f) /* Set source filter content */
|
||||
|
||||
/* Newer interface ioctls that use the struct lifreq. Can be used for
|
||||
* both IPv4 and IPv6.
|
||||
*/
|
||||
|
||||
#define SIOCGLIFADDR SIOCGIFADDR /* Get IP address */
|
||||
#define SIOCSLIFADDR SIOCSIFADDR /* Set IP address */
|
||||
#define SIOCGLIFDSTADDR SIOCSIFDSTADDR /* Get P-to-P address */
|
||||
#define SIOCSLIFDSTADDR SIOCSIFDSTADDR /* Set P-to-P address */
|
||||
#define SIOCGLIFBRDADDR SIOCGIFBRDADDR /* Get broadcast IP address */
|
||||
#define SIOCSLIFBRDADDR SIOCSIFBRDADDR /* Set broadcast IP address */
|
||||
#define SIOCGLIFNETMASK SIOCGIFNETMASK /* Get network mask */
|
||||
#define SIOCSLIFNETMASK SIOCSIFNETMASK /* Set network mask */
|
||||
#define SIOCGLIFMTU SIOCGIFMTU /* Get MTU size */
|
||||
|
||||
/* Wireless ioctl commands **************************************************/
|
||||
|
||||
#define SIOCSIWCOMMIT _SIOC(0x0010) /* Commit pending changes to driver */
|
||||
|
@ -109,7 +109,7 @@ FAR const char *inet_ntop(int af, FAR const void *src, FAR char *dst, socklen_t
|
||||
sprintf(dst, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
return dst;
|
||||
#else
|
||||
FAR const in6_addr *in6_addr;
|
||||
FAR const struct in6_addr *in6_addr;
|
||||
uint16_t warray[8];
|
||||
int offset;
|
||||
int entry;
|
||||
@ -131,7 +131,7 @@ FAR const char *inet_ntop(int af, FAR const void *src, FAR char *dst, socklen_t
|
||||
goto errout;
|
||||
}
|
||||
|
||||
in6_addr = (FAR const in6_addr *)src;
|
||||
in6_addr = (FAR const struct in6_addr *)src;
|
||||
entry = -1;
|
||||
maxentry = -1;
|
||||
maxcount = 0;
|
||||
|
@ -273,14 +273,14 @@ int inet_pton(int af, FAR const char *src, FAR void *dst)
|
||||
|
||||
if (!rtime)
|
||||
{
|
||||
ip[(nsep << 1) + 0] = (uint8_t)(value >> 8)) & 0xff;
|
||||
ip[(nsep << 1) + 1] = (uint8_t)(value >> 0)) & 0xff;
|
||||
ip[(nsep << 1) + 0] = (uint8_t)((value >> 8) & 0xff);
|
||||
ip[(nsep << 1) + 1] = (uint8_t)((value >> 0) & 0xff);
|
||||
nsep++;
|
||||
}
|
||||
else
|
||||
{
|
||||
rip[(nrsep << 1) + 0] = (uint8_t)(value >> 8)) & 0xff;
|
||||
rip[(nrsep << 1) + 1] = (uint8_t)(value >> 0)) & 0xff;
|
||||
rip[(nrsep << 1) + 0] = (uint8_t)((value >> 8) & 0xff);
|
||||
rip[(nrsep << 1) + 1] = (uint8_t)((value >> 0) & 0xff);
|
||||
nrsep++;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ static inline void accept_tcpsender(FAR struct uip_conn *conn,
|
||||
{
|
||||
addr->sin_family = AF_INET6;
|
||||
addr->sin_port = conn->rport;
|
||||
uip_ipaddr_copy(addr->sin_addr.s_addr, conn->ripaddr);
|
||||
uip_ipaddr_copy(addr->sin6_addr.s6_addr, conn->ripaddr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/net/net.h>
|
||||
@ -194,7 +195,6 @@ int getsockname(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
|
||||
|
||||
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_UDP)
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
#error "Not big enough for IPv6 address"
|
||||
outaddr->sin_family = AF_INET6;
|
||||
memcpy(outaddr->sin6_addr.in6_u.u6_addr8, dev->d_ipaddr, 16);
|
||||
*addrlen = sizeof(struct sockaddr_in6);
|
||||
|
@ -81,6 +81,7 @@ static inline bool netdev_maskcmp(const uip_ipaddr_t *ipaddr,
|
||||
return (*ipaddr & *netmask) == (*raddr & *netmask);
|
||||
#else
|
||||
# warning "Not implemented for IPv6"
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,6 @@
|
||||
static void ioctl_getipaddr(struct sockaddr *outaddr, uip_ipaddr_t *inaddr)
|
||||
{
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
#error "Not big enough for IPv6 address"
|
||||
struct sockaddr_in6 *dest = (struct sockaddr_in6 *)outaddr;
|
||||
dest->sin_family = AF_INET6;
|
||||
dest->sin_port = 0;
|
||||
|
@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* net/netdev_txnotify.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -429,7 +429,7 @@ static inline void recvfrom_tcpsender(struct uip_driver_s *dev, struct recvfrom_
|
||||
infrom->sin_port = TCPBUF->srcport;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uip_ipaddr_copy(infrom->sin_addr.s_addr, TCPBUF->srcipaddr);
|
||||
uip_ipaddr_copy(infrom->sin6_addr.s6_addr, TCPBUF->srcipaddr);
|
||||
#else
|
||||
uip_ipaddr_copy(infrom->sin_addr.s_addr, uip_ip4addr_conv(TCPBUF->srcipaddr));
|
||||
#endif
|
||||
@ -626,7 +626,7 @@ static inline void recvfrom_udpsender(struct uip_driver_s *dev, struct recvfrom_
|
||||
infrom->sin_port = UDPBUF->srcport;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
uip_ipaddr_copy(infrom->sin_addr.s_addr, UDPBUF->srcipaddr);
|
||||
uip_ipaddr_copy(infrom->sin6_addr.s6_addr, UDPBUF->srcipaddr);
|
||||
#else
|
||||
uip_ipaddr_copy(infrom->sin_addr.s_addr, uip_ip4addr_conv(UDPBUF->srcipaddr));
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user