VirtualBox

source: vbox/trunk/src/VBox/NetworkServices/Dhcpd/lwipopts.h@ 103795

Last change on this file since 103795 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

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