1 | /* $Id: lwipopts.h 70836 2018-01-31 14:55:44Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DHCP server - lwIP configuration options.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2017 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_DHCPD_LWIP_OPTS_H_
|
---|
19 | #define _VBOX_DHCPD_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 | /** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
|
---|
28 | * memory allocation functions. */
|
---|
29 | #define MEM_LIBC_MALLOC 1
|
---|
30 |
|
---|
31 | /** Set proper memory alignment. */
|
---|
32 | #if HC_ARCH_BITS == 64
|
---|
33 | # define MEM_ALIGNMENT 8
|
---|
34 | #else
|
---|
35 | #define MEM_ALIGNMENT 4
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /* Padding before Ethernet header to make IP header aligned */
|
---|
39 | #define ETH_PAD_SIZE 2
|
---|
40 |
|
---|
41 | /* IP */
|
---|
42 | #define IP_REASSEMBLY 1
|
---|
43 | #define IP_REASS_MAX_PBUFS 128
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
---|
48 | sends a lot of data out of ROM (or other static memory), this
|
---|
49 | should be set high.
|
---|
50 |
|
---|
51 | NB: This is for PBUF_ROM and PBUF_REF pbufs only!
|
---|
52 |
|
---|
53 | Number of PBUF_POOL pbufs is controlled by PBUF_POOL_SIZE that,
|
---|
54 | somewhat confusingly, breaks MEMP_NUM_* pattern.
|
---|
55 |
|
---|
56 | PBUF_RAM pbufs are allocated with mem_malloc (with MEM_LIBC_MALLOC
|
---|
57 | set to 1 this is just system malloc), not memp_malloc. */
|
---|
58 | #define MEMP_NUM_PBUF (1024 * 4)
|
---|
59 |
|
---|
60 |
|
---|
61 | /* MEMP_NUM_MLD6_GROUP: Maximum number of IPv6 multicast groups that
|
---|
62 | can be joined.
|
---|
63 |
|
---|
64 | We need to be able to join solicited node multicast for each
|
---|
65 | address (potentially different) and two groups for DHCP6. All
|
---|
66 | routers multicast is hardcoded in ip6.c and does not require
|
---|
67 | explicit joining. Provide also for a few extra groups just in
|
---|
68 | case. */
|
---|
69 | #define MEMP_NUM_MLD6_GROUP (LWIP_IPV6_NUM_ADDRESSES + /* dhcp6 */ 2 + /* extra */ 8)
|
---|
70 |
|
---|
71 |
|
---|
72 | /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
|
---|
73 | for sequential API communication and incoming packets. Used in
|
---|
74 | src/api/tcpip.c. */
|
---|
75 | #define MEMP_NUM_TCPIP_MSG_API 128
|
---|
76 | #define MEMP_NUM_TCPIP_MSG_INPKT 1024
|
---|
77 |
|
---|
78 | /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
---|
79 | per active UDP "connection". */
|
---|
80 | #define MEMP_NUM_UDP_PCB 32
|
---|
81 |
|
---|
82 | /* Pbuf options */
|
---|
83 | /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
|
---|
84 | This is only for PBUF_POOL pbufs, primarily used by netif drivers.
|
---|
85 |
|
---|
86 | This should have been named with the MEMP_NUM_ prefix (cf.
|
---|
87 | MEMP_NUM_PBUF for PBUF_ROM and PBUF_REF) as it controls the size of
|
---|
88 | yet another memp_malloc() pool. */
|
---|
89 | #define PBUF_POOL_SIZE (1024 * 4)
|
---|
90 |
|
---|
91 | /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
|
---|
92 | Use default that is based on TCP_MSS and PBUF_LINK_HLEN. */
|
---|
93 | #undef PBUF_POOL_BUFSIZE
|
---|
94 |
|
---|
95 | /** Turn on support for lightweight critical region protection. Leaving this
|
---|
96 | * off uses synchronization code in pbuf.c which is totally polluted with
|
---|
97 | * races. All the other lwip source files would fall back to semaphore-based
|
---|
98 | * synchronization, but pbuf.c is just broken, leading to incorrect allocation
|
---|
99 | * and as a result to assertions due to buffers being double freed. */
|
---|
100 | #define SYS_LIGHTWEIGHT_PROT 1
|
---|
101 |
|
---|
102 | /** Attempt to get rid of htons etc. macro issues. */
|
---|
103 | #undef LWIP_PREFIX_BYTEORDER_FUNCS
|
---|
104 |
|
---|
105 | #define LWIP_TCPIP_CORE_LOCKING_INPUT 0
|
---|
106 | #define LWIP_TCPIP_CORE_LOCKING 0
|
---|
107 |
|
---|
108 | #define LWIP_NETCONN 0
|
---|
109 | #define LWIP_SOCKET 0
|
---|
110 | #define LWIP_COMPAT_SOCKETS 0
|
---|
111 | #define LWIP_COMPAT_MUTEX 1
|
---|
112 |
|
---|
113 | #define LWIP_TCP 0
|
---|
114 | #define LWI_UDP 1
|
---|
115 | #define LWIP_ARP 1
|
---|
116 | #define ARP_PROXY 0
|
---|
117 | #define LWIP_ETHERNET 1
|
---|
118 |
|
---|
119 | /* accept any->broadcast */
|
---|
120 | #define LWIP_IP_ACCEPT_UDP_PORT(port) ((port) == PP_NTOHS(/*DHCP_SERVER_PORT*/ 67))
|
---|
121 |
|
---|
122 | #define LWIP_IPV6 0
|
---|
123 | #define LWIP_IPV6_FORWARD 0
|
---|
124 | #define LWIP_ND6_PROXY 0
|
---|
125 |
|
---|
126 | #define LWIP_ND6_ALLOW_RA_UPDATES (!LWIP_IPV6_FORWARD)
|
---|
127 | #define LWIP_IPV6_SEND_ROUTER_SOLICIT (!LWIP_IPV6_FORWARD)
|
---|
128 | /* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
|
---|
129 | * iSCSI over intnet with IPv6
|
---|
130 | */
|
---|
131 | #define LWIP_IPV6_AUTOCONFIG 1
|
---|
132 | #if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
|
---|
133 | #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | #define LWIP_IPV6_FRAG 1
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * aka Slirp mode.
|
---|
140 | */
|
---|
141 | #define LWIP_CONNECTION_PROXY 0
|
---|
142 | #define IP_FORWARD 0
|
---|
143 |
|
---|
144 | /* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
|
---|
145 | timeouts. */
|
---|
146 | #define MEMP_NUM_SYS_TIMEOUT 16
|
---|
147 |
|
---|
148 |
|
---|
149 | /* this is required for IPv6 and IGMP needs */
|
---|
150 | #define LWIP_RAND() RTRandU32()
|
---|
151 |
|
---|
152 | /* Debugging stuff. */
|
---|
153 | #ifdef DEBUG
|
---|
154 | # define LWIP_DEBUG
|
---|
155 | # include "lwip-log.h"
|
---|
156 |
|
---|
157 | # define LWIP_PROXY_DEBUG LWIP_DBG_OFF
|
---|
158 | #endif /* DEBUG */
|
---|
159 |
|
---|
160 | /* printf formatter definitions */
|
---|
161 | #define U16_F "hu"
|
---|
162 | #define S16_F "hd"
|
---|
163 | #define X16_F "hx"
|
---|
164 | #define U32_F "u"
|
---|
165 | #define S32_F "d"
|
---|
166 | #define X32_F "x"
|
---|
167 |
|
---|
168 | /* Redirect libc memory alloc functions to IPRT. */
|
---|
169 | #define malloc(x) RTMemAlloc(x)
|
---|
170 | #define realloc(x,y) RTMemRealloc((x), (y))
|
---|
171 | #define free(x) RTMemFree(x)
|
---|
172 |
|
---|
173 | /* Align VBOX_STRICT and LWIP_NOASSERT. */
|
---|
174 | #ifndef VBOX_STRICT
|
---|
175 | # define LWIP_NOASSERT 1
|
---|
176 | #endif
|
---|
177 |
|
---|
178 | #endif /* _VBOX_DHCPD_LWIP_OPTS_H_ */
|
---|