1
0
Fork 0
forked from nuttx/nuttx-update

Socket I/F: Misc. fixes for compile errors/warnings going back to dual IPv4+IPv6 configuration.

This commit is contained in:
Gregory Nutt 2017-07-14 15:52:37 -06:00
parent 24dd6d2905
commit 6537e4ea20
3 changed files with 9 additions and 13 deletions

View file

@ -49,6 +49,7 @@
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include "netdev/netdev.h"
#include "socket/socket.h"
#ifdef CONFIG_NET_IPv4
@ -80,9 +81,7 @@
int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
FAR socklen_t *addrlen)
{
#if defined(NET_TCP_HAVE_STACK) || defined(NET_UDP_HAVE_STACK)
FAR struct sockaddr_in *outaddr = (FAR struct sockaddr_in *)addr;
#endif
FAR struct net_driver_s *dev;
#ifdef CONFIG_NETDEV_MULTINIC
in_addr_t lipaddr;

View file

@ -49,6 +49,7 @@
#include <nuttx/net/net.h>
#include <nuttx/net/netdev.h>
#include "netdev/netdev.h"
#include "socket/socket.h"
#ifdef CONFIG_NET_IPv6
@ -80,9 +81,7 @@
int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
FAR socklen_t *addrlen)
{
#if defined(NET_TCP_HAVE_STACK) || defined(NET_UDP_HAVE_STACK)
FAR struct sockaddr_in6 *outaddr = (FAR struct sockaddr_in6 *)addr;
#endif
FAR struct net_driver_s *dev;
#ifdef CONFIG_NETDEV_MULTINIC
net_ipv6addr_t *lipaddr;
@ -145,11 +144,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
if (net_ipv6addr_cmp(lipaddr, g_ipv6_allzeroaddr))
{
#if defined(NET_TCP_HAVE_STACK) || defined(NET_UDP_HAVE_STACK)
outaddr->sin6_family = AF_INET6;
memcpy(outaddr->sin6_addr.in6_u.u6_addr8, g_ipv6_allzeroaddr, 16);
*addrlen = sizeof(struct sockaddr_in6);
#endif
return OK;
}
#endif
@ -182,11 +180,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
/* Set the address family and the IP address */
#if defined(NET_TCP_HAVE_STACK) || defined(NET_UDP_HAVE_STACK)
outaddr->sin6_family = AF_INET6;
memcpy(outaddr->sin6_addr.in6_u.u6_addr8, dev->d_ipv6addr, 16);
*addrlen = sizeof(struct sockaddr_in6);
#endif
net_unlock();
/* Return success */

View file

@ -175,7 +175,7 @@ EXTERN const struct sock_intf_s g_inet_sockif;
* Public Function Prototypes
****************************************************************************/
#ifdef NET_TCP_HAVE_STACK
#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK)
struct tcp_conn_s; /* Forward reference */
#endif
@ -283,7 +283,7 @@ FAR const struct sock_intf_s *net_sockif(sa_family_t family);
*
****************************************************************************/
#ifdef NET_TCP_HAVE_STACK
#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK)
int net_startmonitor(FAR struct socket *psock);
#endif
@ -305,7 +305,7 @@ int net_startmonitor(FAR struct socket *psock);
*
****************************************************************************/
#ifdef NET_TCP_HAVE_STACK
#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK)
void net_stopmonitor(FAR struct tcp_conn_s *conn);
#endif
@ -327,7 +327,7 @@ void net_stopmonitor(FAR struct tcp_conn_s *conn);
*
****************************************************************************/
#ifdef NET_TCP_HAVE_STACK
#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK)
void net_lostconnection(FAR struct socket *psock, uint16_t flags);
#endif
@ -539,7 +539,7 @@ int inet_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
****************************************************************************/
#if defined(CONFIG_NET_SENDFILE) && defined(CONFIG_NET_TCP) && \
defined(NET_TCP_HAVE_STACK)
!defined(CONFIG_NET_TCP_NO_STACK)
ssize_t inet_sendfile(FAR struct socket *psock, FAR struct file *infile,
FAR off_t *offset, size_t count);
#endif