Skip to content

Commit

Permalink
Merged with the quic branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed May 19, 2023
2 parents 1a8ef99 + 94941bd commit 4b02661
Show file tree
Hide file tree
Showing 76 changed files with 23,593 additions and 51 deletions.
43 changes: 37 additions & 6 deletions auto/lib/openssl/conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@

if [ $OPENSSL != NONE ]; then

have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have

if [ $USE_OPENSSL_QUIC = YES ]; then
have=NGX_QUIC . auto/have
have=NGX_QUIC_OPENSSL_COMPAT . auto/have
fi

case "$CC" in

cl | bcc32)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have

CFLAGS="$CFLAGS -DNO_SYS_TYPES_H"

CORE_INCS="$CORE_INCS $OPENSSL/openssl/include"
Expand All @@ -33,9 +38,6 @@ if [ $OPENSSL != NONE ]; then
;;

*)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
Expand Down Expand Up @@ -123,6 +125,35 @@ else
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
OPENSSL=YES

if [ $USE_OPENSSL_QUIC = YES ]; then

ngx_feature="OpenSSL QUIC support"
ngx_feature_name="NGX_QUIC"
ngx_feature_test="SSL_set_quic_method(NULL, NULL)"
. auto/feature

if [ $ngx_found = no ]; then
have=NGX_QUIC_OPENSSL_COMPAT . auto/have

ngx_feature="OpenSSL QUIC compatibility"
ngx_feature_test="SSL_CTX_add_custom_ext(NULL, 0, 0,
NULL, NULL, NULL, NULL, NULL)"
. auto/feature
fi

if [ $ngx_found = no ]; then
cat << END

$0: error: certain modules require OpenSSL QUIC support.
You can either do not enable the modules, or install the OpenSSL library with
QUIC support into the system, or build the OpenSSL library with QUIC support
statically from the source with nginx by using --with-openssl=<path> option.

END
exit 1
fi
fi
fi
fi

Expand Down
5 changes: 3 additions & 2 deletions auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
echo "creating $NGX_MAKEFILE"

mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
$NGX_OBJS/src/event/quic \
$NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
$NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/modules \
$NGX_OBJS/src/http/modules/perl \
$NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/v3 \
$NGX_OBJS/src/http/modules $NGX_OBJS/src/http/modules/perl \
$NGX_OBJS/src/mail \
$NGX_OBJS/src/stream \
$NGX_OBJS/src/misc
Expand Down
99 changes: 98 additions & 1 deletion auto/modules
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if [ $HTTP = YES ]; then
fi


if [ $HTTP_V2 = YES ]; then
if [ $HTTP_V2 = YES -o $HTTP_V3 = YES ]; then
HTTP_SRCS="$HTTP_SRCS $HTTP_HUFF_SRCS"
fi

Expand All @@ -124,6 +124,7 @@ if [ $HTTP = YES ]; then
# ngx_http_header_filter
# ngx_http_chunked_filter
# ngx_http_v2_filter
# ngx_http_v3_filter
# ngx_http_range_header_filter
# ngx_http_gzip_filter
# ngx_http_postpone_filter
Expand Down Expand Up @@ -156,6 +157,7 @@ if [ $HTTP = YES ]; then
ngx_http_header_filter_module \
ngx_http_chunked_filter_module \
ngx_http_v2_filter_module \
ngx_http_v3_filter_module \
ngx_http_range_header_filter_module \
ngx_http_gzip_filter_module \
ngx_http_postpone_filter_module \
Expand Down Expand Up @@ -217,6 +219,17 @@ if [ $HTTP = YES ]; then
. auto/module
fi

if [ $HTTP_V3 = YES ]; then
ngx_module_name=ngx_http_v3_filter_module
ngx_module_incs=
ngx_module_deps=
ngx_module_srcs=src/http/v3/ngx_http_v3_filter_module.c
ngx_module_libs=
ngx_module_link=$HTTP_V3

. auto/module
fi

if :; then
ngx_module_name=ngx_http_range_header_filter_module
ngx_module_incs=
Expand Down Expand Up @@ -426,6 +439,33 @@ if [ $HTTP = YES ]; then
. auto/module
fi

if [ $HTTP_V3 = YES ]; then
USE_OPENSSL_QUIC=YES
HTTP_SSL=YES

have=NGX_HTTP_V3 . auto/have
have=NGX_HTTP_HEADERS . auto/have

