# HG changeset patch # User Ruslan Ermilov # Date 1639053001 -10800 # Node ID 9ec96ceaf484ec821f247aa18ad27f2f9e564c87 # Parent 02a9ad88e2dfdeb462f6785a1d1916f5c0827cc6 QUIC: configure cleanup. Renamed and removed some macros. diff --git a/auto/modules b/auto/modules --- a/auto/modules +++ b/auto/modules @@ -1365,7 +1365,7 @@ if [ $USE_OPENSSL_QUIC = YES ]; then . auto/module - if [ $NGX_QUIC_BPF$BPF_FOUND$SO_COOKIE_FOUND = YESYESYES ]; then + if [ $QUIC_BPF = YES -a $SO_COOKIE_FOUND = YES ]; then ngx_module_type=CORE ngx_module_name=ngx_quic_bpf_module ngx_module_incs= diff --git a/auto/options b/auto/options --- a/auto/options +++ b/auto/options @@ -45,7 +45,7 @@ USE_THREADS=NO NGX_FILE_AIO=NO -NGX_QUIC_BPF=YES +QUIC_BPF=NO HTTP=YES @@ -170,7 +170,6 @@ USE_GEOIP=NO NGX_GOOGLE_PERFTOOLS=NO NGX_CPP_TEST=NO -BPF_FOUND=NO SO_COOKIE_FOUND=NO NGX_LIBATOMIC=NO @@ -218,7 +217,7 @@ do --with-file-aio) NGX_FILE_AIO=YES ;; - --without-quic_bpf_module) NGX_QUIC_BPF=NO ;; + --without-quic_bpf_module) QUIC_BPF=NONE ;; --with-ipv6) NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG diff --git a/auto/os/linux b/auto/os/linux --- a/auto/os/linux +++ b/auto/os/linux @@ -235,34 +235,46 @@ ngx_include="sys/vfs.h"; . auto/incl CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64" -# (E)BPF +# BPF sockhash -ngx_feature="BPF support" +ngx_feature="BPF sockhash" ngx_feature_name="NGX_HAVE_BPF" ngx_feature_run=no ngx_feature_incs="#include #include " ngx_feature_path= ngx_feature_libs= -ngx_feature_test=" - union bpf_attr attr = { 0 }; - /* only declare BPF support if all required features found */ - attr.map_flags = 0; - attr.map_type = BPF_MAP_TYPE_SOCKHASH; - syscall(__NR_bpf, 0, &attr, 0);" +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 - BPF_FOUND=YES - CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c" CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h" + + # quic bpf module uses sockhash to select socket from reuseport group, + # support appeared in Linux 5.7: + # + # commit: 9fed9000c5c6cacfcaaa48aff74818072ae294cc + # bpf: Allow selecting reuseport socket from a SOCKMAP/SOCKHASH + + if [ $QUIC_BPF != NONE ]; then + echo $ngx_n "checking for BPF sockhash support in kernel ...$ngx_c" + if [ $version -lt 329472 ]; then + echo " not found (at least 5.7 is required)" + QUIC_BPF=NO + else + echo " found" + QUIC_BPF=YES + fi + fi fi -# SO_COOKIE socket option - ngx_feature="SO_COOKIE" ngx_feature_name="NGX_HAVE_SO_COOKIE" ngx_feature_run=no @@ -271,17 +283,16 @@ ngx_feature_incs="#include