VirtualBox

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

Last change on this file since 67954 was 63005, checked in by vboxsync, 8 years ago

lwip,nat: Try figure LWIP_NOASSERT in the two lwipopts.h files, linking it to VBOX_ASSERT.

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