net: inet.h match inet_sockif.c definition

Fixes psock_socket: ERROR: socket address family unsupported: 2
When using the minimal CONFIG_NET configuration typically used for
SocketCAN

Update net/inet/inet.h

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update net/inet/inet.h

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
This commit is contained in:
Peter van der Perk 2024-11-04 11:50:43 +01:00 committed by Xiang Xiao
parent 3c4053a385
commit c371afc7f4
5 changed files with 11 additions and 6 deletions

View file

@ -2,7 +2,8 @@
* include/nuttx/net/netconfig.h
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: 2007, 2011, 2014-2015, 2017-2019 Gregory Nutt. All rights reserved.
* SPDX-FileCopyrightText: 2007, 2011, 2014-2015, 2017-2019 Gregory Nutt.
* All rights reserved.
* SPDX-FileCopyrightText: 2001-2003, Adam Dunkels. All rights reserved.
* SPDX-FileContributor: Gregory Nutt <gnutt@nuttx.org>
* SPDX-FileContributor: Adam Dunkels <adam@dunkels.com>
@ -67,9 +68,9 @@
* matter. It should, however, be valid in the current configuration.
*/
#if defined(CONFIG_NET_IPv4)
#if defined(HAVE_PFINET_SOCKETS)
# define NET_SOCK_FAMILY AF_INET
#elif defined(CONFIG_NET_IPv6)
#elif defined(HAVE_PFINET6_SOCKETS)
# define NET_SOCK_FAMILY AF_INET6
#elif defined(CONFIG_NET_LOCAL)
# define NET_SOCK_FAMILY AF_LOCAL

View file

@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <nuttx/net/netconfig.h>
/****************************************************************************

View file

@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <nuttx/net/netconfig.h>
/****************************************************************************

View file

@ -47,11 +47,13 @@
#if defined(CONFIG_NET_IPv4) || defined(CONFIG_NET_IPv6)
# define HAVE_INET_SOCKETS
# if defined(CONFIG_NET_IPv4)
# if (defined(CONFIG_NET_IPv4) && (defined(NET_UDP_HAVE_STACK) || \
defined(NET_TCP_HAVE_STACK))) || defined(CONFIG_NET_ICMP_SOCKET)
# define HAVE_PFINET_SOCKETS
# endif
# if defined(CONFIG_NET_IPv6)
# if (defined(CONFIG_NET_IPv6) && (defined(NET_UDP_HAVE_STACK) || \
defined(NET_TCP_HAVE_STACK))) || defined(CONFIG_NET_ICMPv6_SOCKET)
# define HAVE_PFINET6_SOCKETS
# endif
#endif

View file

@ -76,7 +76,7 @@ net_sockif(sa_family_t family, int type, int protocol)
switch (family)
{
#ifdef HAVE_INET_SOCKETS
#if defined(HAVE_PFINET_SOCKETS) || defined(HAVE_PFINET6_SOCKETS)
# ifdef HAVE_PFINET_SOCKETS
case PF_INET:
# endif