VirtualBox

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

Last change on this file since 78271 was 77022, checked in by vboxsync, 6 years ago

NAT/Net: pxdns_timeout_add - call sys_untimeout() before scheduling a
new one, we might still have one pending even if there's nothing for
it to do. Scale back the number of timers temporarily bumped as a
work around.

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