Build splice support on linux, fix standalone portmappers building with cmake
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run

This commit is contained in:
Vladimir Dubrovin 2026-10-12 13:27:16 +03:00
parent 371d8396b4
commit 144e2f3840
4 changed files with 19 additions and 20 deletions

View File

@ -51,7 +51,7 @@ option(3PROXY_USE_OPENSSL "Enable TLS/SSL support via OpenSSL (fallback when wol
option(3PROXY_USE_PCRE2 "Enable PCRE2 regex filtering" ON) option(3PROXY_USE_PCRE2 "Enable PCRE2 regex filtering" ON)
option(3PROXY_USE_PAM "Enable PAM/PamAuth" ON) option(3PROXY_USE_PAM "Enable PAM/PamAuth" ON)
option(3PROXY_USE_ODBC "Enable ODBC support (Unix only, always ON on Windows)" OFF) option(3PROXY_USE_ODBC "Enable ODBC support (Unix only, always ON on Windows)" OFF)
option(3PROXY_USE_SPLICE "Build Linux splice() support, slower than read/write for most traffic (Linux only)" OFF) option(3PROXY_USE_SPLICE "Build Linux splice() support, used by services given -s (Linux only)" ON)
option(3PROXY_USE_POLL "Use poll() instead of select() (Unix only)" ON) option(3PROXY_USE_POLL "Use poll() instead of select() (Unix only)" ON)
option(3PROXY_USE_WSAPOLL "Use WSAPoll instead of select() (Windows only)" ON) option(3PROXY_USE_WSAPOLL "Use WSAPoll instead of select() (Windows only)" ON)
option(3PROXY_USE_NETFILTER "Enable Linux netfilter support (Linux only)" ON) option(3PROXY_USE_NETFILTER "Enable Linux netfilter support (Linux only)" ON)
@ -664,10 +664,7 @@ foreach(PROXY_NAME proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
target_compile_definitions(${PROXY_NAME} PRIVATE target_compile_definitions(${PROXY_NAME} PRIVATE WITHMAIN)
WITHMAIN
NOPORTMAP
)
if(NOT PROXY_NAME STREQUAL "udppm") if(NOT PROXY_NAME STREQUAL "udppm")
target_compile_definitions(${PROXY_NAME} PRIVATE NOUDPMAIN) target_compile_definitions(${PROXY_NAME} PRIVATE NOUDPMAIN)
@ -679,8 +676,12 @@ foreach(PROXY_NAME proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
target_compile_definitions(${PROXY_NAME} PRIVATE ANONYMOUS) target_compile_definitions(${PROXY_NAME} PRIVATE ANONYMOUS)
endif() endif()
# port mappers take port, host and port as arguments, the others options
# only; one of the two is defined, as in src/Makefile.inc
if(PROXY_NAME STREQUAL "tcppm" OR PROXY_NAME STREQUAL "udppm" OR PROXY_NAME STREQUAL "tlspr") if(PROXY_NAME STREQUAL "tcppm" OR PROXY_NAME STREQUAL "udppm" OR PROXY_NAME STREQUAL "tlspr")
target_compile_definitions(${PROXY_NAME} PRIVATE PORTMAP) target_compile_definitions(${PROXY_NAME} PRIVATE PORTMAP)
else()
target_compile_definitions(${PROXY_NAME} PRIVATE NOPORTMAP)
endif() endif()
if(WIN32) if(WIN32)

View File

@ -4,9 +4,9 @@
# add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC # add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC
# library support. Add -DSAFESQL for poorely written ODBC library / drivers. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
# #
# Linux splice() support is not built by default, it is slower than the # Linux splice() support is built, but used only by services given the -s
# read/write path for most traffic. Add -DWITHSPLICE to CFLAGS to build it, # option: it is faster for large transfers and slower for small requests.
# it must additionally be enabled per service with the -s option. # Remove -DWITHSPLICE from CFLAGS to build without it.
BUILDDIR = ../bin/ BUILDDIR = ../bin/
PREFIX ?= 3proxy_ PREFIX ?= 3proxy_
@ -14,7 +14,7 @@ CRYPT_PREFIX ?= $(PREFIX)
CC ?= gcc CC ?= gcc
CFLAGS ?= -O3 -flto CFLAGS ?= -O3 -flto
CFLAGS += -fno-strict-aliasing -c -pthread -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN CFLAGS += -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN
COUT = -o COUT = -o
LN ?= ${CC} LN ?= ${CC}
DCFLAGS ?= -fPIC DCFLAGS ?= -fPIC

View File

@ -216,12 +216,11 @@ second. Useful to minimize polling <b><br>
-s</b> <br> -s</b> <br>
(for admin) secure, allow only secure operations, currently (for admin) secure, allow only secure operations, currently
only traffic counters view without ability to reset. <br> only traffic counters view without ability to reset. <br>
(for TCP services, Linux) enable splice(). splice() is not (for TCP services, Linux) enable splice(). It is built on
built by default and is disabled even when built, because Linux by default, but off unless -s is given: splice() is
current Linux does not implement SPLICE_F_MOVE, so no real faster for large transfers and the read/write path for small
zero-copy takes place and the read/write path is faster for requests. -s0 disables it explicitly; build without
most traffic. Rebuild with -DWITHSPLICE to make -s -DWITHSPLICE to leave it out. <b><br>
available, -s0 disables it explicitly. <b><br>
-C</b> <br> -C</b> <br>
(for TCP services) a connection closed by any of the sides (for TCP services) a connection closed by any of the sides
terminates the session, buffered data is delivered before terminates the session, buffered data is delivered before

View File

@ -194,11 +194,10 @@ delay GRACE_DELAY milliseconds before polling if average polling size is below G
(for admin) secure, allow only secure operations, currently only traffic counters (for admin) secure, allow only secure operations, currently only traffic counters
view without ability to reset. view without ability to reset.
.br .br
(for TCP services, Linux) enable splice(). splice() is not built by default and (for TCP services, Linux) enable splice(). It is built on Linux by default,
is disabled even when built, because current Linux does not implement but off unless -s is given: splice() is faster for large transfers and the
SPLICE_F_MOVE, so no real zero-copy takes place and the read/write path is faster read/write path for small requests. -s0 disables it explicitly; build without
for most traffic. Rebuild with -DWITHSPLICE to make -s available, -s0 disables it -DWITHSPLICE to leave it out.
explicitly.
.br .br
.B -C .B -C
(for TCP services) a connection closed by any of the sides terminates the (for TCP services) a connection closed by any of the sides terminates the