ngx_module_name=ngx_http_v3_module
ngx_module_incs=src/http/v3
ngx_module_deps="src/http/v3/ngx_http_v3.h \
src/http/v3/ngx_http_v3_encode.h \
src/http/v3/ngx_http_v3_parse.h \
src/http/v3/ngx_http_v3_table.h \
src/http/v3/ngx_http_v3_uni.h"
ngx_module_srcs="src/http/v3/ngx_http_v3.c \
src/http/v3/ngx_http_v3_encode.c \
src/http/v3/ngx_http_v3_parse.c \
src/http/v3/ngx_http_v3_table.c \
src/http/v3/ngx_http_v3_uni.c \
src/http/v3/ngx_http_v3_request.c \
src/http/v3/ngx_http_v3_module.c"
ngx_module_libs=
ngx_module_link=$HTTP_V3

. auto/module
fi

if :; then
ngx_module_name=ngx_http_static_module
ngx_module_incs=
Expand Down Expand Up @@ -1272,6 +1312,63 @@ if [ $USE_OPENSSL = YES ]; then
fi


if [ $USE_OPENSSL_QUIC = YES ]; then
ngx_module_type=CORE
ngx_module_name=ngx_quic_module
ngx_module_incs=
ngx_module_deps="src/event/quic/ngx_event_quic.h \
src/event/quic/ngx_event_quic_transport.h \
src/event/quic/ngx_event_quic_protection.h \
src/event/quic/ngx_event_quic_connection.h \
src/event/quic/ngx_event_quic_frames.h \
src/event/quic/ngx_event_quic_connid.h \
src/event/quic/ngx_event_quic_migration.h \
src/event/quic/ngx_event_quic_streams.h \
src/event/quic/ngx_event_quic_ssl.h \
src/event/quic/ngx_event_quic_tokens.h \
src/event/quic/ngx_event_quic_ack.h \
src/event/quic/ngx_event_quic_output.h \
src/event/quic/ngx_event_quic_socket.h \
src/event/quic/ngx_event_quic_openssl_compat.h"
ngx_module_srcs="src/event/quic/ngx_event_quic.c \
src/event/quic/ngx_event_quic_udp.c \
src/event/quic/ngx_event_quic_transport.c \
src/event/quic/ngx_event_quic_protection.c \
src/event/quic/ngx_event_quic_frames.c \
src/event/quic/ngx_event_quic_connid.c \
src/event/quic/ngx_event_quic_migration.c \
src/event/quic/ngx_event_quic_streams.c \
src/event/quic/ngx_event_quic_ssl.c \
src/event/quic/ngx_event_quic_tokens.c \
src/event/quic/ngx_event_quic_ack.c \
src/event/quic/ngx_event_quic_output.c \
src/event/quic/ngx_event_quic_socket.c \
src/event/quic/ngx_event_quic_openssl_compat.c"

ngx_module_libs=
ngx_module_link=YES
ngx_module_order=

. auto/module

if [ $QUIC_BPF = YES -a $SO_COOKIE_FOUND = YES ]; then
ngx_module_type=CORE
ngx_module_name=ngx_quic_bpf_module
ngx_module_incs=
ngx_module_deps=
ngx_module_srcs="src/event/quic/ngx_event_quic_bpf.c \
src/event/quic/ngx_event_quic_bpf_code.c"
ngx_module_libs=
ngx_module_link=YES
ngx_module_order=

. auto/module

have=NGX_QUIC_BPF . auto/have
fi
fi


if [ $USE_PCRE = YES ]; then
ngx_module_type=CORE
ngx_module_name=ngx_regex_module
Expand Down
12 changes: 12 additions & 0 deletions auto/options
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ USE_THREADS=NO

NGX_FILE_AIO=NO

QUIC_BPF=NO

HTTP=YES

NGX_HTTP_LOG_PATH=
Expand All @@ -59,6 +61,7 @@ HTTP_CHARSET=YES
HTTP_GZIP=YES
HTTP_SSL=NO
HTTP_V2=NO
HTTP_V3=NO
HTTP_SSI=YES
HTTP_REALIP=NO
HTTP_XSLT=NO
Expand Down Expand Up @@ -149,6 +152,7 @@ PCRE_JIT=NO
PCRE2=YES

USE_OPENSSL=NO
USE_OPENSSL_QUIC=NO
OPENSSL=NONE

USE_ZLIB=NO
Expand All @@ -166,6 +170,8 @@ USE_GEOIP=NO
NGX_GOOGLE_PERFTOOLS=NO
NGX_CPP_TEST=NO

