VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/NAT/lwipopts.h

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.5 KB
Line 
1/* $Id: lwipopts.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * NAT Network - lwIP configuration options.
4 */
5
6/*
7 * Copyright (C) 2013-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef VBOX_INCLUDED_SRC_NAT_lwipopts_h
29#define VBOX_INCLUDED_SRC_NAT_lwipopts_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/cdefs.h> /* For VBOX_STRICT. */
35#include <iprt/mem.h>
36#include <iprt/alloca.h> /* This may include malloc.h (msc), which is something that has
37 * to be done before redefining any of the functions therein. */
38#include <iprt/rand.h> /* see LWIP_RAND() definition */
39
40/* lwip/sockets.h assumes that if FD_SET is defined (in case of Innotek GCC
41 * its definition is dragged through iprt/types.h) then struct timeval is
42 * defined as well, but it's not the case. So include it manually. */
43#ifdef RT_OS_OS2
44# include <sys/time.h>
45#endif
46
47/** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
48 * memory allocation functions. */
49#define MEM_LIBC_MALLOC 1
50
51/** Set proper memory alignment. */
52#if HC_ARCH_BITS == 64
53# define MEM_ALIGNMENT 8
54#else
55#define MEM_ALIGNMENT 4
56#endif
57
58/* Padding before Ethernet header to make IP header aligned */
59#define ETH_PAD_SIZE 2
60
61/* IP */
62#define IP_REASSEMBLY 1
63#define IP_REASS_MAX_PBUFS 128
64
65
66
67/** Increase maximum TCP window size. */
68#define TCP_WND 32768
69
70/** Increase TCP maximum segment size. */
71#define TCP_MSS 1460
72
73/** Enable queueing of out-of-order segments. */
74#define TCP_QUEUE_OOSEQ 1
75
76/** TCP sender buffer space (bytes). */
77#define TCP_SND_BUF (32 * TCP_MSS)
78
79/* TCP sender buffer space (pbufs). This must be at least = 2 *
80 TCP_SND_BUF/TCP_MSS for things to work. */
81#define TCP_SND_QUEUELEN 128
82
83/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
84 sends a lot of data out of ROM (or other static memory), this
85 should be set high.
86
87 NB: This is for PBUF_ROM and PBUF_REF pbufs only!
88
89 Number of PBUF_POOL pbufs is controlled by PBUF_POOL_SIZE that,
90 somewhat confusingly, breaks MEMP_NUM_* pattern.
91
92 PBUF_RAM pbufs are allocated with mem_malloc (with MEM_LIBC_MALLOC
93 set to 1 this is just system malloc), not memp_malloc. */
94#define MEMP_NUM_PBUF (1024 * 4)
95
96
97/* MEMP_NUM_MLD6_GROUP: Maximum number of IPv6 multicast groups that
98 can be joined.
99
100 We need to be able to join solicited node multicast for each
101 address (potentially different) and two groups for DHCP6. All
102 routers multicast is hardcoded in ip6.c and does not require
103 explicit joining. Provide also for a few extra groups just in
104 case. */
105#define MEMP_NUM_MLD6_GROUP (LWIP_IPV6_NUM_ADDRESSES + /* dhcp6 */ 2 + /* extra */ 8)
106
107
108/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
109 segments. */
110#define MEMP_NUM_TCP_SEG (MEMP_NUM_TCP_PCB * TCP_SND_QUEUELEN / 2)
111
112/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
113 connections. */
114#define MEMP_NUM_TCP_PCB 128
115
116/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
117 for sequential API communication and incoming packets. Used in
118 src/api/tcpip.c. */
119#define MEMP_NUM_TCPIP_MSG_API 128
120#define MEMP_NUM_TCPIP_MSG_INPKT 1024
121
122/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
123 per active UDP "connection". */
124#define MEMP_NUM_UDP_PCB 32
125
126/* Pbuf options */
127/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
128 This is only for PBUF_POOL pbufs, primarily used by netif drivers.
129
130 This should have been named with the MEMP_NUM_ prefix (cf.
131 MEMP_NUM_PBUF for PBUF_ROM and PBUF_REF) as it controls the size of
132 yet another memp_malloc() pool. */
133#define PBUF_POOL_SIZE (1024 * 4)
134
135/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
136 Use default that is based on TCP_MSS and PBUF_LINK_HLEN. */
137#undef PBUF_POOL_BUFSIZE
138
139/** Turn on support for lightweight critical region protection. Leaving this
140 * off uses synchronization code in pbuf.c which is totally polluted with
141 * races. All the other lwip source files would fall back to semaphore-based
142 * synchronization, but pbuf.c is just broken, leading to incorrect allocation
143 * and as a result to assertions due to buffers being double freed. */
144#define SYS_LIGHTWEIGHT_PROT 1
145
146/** Attempt to get rid of htons etc. macro issues. */
147#undef LWIP_PREFIX_BYTEORDER_FUNCS
148
149#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
150#define LWIP_TCPIP_CORE_LOCKING 0
151#define LWIP_TCP 1
152#define LWIP_SOCKET 0
153#define LWIP_ARP 1
154#define ARP_PROXY 1
155#define LWIP_ETHERNET 1
156#define LWIP_COMPAT_SOCKETS 0
157#define LWIP_COMPAT_MUTEX 1
158
159#define LWIP_IPV6 1
160#define LWIP_IPV6_FORWARD 1
161#define LWIP_ND6_PROXY 1
162
163#define LWIP_ND6_ALLOW_RA_UPDATES (!LWIP_IPV6_FORWARD)
164#define LWIP_IPV6_SEND_ROUTER_SOLICIT (!LWIP_IPV6_FORWARD)
165/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
166 * iSCSI over intnet with IPv6
167 */
168#define LWIP_IPV6_AUTOCONFIG 1
169#if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
170#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
171#endif
172
173#define LWIP_IPV6_FRAG 1
174
175/**
176 * aka Slirp mode.
177 */
178#define LWIP_CONNECTION_PROXY 1
179#define IP_FORWARD 1
180
181/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
182 timeouts. */
183#define MEMP_NUM_SYS_TIMEOUT 16
184
185
186/* this is required for IPv6 and IGMP needs */
187#define LWIP_RAND() RTRandU32()
188
189/* Debugging stuff. */
190#ifdef DEBUG
191# define LWIP_DEBUG
192# include "lwip-log.h"
193
194# define LWIP_PROXY_DEBUG LWIP_DBG_OFF
195#endif /* DEBUG */
196
197/* printf formatter definitions */
198#define U16_F "hu"
199#define S16_F "hd"
200#define X16_F "hx"
201#define U32_F "u"
202#define S32_F "d"
203#define X32_F "x"
204
205/* Redirect libc memory alloc functions to IPRT. */
206#define malloc(x) RTMemAlloc(x)
207#define realloc(x,y) RTMemRealloc((x), (y))
208#define free(x) RTMemFree(x)
209
210/* Align VBOX_STRICT and LWIP_NOASSERT. */
211#ifndef VBOX_STRICT
212# define LWIP_NOASSERT 1
213#endif
214
215#endif /* !VBOX_INCLUDED_SRC_NAT_lwipopts_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette