# HG changeset patch # User Ruslan Ermilov # Date 1639053001 -10800 # Node ID 9ec96ceaf484ec821f247aa18ad27f2f9e564c87 # Parent 02a9ad88e2dfdeb462f6785a1d1916f5c0827cc6 QUIC: configure cleanup. Renamed and removed some macros. diff -r 02a9ad88e2df -r 9ec96ceaf484 auto/modules --- a/auto/modules Mon Dec 06 11:04:55 2021 +0300 +++ b/auto/modules Thu Dec 09 15:30:01 2021 +0300 @@ -1365,7 +1365,7 @@ . 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 -r 02a9ad88e2df -r 9ec96ceaf484 auto/options --- a/auto/options Mon Dec 06 11:04:55 2021 +0300 +++ b/auto/options Thu Dec 09 15:30:01 2021 +0300 @@ -45,7 +45,7 @@ NGX_FILE_AIO=NO -NGX_QUIC_BPF=YES +QUIC_BPF=NO HTTP=YES @@ -170,7 +170,6 @@ NGX_GOOGLE_PERFTOOLS=NO NGX_CPP_TEST=NO -BPF_FOUND=NO SO_COOKIE_FOUND=NO NGX_LIBATOMIC=NO @@ -218,7 +217,7 @@ --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 -r 02a9ad88e2df -r 9ec96ceaf484 auto/os/linux --- a/auto/os/linux Mon Dec 06 11:04:55 2021 +0300 +++ b/auto/os/linux Thu Dec 09 15:30:01 2021 +0300 @@ -235,34 +235,46 @@ 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_path= ngx_feature_libs= ngx_feature_test="socklen_t optlen = sizeof(uint64_t); - uint64_t cookie; - getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)" + uint64_t cookie; + getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)" . auto/feature if [ $ngx_found = yes ]; then SO_COOKIE_FOUND=YES - have=NGX_HAVE_SO_COOKIE . auto/have fi -# UDP_SEGMENT socket option is used for segmentation offloading +# UDP segmentation offloading ngx_feature="UDP_SEGMENT" ngx_feature_name="NGX_HAVE_UDP_SEGMENT" @@ -292,29 +303,6 @@ ngx_feature_path= ngx_feature_libs= ngx_feature_test="socklen_t optlen = sizeof(int); - int val; - getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)" + int val; + getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)" . auto/feature - -if [ $ngx_found = yes ]; then - UDP_SEGMENT_FOUND=YES - have=NGX_HAVE_UDP_SEGMENT . auto/have -fi - - -# ngx_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 [ $NGX_QUIC_BPF$BPF_FOUND = YESYES ]; then - echo $ngx_n "checking for kernel with reuseport/BPF support...$ngx_c" - if [ $version -lt 329472 ]; then - echo " not found (at least 5.7 is required)" - NGX_QUIC_BPF=NO - else - echo " found" - fi -fi -