diff --git a/include/nuttx/net/netconfig.h b/include/nuttx/net/netconfig.h index 5c42c4fe27..806703971d 100644 --- a/include/nuttx/net/netconfig.h +++ b/include/nuttx/net/netconfig.h @@ -64,6 +64,18 @@ * NET_SOCK_PROTOCOL); */ +/* The TCP/UDP stack, which is used for determining HAVE_PFINET(6)_SOCKETS */ + +#undef NET_TCP_HAVE_STACK +#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK) +# define NET_TCP_HAVE_STACK 1 +#endif + +#undef NET_UDP_HAVE_STACK +#if defined(CONFIG_NET_UDP) && !defined(CONFIG_NET_UDP_NO_STACK) +# define NET_UDP_HAVE_STACK 1 +#endif + /* The address family that we used to create the socket really does not * matter. It should, however, be valid in the current configuration. */ diff --git a/net/procfs/net_procfs.c b/net/procfs/net_procfs.c index ade2c74653..bd670961c6 100644 --- a/net/procfs/net_procfs.c +++ b/net/procfs/net_procfs.c @@ -122,7 +122,7 @@ static const struct netprocfs_entry_s g_net_entries[] = } }, # endif -# if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK) +# ifdef NET_TCP_HAVE_STACK { DTYPE_FILE, "tcp", { @@ -130,7 +130,7 @@ static const struct netprocfs_entry_s g_net_entries[] = } }, # endif -# if defined(CONFIG_NET_UDP) && !defined(CONFIG_NET_UDP_NO_STACK) +# ifdef NET_UDP_HAVE_STACK { DTYPE_FILE, "udp", { diff --git a/net/procfs/net_udp.c b/net/procfs/net_udp.c index fa7e7e4a3a..ebff83e3a8 100644 --- a/net/procfs/net_udp.c +++ b/net/procfs/net_udp.c @@ -188,4 +188,4 @@ ssize_t netprocfs_read_udpstats(FAR struct netprocfs_file_s *priv, return len; } -#endif /* CONFIG_NET_UDP && !CONFIG_NET_UDP_NO_STACK */ +#endif /* NET_UDP_HAVE_STACK */ diff --git a/net/procfs/procfs.h b/net/procfs/procfs.h index a1aac5e2e0..9400679b7c 100644 --- a/net/procfs/procfs.h +++ b/net/procfs/procfs.h @@ -30,6 +30,7 @@ #include #include #include +#include #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_NET) @@ -184,7 +185,7 @@ ssize_t netprocfs_read_mldstats(FAR struct netprocfs_file_s *priv, * ****************************************************************************/ -#if defined(CONFIG_NET_TCP) && !defined(CONFIG_NET_TCP_NO_STACK) +#ifdef NET_TCP_HAVE_STACK ssize_t netprocfs_read_tcpstats(FAR struct netprocfs_file_s *priv, FAR char *buffer, size_t buflen); #endif @@ -207,7 +208,7 @@ ssize_t netprocfs_read_tcpstats(FAR struct netprocfs_file_s *priv, * ****************************************************************************/ -#if defined(CONFIG_NET_UDP) && !defined(CONFIG_NET_UDP_NO_STACK) +#ifdef NET_UDP_HAVE_STACK ssize_t netprocfs_read_udpstats(FAR struct netprocfs_file_s *priv, FAR char *buffer, size_t buflen); #endif diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 9926125078..14dcdeee3a 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -40,7 +40,7 @@ #include #include -#ifdef CONFIG_NET_TCP +#ifdef NET_TCP_HAVE_STACK /**************************************************************************** * Pre-processor Definitions @@ -51,10 +51,6 @@ #define TCPIPv4BUF ((FAR struct tcp_hdr_s *)IPBUF(IPv4_HDRLEN)) #define TCPIPv6BUF ((FAR struct tcp_hdr_s *)IPBUF(IPv6_HDRLEN)) -#ifndef CONFIG_NET_TCP_NO_STACK - -#define NET_TCP_HAVE_STACK 1 - /* Allocate a new TCP data callback */ /* These macros allocate and free callback structures used for receiving @@ -2354,6 +2350,5 @@ void tcp_cc_recv_ack(FAR struct tcp_conn_s *conn, FAR struct tcp_hdr_s *tcp); void tcp_set_zero_probe(FAR struct tcp_conn_s *conn, uint16_t flags); -#endif /* !CONFIG_NET_TCP_NO_STACK */ -#endif /* CONFIG_NET_TCP */ +#endif /* NET_TCP_HAVE_STACK */ #endif /* __NET_TCP_TCP_H */ diff --git a/net/udp/udp.h b/net/udp/udp.h index de28a43fc3..ab2f076434 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -43,14 +43,12 @@ # include #endif -#if defined(CONFIG_NET_UDP) && !defined(CONFIG_NET_UDP_NO_STACK) +#ifdef NET_UDP_HAVE_STACK /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -#define NET_UDP_HAVE_STACK 1 - #ifdef CONFIG_NET_UDP_WRITE_BUFFERS /* UDP write buffer dump macros */ @@ -1046,5 +1044,5 @@ uint16_t udpip_hdrsize(FAR struct udp_conn_s *conn); } #endif -#endif /* CONFIG_NET_UDP && !CONFIG_NET_UDP_NO_STACK */ +#endif /* NET_UDP_HAVE_STACK */ #endif /* __NET_UDP_UDP_H */