SO_COOKIE_FOUND=NO

NGX_LIBATOMIC=NO

NGX_CPU_CACHE_LINE=
Expand Down Expand Up @@ -211,6 +217,8 @@ do

--with-file-aio) NGX_FILE_AIO=YES ;;

--without-quic_bpf_module) QUIC_BPF=NONE ;;

--with-ipv6)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-ipv6\" option is deprecated"
Expand All @@ -228,6 +236,7 @@ $0: warning: the \"--with-ipv6\" option is deprecated"

--with-http_ssl_module) HTTP_SSL=YES ;;
--with-http_v2_module) HTTP_V2=YES ;;
--with-http_v3_module) HTTP_V3=YES ;;
--with-http_realip_module) HTTP_REALIP=YES ;;
--with-http_addition_module) HTTP_ADDITION=YES ;;
--with-http_xslt_module) HTTP_XSLT=YES ;;
Expand Down Expand Up @@ -443,8 +452,11 @@ cat << END

--with-file-aio enable file AIO support

--without-quic_bpf_module disable ngx_quic_bpf_module

--with-http_ssl_module enable ngx_http_ssl_module
--with-http_v2_module enable ngx_http_v2_module
--with-http_v3_module enable ngx_http_v3_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
Expand Down
44 changes: 44 additions & 0 deletions auto/os/linux
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,50 @@ ngx_feature_test="struct crypt_data cd;
ngx_include="sys/vfs.h"; . auto/include


# BPF sockhash

ngx_feature="BPF sockhash"
ngx_feature_name="NGX_HAVE_BPF"
ngx_feature_run=no
ngx_feature_incs="#include <linux/bpf.h>
#include <sys/syscall.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="union bpf_attr attr = { 0 };

attr.map_flags = 0;
attr.map_type = BPF_MAP_TYPE_SOCKHASH;

syscall(__NR_bpf, 0, &attr, 0);"
. auto/feature

if [ $ngx_found = yes ]; then
CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"

if [ $QUIC_BPF != NONE ]; then
QUIC_BPF=YES
fi
fi


ngx_feature="SO_COOKIE"
ngx_feature_name="NGX_HAVE_SO_COOKIE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
$NGX_INCLUDE_INTTYPES_H"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="socklen_t optlen = sizeof(uint64_t);
uint64_t cookie;
getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)"
. auto/feature

if [ $ngx_found = yes ]; then
SO_COOKIE_FOUND=YES
fi


# UDP segmentation offloading

ngx_feature="UDP_SEGMENT"
Expand Down
2 changes: 1 addition & 1 deletion auto/sources
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CORE_SRCS="src/core/nginx.c \

EVENT_MODULES="ngx_events_module ngx_event_core_module"

EVENT_INCS="src/event src/event/modules"
EVENT_INCS="src/event src/event/modules src/event/quic"

EVENT_DEPS="src/event/ngx_event.h \
src/event/ngx_event_timer.h \
Expand Down
48 changes: 48 additions & 0 deletions auto/unix
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,54 @@ ngx_feature_test="setsockopt(0, IPPROTO_IPV6, IPV6_RECVPKTINFO, NULL, 0)"
. auto/feature


# IP packet fragmentation

ngx_feature="IP_MTU_DISCOVER"
ngx_feature_name="NGX_HAVE_IP_MTU_DISCOVER"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) IP_PMTUDISC_DO;
setsockopt(0, IPPROTO_IP, IP_MTU_DISCOVER, NULL, 0)"
. auto/feature


ngx_feature="IPV6_MTU_DISCOVER"
ngx_feature_name="NGX_HAVE_IPV6_MTU_DISCOVER"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) IPV6_PMTUDISC_DO;
setsockopt(0, IPPROTO_IPV6, IPV6_MTU_DISCOVER, NULL, 0)"
. auto/feature


ngx_feature="IP_DONTFRAG"
ngx_feature_name="NGX_HAVE_IP_DONTFRAG"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_DONTFRAG, NULL, 0)"
. auto/feature


ngx_feature="IPV6_DONTFRAG"
ngx_feature_name="NGX_HAVE_IPV6_DONTFRAG"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IPV6_DONTFRAG, NULL, 0)"
. auto/feature


ngx_feature="TCP_DEFER_ACCEPT"
ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
ngx_feature_run=no
Expand Down
Loading

0 comments on commit 4b02661

Please sign in to comment.