1 | # $Id: Makefile.kmk 98417 2023-02-01 16:25:48Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Sub-makefile for NAT Networking
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-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 | SUB_DEPTH = ../../../..
|
---|
29 | include $(KBUILD_PATH)/subheader.kmk
|
---|
30 | ifdef VBOX_WITH_LWIP_NAT # entire file
|
---|
31 |
|
---|
32 | ifndef LWIP_SOURCES
|
---|
33 | include $(PATH_SUB_CURRENT)/../../Devices/Network/lwip-new/Config.kmk
|
---|
34 | endif
|
---|
35 |
|
---|
36 | #
|
---|
37 | # Globals
|
---|
38 | #
|
---|
39 | VBOX_PATH_NAT_SRC := $(PATH_SUB_CURRENT)
|
---|
40 |
|
---|
41 |
|
---|
42 | #
|
---|
43 | # Hardened stub exe for VBoxNetNAT.
|
---|
44 | #
|
---|
45 | ifdef VBOX_WITH_HARDENING
|
---|
46 | PROGRAMS += VBoxNetNATHardened
|
---|
47 | VBoxNetNATHardened_TEMPLATE = VBoxR3HardenedExe
|
---|
48 | VBoxNetNATHardened_NAME = VBoxNetNAT
|
---|
49 | ifdef VBOX_WITH_AUTOMATIC_DEFS_QUOTING
|
---|
50 | VBoxNetNATHardened_DEFS = SERVICE_NAME="VBoxNetNAT"
|
---|
51 | else
|
---|
52 | VBoxNetNATHardened_DEFS = SERVICE_NAME=\"VBoxNetNAT\"
|
---|
53 | endif
|
---|
54 | VBoxNetNATHardened_SOURCES = VBoxNetNATHardened.cpp
|
---|
55 | VBoxNetNATHardened_LDFLAGS.win = /SUBSYSTEM:windows
|
---|
56 | $(call VBOX_SET_VER_INFO_EXE,VBoxNetNATHardened,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
57 | endif
|
---|
58 |
|
---|
59 |
|
---|
60 | #
|
---|
61 | # VBoxNetNAT.
|
---|
62 | #
|
---|
63 | ifdef VBOX_WITH_HARDENING
|
---|
64 | DLLS += VBoxNetNAT
|
---|
65 | else
|
---|
66 | PROGRAMS += VBoxNetNAT
|
---|
67 | endif
|
---|
68 | VBoxNetNAT_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBoxMainDll,VBoxMainClientExe)
|
---|
69 | VBoxNetNAT_NAME := VBoxNetNAT
|
---|
70 | VBoxNetNAT_DEFS = \
|
---|
71 | IPv6 \
|
---|
72 | $(if $(VBOX_WITH_INTNET_SERVICE_IN_R3),VBOX_WITH_INTNET_SERVICE_IN_R3,)
|
---|
73 | # VBoxNetNAT_DEFS.linux = WITH_VALGRIND # instrument lwip memp.c
|
---|
74 | VBoxNetNAT_DEFS.win = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
|
---|
75 | # Convince Solaris headers to expose socket stuff we need.
|
---|
76 | #
|
---|
77 | # Setting _XOPEN_SOURCE to either 500 or 600 would always work, but
|
---|
78 | # <sys/feature_tests.h> insists that 600 requires C99 and so it
|
---|
79 | # explodes for older g++. It also insists that 500 is NOT to be used
|
---|
80 | # with C99.
|
---|
81 | #
|
---|
82 | # Newer g++ in C++11 mode (formerly known as C++0x) needs 600, so it
|
---|
83 | # employs sleight of hand to pretend it's C99 to keep feature test
|
---|
84 | # happy.
|
---|
85 | #
|
---|
86 | # Compile the C code with settings that match g++. This probably
|
---|
87 | # should be centralized so that whole codebase uses consistent
|
---|
88 | # settings.
|
---|
89 | ifeq ($(KBUILD_TARGET),solaris)
|
---|
90 | ifneq ($(VBOX_GCC_VERSION_CXX),)
|
---|
91 | if $(VBOX_GCC_VERSION_CXX) >= 40600
|
---|
92 | # we compile C++ code with -std=c++0x / -std=c++11
|
---|
93 | VBoxNetNAT_CFLAGS.solaris += -std=c99
|
---|
94 | VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=600
|
---|
95 | else
|
---|
96 | VBoxNetNAT_DEFS.solaris += _XOPEN_SOURCE=500
|
---|
97 | endif
|
---|
98 | endif
|
---|
99 | VBoxNetNAT_DEFS.solaris += __EXTENSIONS__=1
|
---|
100 | endif
|
---|
101 |
|
---|
102 | # (current dir is for for lwipopts.h)
|
---|
103 | VBoxNetNAT_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
|
---|
104 |
|
---|
105 | VBoxNetNAT_SOURCES = \
|
---|
106 | VBoxNetLwipNAT.cpp \
|
---|
107 | ../NetLib/IntNetIf.cpp \
|
---|
108 | ../NetLib/VBoxNetPortForwardString.cpp \
|
---|
109 | $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES)) \
|
---|
110 | proxy_pollmgr.c \
|
---|
111 | proxy_rtadvd.c \
|
---|
112 | proxy.c \
|
---|
113 | pxremap.c \
|
---|
114 | pxtcp.c \
|
---|
115 | pxudp.c \
|
---|
116 | pxdns.c \
|
---|
117 | fwtcp.c \
|
---|
118 | fwudp.c \
|
---|
119 | portfwd.c \
|
---|
120 | proxy_dhcp6ds.c \
|
---|
121 | proxy_tftpd.c
|
---|
122 |
|
---|
123 | ifeq ($(KBUILD_TARGET),win)
|
---|
124 | VBoxNetNAT_SOURCES += pxping_win.c # unprivileged Icmp API
|
---|
125 | else
|
---|
126 | VBoxNetNAT_SOURCES += pxping.c # raw sockets
|
---|
127 | VBoxNetNAT_CFLAGS.linux += -Wno-address-of-packed-member # Needed for GCC 9.
|
---|
128 | endif
|
---|
129 |
|
---|
130 | VBoxNetNAT_SOURCES.darwin += rtmon_bsd.c
|
---|
131 | VBoxNetNAT_SOURCES.freebsd += rtmon_bsd.c
|
---|
132 | VBoxNetNAT_SOURCES.linux += rtmon_linux.c
|
---|
133 | VBoxNetNAT_SOURCES.solaris += rtmon_bsd.c
|
---|
134 | VBoxNetNAT_SOURCES.win += \
|
---|
135 | rtmon_win.c \
|
---|
136 | RTWinPoll.cpp \
|
---|
137 | RTWinSocketPair.cpp
|
---|
138 |
|
---|
139 | VBoxNetNAT_LIBS = \
|
---|
140 | $(LIB_RUNTIME)
|
---|
141 | VBoxNetNAT_LIBS.solaris += socket nsl
|
---|
142 |
|
---|
143 | VBoxNetNAT_LDFLAGS.win = /SUBSYSTEM:windows
|
---|
144 |
|
---|
145 | # ifeq ($(VBOX_WITH_HARDENING),)
|
---|
146 | # ifn1of ($(KBUILD_TARGET), darwin win)
|
---|
147 | # # helper for debugging unprivileged
|
---|
148 | # VBoxNetNAT_DEFS += VBOX_RAWSOCK_DEBUG_HELPER
|
---|
149 | # VBoxNetNAT_SOURCES += getrawsock.c
|
---|
150 | # endif
|
---|
151 | # endif
|
---|
152 |
|
---|
153 |
|
---|
154 | ifdef VBOX_WITH_HARDENING
|
---|
155 | $(call VBOX_SET_VER_INFO_DLL,VBoxNetNAT,VirtualBox NAT Engine (dll),$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
156 | else
|
---|
157 | $(call VBOX_SET_VER_INFO_EXE,VBoxNetNAT,VirtualBox NAT Engine,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
|
---|
158 | endif
|
---|
159 |
|
---|
160 | endif # VBOX_WITH_LWIP_NAT
|
---|
161 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
162 |
|
---|