git: dc7ad82ad6e3 - main - www/nginx-devel: update from 1.22.0 to 1.23.0

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Sun, 10 Jul 2022 20:13:34 UTC
The branch main has been updated by osa:

URL: https://cgit.FreeBSD.org/ports/commit/?id=dc7ad82ad6e31fc5a9b0c8ec8df675200123413c

commit dc7ad82ad6e31fc5a9b0c8ec8df675200123413c
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2022-07-10 20:12:19 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2022-07-10 20:13:27 +0000

    www/nginx-devel: update from 1.22.0 to 1.23.0
    
    Please note: the following third-party modules are require additional
    patches (marked IGNORE):
    o) clojure
    o) headers_more
    o) http_push_stream
    o) http_redis
    o) http_response
    o) http_upload_progress
    o) http_upstream_sticky
    o) http_zip
    o) lua
    o) naxsi
    o) srcache
    o) vod
    
    <Changelog>
    
    *) Change in internal API: now header lines are represented as linked
       lists.
    
    *) Change: now nginx combines arbitrary header lines with identical
       names when sending to FastCGI, SCGI, and uwsgi backends, in the
       $r->header_in() method of the ngx_http_perl_module, and during lookup
       of the "$http_...", "$sent_http_...", "$sent_trailer_...",
       "$upstream_http_...", and "$upstream_trailer_..." variables.
    
    *) Bugfix: if there were multiple "Vary" header lines in the backend
       response, nginx only used the last of them when caching.
    
    *) Bugfix: if there were multiple "WWW-Authenticate" header lines in the
       backend response and errors with code 401 were intercepted or the
       "auth_request" directive was used, nginx only sent the first of the
       header lines to the client.
    
    *) Change: the logging level of the "application data after close
       notify" SSL errors has been lowered from "crit" to "info".
    
    *) Bugfix: connections might hang if nginx was built on Linux 2.6.17 or
       newer, but was used on systems without EPOLLRDHUP support, notably
       with epoll emulation layers; the bug had appeared in 1.17.5.
       Thanks to Marcus Ball.
    
    *) Bugfix: nginx did not cache the response if the "Expires" response
       header line disabled caching, but following "Cache-Control" header
       line enabled caching.
    
    </Changelog>
---
 www/nginx-devel/Makefile                 |   23 +-
 www/nginx-devel/distinfo                 |    6 +-
 www/nginx-devel/files/extra-patch-httpv3 | 3108 ++++++++++++++----------------
 3 files changed, 1440 insertions(+), 1697 deletions(-)

diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile
index ba6005537778..1de332053904 100644
--- a/www/nginx-devel/Makefile
+++ b/www/nginx-devel/Makefile
@@ -1,8 +1,7 @@
 # Created by: Sergey A. Osokin <osa@FreeBSD.org>
 
 PORTNAME?=	nginx
-PORTVERSION=	1.22.0
-PORTREVISION=	7
+PORTVERSION=	1.23.0
 CATEGORIES=	www
 MASTER_SITES=	https://nginx.org/download/ \
 		LOCAL/osa
@@ -225,6 +224,11 @@ CONFIGURE_ENV+=	OPTIMIZE="yes"
 CFLAGS+=	-DNDEBUG
 .endif
 
+# Fix build failure on clang >= 12
+.if ${PORT_OPTIONS:MHTTP_PERL} && ${OSVERSION} >= 1301000
+CFLAGS+=	-Wno-compound-token-split-by-macro
+.endif
+
 .if empty(PORT_OPTIONS:MPCRE_ONE) && empty(PORT_OPTIONS:MPCRE_TWO)
 IGNORE=		required at least PCRE_ONE or PCRE_TWO \
 		to be defined. Please do 'make config' again
@@ -240,6 +244,21 @@ IGNORE=		required HTTPV3_BORING or HTTPV3_QTLS \
 NJS_CONFIGURE_ARGS=	--no-pcre2
 .endif
 
+.if ${PORT_OPTIONS:MCLOJURE} || \
+    ${PORT_OPTIONS:MHEADERS_MORE} || \
+    ${PORT_OPTIONS:MHTTP_PUSH_STREAM} || \
+    ${PORT_OPTIONS:MHTTP_REDIS} || \
+    ${PORT_OPTIONS:MHTTP_RESPONSE} || \
+    ${PORT_OPTIONS:MHTTP_UPLOAD_PROGRESS} || \
+    ${PORT_OPTIONS:MHTTP_UPSTREAM_STICKY} || \
+    ${PORT_OPTIONS:MHTTP_ZIP} || \
+    ${PORT_OPTIONS:MLUA} || \
+    ${PORT_OPTIONS:MNAXSI} || \
+    ${PORT_OPTIONS:MSRCACHE} || \
+    ${PORT_OPTIONS:MVOD}
+IGNORE=		a patch requires
+.endif
+
 pre-everything::
 	@${ECHO_MSG}
 .if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR}
diff --git a/www/nginx-devel/distinfo b/www/nginx-devel/distinfo
index db27c3e0bf36..c5d0558cf011 100644
--- a/www/nginx-devel/distinfo
+++ b/www/nginx-devel/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1655810549
-SHA256 (nginx-1.22.0.tar.gz) = b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
-SIZE (nginx-1.22.0.tar.gz) = 1073322
+TIMESTAMP = 1657479744
+SHA256 (nginx-1.23.0.tar.gz) = 820acaa35b9272be9e9e72f6defa4a5f2921824709f8aa4772c78ab31ed94cd1
+SIZE (nginx-1.23.0.tar.gz) = 1102940
 SHA256 (nginx_mogilefs_module-1.0.4.tar.gz) = 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae
 SIZE (nginx_mogilefs_module-1.0.4.tar.gz) = 11208
 SHA256 (nginx_mod_h264_streaming-2.2.7.tar.gz) = 6d974ba630cef59de1f60996c66b401264a345d25988a76037c2856cec756c19
diff --git a/www/nginx-devel/files/extra-patch-httpv3 b/www/nginx-devel/files/extra-patch-httpv3
index 84104bfbf152..221d8d052caf 100644
--- a/www/nginx-devel/files/extra-patch-httpv3
+++ b/www/nginx-devel/files/extra-patch-httpv3
@@ -1,8 +1,7 @@
-diff --git a/README b/README
-new file mode 100644
---- /dev/null
-+++ b/README
-@@ -0,0 +1,233 @@
+diff -r fecd73db563f README
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/README	Thu Jun 23 13:33:29 2022 -0400
+@@ -0,0 +1,232 @@
 +Experimental QUIC support for nginx
 +-----------------------------------
 +
@@ -20,7 +19,7 @@ new file mode 100644
 +
 +    The code is developed in a separate "quic" branch available
 +    at https://hg.nginx.org/nginx-quic.  Currently it is based
-+    on nginx mainline 1.21.x.  We merge new nginx releases into
++    on nginx mainline 1.23.x.  We merge new nginx releases into
 +    this branch regularly.
 +
 +    The project code base is under the same BSD license as nginx.
@@ -69,7 +68,7 @@ new file mode 100644
 +                                      -L../boringssl/build/crypto"
 +    $ make
 +
-+    Alternatively, nginx can be configured with QuicTLS [9]
++    Alternatively, nginx can be configured with QuicTLS [5]
 +
 +    $ ./auto/configure --with-debug --with-http_v3_module         \
 +                       --with-cc-opt="-I../quictls/build/include" \
@@ -108,7 +107,7 @@ new file mode 100644
 +
 +        quic_gso on;
 +
-+    To limit maximum packet size:
++    To limit maximum UDP payload size on receive path:
 +
 +        quic_mtu <size>;
 +
@@ -117,7 +116,7 @@ new file mode 100644
 +        quic_host_key <filename>;
 +
 +
-+    By default this Linux-specific optimization [8] is disabled.
++    By default, GSO Linux-specific optimization [8] is disabled.
 +    Enable if your network interface is configured to support GSO.
 +
 +    A number of directives were added that configure HTTP/3:
@@ -228,17 +227,16 @@ new file mode 100644
 +7. Links
 +
 +    [1] https://datatracker.ietf.org/doc/html/rfc9000
-+    [2] https://datatracker.ietf.org/doc/html/draft-ietf-quic-http
++    [2] https://datatracker.ietf.org/doc/html/rfc9114
 +    [3] https://mailman.nginx.org/mailman3/lists/nginx-devel.nginx.org/
 +    [4] https://boringssl.googlesource.com/boringssl/
-+    [5] https://datatracker.ietf.org/doc/html/rfc9002
++    [5] https://github.com/quictls/openssl
 +    [6] https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
 +    [7] https://nginx.org/en/docs/debugging_log.html
 +    [8] http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf
-+    [9] https://github.com/quictls/openssl
-diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
---- a/auto/lib/openssl/conf
-+++ b/auto/lib/openssl/conf
+diff -r fecd73db563f auto/lib/openssl/conf
+--- a/auto/lib/openssl/conf	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/lib/openssl/conf	Thu Jun 23 13:33:29 2022 -0400
 @@ -5,12 +5,16 @@
  
  if [ $OPENSSL != NONE ]; then
@@ -298,9 +296,9 @@ diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
 +        fi
 +    fi
  fi
-diff --git a/auto/make b/auto/make
---- a/auto/make
-+++ b/auto/make
+diff -r fecd73db563f auto/make
+--- a/auto/make	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/make	Thu Jun 23 13:33:29 2022 -0400
 @@ -6,9 +6,10 @@
  echo "creating $NGX_MAKEFILE"
  
@@ -314,9 +312,9 @@ diff --git a/auto/make b/auto/make
           $NGX_OBJS/src/mail \
           $NGX_OBJS/src/stream \
           $NGX_OBJS/src/misc
-diff --git a/auto/modules b/auto/modules
---- a/auto/modules
-+++ b/auto/modules
+diff -r fecd73db563f auto/modules
+--- a/auto/modules	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/modules	Thu Jun 23 13:33:29 2022 -0400
 @@ -102,7 +102,7 @@ if [ $HTTP = YES ]; then
      fi
  
@@ -415,7 +413,7 @@ diff --git a/auto/modules b/auto/modules
      if [ $STREAM_SSL = YES ]; then
          USE_OPENSSL=YES
          have=NGX_STREAM_SSL . auto/have
-@@ -1272,6 +1326,60 @@ if [ $USE_OPENSSL = YES ]; then
+@@ -1272,6 +1326,61 @@ if [ $USE_OPENSSL = YES ]; then
  fi
  
  
@@ -437,6 +435,7 @@ diff --git a/auto/modules b/auto/modules
 +                     src/event/quic/ngx_event_quic_output.h \
 +                     src/event/quic/ngx_event_quic_socket.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 \
@@ -476,9 +475,9 @@ diff --git a/auto/modules b/auto/modules
  if [ $USE_PCRE = YES ]; then
      ngx_module_type=CORE
      ngx_module_name=ngx_regex_module
-diff --git a/auto/options b/auto/options
---- a/auto/options
-+++ b/auto/options
+diff -r fecd73db563f auto/options
+--- a/auto/options	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/options	Thu Jun 23 13:33:29 2022 -0400
 @@ -45,6 +45,8 @@ USE_THREADS=NO
  
  NGX_FILE_AIO=NO
@@ -566,15 +565,13 @@ diff --git a/auto/options b/auto/options
    --with-stream_realip_module        enable ngx_stream_realip_module
    --with-stream_geoip_module         enable ngx_stream_geoip_module
    --with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module
-diff --git a/auto/os/linux b/auto/os/linux
---- a/auto/os/linux
-+++ b/auto/os/linux
-@@ -233,3 +233,63 @@ ngx_include="sys/vfs.h";     . auto/incl
+diff -r fecd73db563f auto/os/linux
+--- a/auto/os/linux	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/os/linux	Thu Jun 23 13:33:29 2022 -0400
+@@ -232,6 +232,50 @@ ngx_feature_test="struct crypt_data  cd;
+ ngx_include="sys/vfs.h";     . auto/include
  
  
- CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
-+
-+
 +# BPF sockhash
 +
 +ngx_feature="BPF sockhash"
@@ -619,24 +616,13 @@ diff --git a/auto/os/linux b/auto/os/linux
 +fi
 +
 +
-+# UDP segmentation offloading
-+
-+ngx_feature="UDP_SEGMENT"
-+ngx_feature_name="NGX_HAVE_UDP_SEGMENT"
-+ngx_feature_run=no
-+ngx_feature_incs="#include <sys/socket.h>
-+                  #include <stdint.h>
-+                  #include <netinet/udp.h>"
-+ngx_feature_path=
-+ngx_feature_libs=
-+ngx_feature_test="socklen_t optlen = sizeof(int);
-+                  int val;
-+                  getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)"
-+. auto/feature
-diff --git a/auto/sources b/auto/sources
---- a/auto/sources
-+++ b/auto/sources
-@@ -83,13 +83,14 @@ CORE_SRCS="src/core/nginx.c \
+ # UDP segmentation offloading
+ 
+ ngx_feature="UDP_SEGMENT"
+diff -r fecd73db563f auto/sources
+--- a/auto/sources	Tue Jun 21 17:25:37 2022 +0300
++++ b/auto/sources	Thu Jun 23 13:33:29 2022 -0400
+@@ -83,7 +83,7 @@ CORE_SRCS="src/core/nginx.c \
  
  EVENT_MODULES="ngx_events_module ngx_event_core_module"
  
@@ -645,17 +631,9 @@ diff --git a/auto/sources b/auto/sources
  
  EVENT_DEPS="src/event/ngx_event.h \
              src/event/ngx_event_timer.h \
-             src/event/ngx_event_posted.h \
-             src/event/ngx_event_connect.h \
--            src/event/ngx_event_pipe.h"
-+            src/event/ngx_event_pipe.h \
-+            src/event/ngx_event_udp.h"
- 
- EVENT_SRCS="src/event/ngx_event.c \
-             src/event/ngx_event_timer.c \
-diff --git a/src/core/nginx.c b/src/core/nginx.c
---- a/src/core/nginx.c
-+++ b/src/core/nginx.c
+diff -r fecd73db563f src/core/nginx.c
+--- a/src/core/nginx.c	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/core/nginx.c	Thu Jun 23 13:33:29 2022 -0400
 @@ -680,6 +680,9 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, 
  
      ls = cycle->listening.elts;
@@ -666,10 +644,9 @@ diff --git a/src/core/nginx.c b/src/core/nginx.c
          p = ngx_sprintf(p, "%ud;", ls[i].fd);
      }
  
-diff --git a/src/core/ngx_bpf.c b/src/core/ngx_bpf.c
-new file mode 100644
---- /dev/null
-+++ b/src/core/ngx_bpf.c
+diff -r fecd73db563f src/core/ngx_bpf.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/src/core/ngx_bpf.c	Thu Jun 23 13:33:29 2022 -0400
 @@ -0,0 +1,143 @@
 +
 +/*
@@ -814,10 +791,9 @@ new file mode 100644
 +
 +    return ngx_bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
 +}
-diff --git a/src/core/ngx_bpf.h b/src/core/ngx_bpf.h
-new file mode 100644
---- /dev/null
-+++ b/src/core/ngx_bpf.h
+diff -r fecd73db563f src/core/ngx_bpf.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/src/core/ngx_bpf.h	Thu Jun 23 13:33:29 2022 -0400
 @@ -0,0 +1,43 @@
 +
 +/*
@@ -862,10 +838,21 @@ new file mode 100644
 +int ngx_bpf_map_lookup(int fd, const void *key, void *value);
 +
 +#endif /* _NGX_BPF_H_INCLUDED_ */
-diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
---- a/src/core/ngx_connection.c
-+++ b/src/core/ngx_connection.c
-@@ -1037,6 +1037,12 @@ ngx_close_listening_sockets(ngx_cycle_t 
+diff -r fecd73db563f src/core/ngx_connection.c
+--- a/src/core/ngx_connection.c	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/core/ngx_connection.c	Thu Jun 23 13:33:29 2022 -0400
+@@ -72,10 +72,6 @@ ngx_create_listening(ngx_conf_t *cf, str
+ 
+     ngx_memcpy(ls->addr_text.data, text, len);
+ 
+-#if !(NGX_WIN32)
+-    ngx_rbtree_init(&ls->rbtree, &ls->sentinel, ngx_udp_rbtree_insert_value);
+-#endif
+-
+     ls->fd = (ngx_socket_t) -1;
+     ls->type = SOCK_STREAM;
+ 
+@@ -1037,6 +1033,12 @@ ngx_close_listening_sockets(ngx_cycle_t 
      ls = cycle->listening.elts;
      for (i = 0; i < cycle->listening.nelts; i++) {
  
@@ -878,9 +865,9 @@ diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
          c = ls[i].connection;
  
          if (c) {
-diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
---- a/src/core/ngx_connection.h
-+++ b/src/core/ngx_connection.h
+diff -r fecd73db563f src/core/ngx_connection.h
+--- a/src/core/ngx_connection.h	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/core/ngx_connection.h	Thu Jun 23 13:33:29 2022 -0400
 @@ -73,6 +73,7 @@ struct ngx_listening_s {
      unsigned            reuseport:1;
      unsigned            add_reuseport:1;
@@ -900,9 +887,9 @@ diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
  #if (NGX_SSL || NGX_COMPAT)
      ngx_ssl_connection_t  *ssl;
  #endif
-diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
---- a/src/core/ngx_core.h
-+++ b/src/core/ngx_core.h
+diff -r fecd73db563f src/core/ngx_core.h
+--- a/src/core/ngx_core.h	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/core/ngx_core.h	Thu Jun 23 13:33:29 2022 -0400
 @@ -27,6 +27,7 @@ typedef struct ngx_connection_s      ngx
  typedef struct ngx_thread_task_s     ngx_thread_task_t;
  typedef struct ngx_ssl_s             ngx_ssl_t;
@@ -931,9 +918,9 @@ diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
  
  
  #define LF     (u_char) '\n'
-diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
---- a/src/event/ngx_event.c
-+++ b/src/event/ngx_event.c
+diff -r fecd73db563f src/event/ngx_event.c
+--- a/src/event/ngx_event.c	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/event/ngx_event.c	Thu Jun 23 13:33:29 2022 -0400
 @@ -267,6 +267,18 @@ ngx_process_events_and_timers(ngx_cycle_
  ngx_int_t
  ngx_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
@@ -971,33 +958,28 @@ diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
          if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
              return NGX_ERROR;
          }
-diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
---- a/src/event/ngx_event.h
-+++ b/src/event/ngx_event.h
-@@ -494,12 +494,6 @@ extern ngx_module_t           ngx_event_
+@@ -868,8 +886,16 @@ ngx_event_process_init(ngx_cycle_t *cycl
  
+ #else
  
- void ngx_event_accept(ngx_event_t *ev);
--#if !(NGX_WIN32)
--void ngx_event_recvmsg(ngx_event_t *ev);
--void ngx_udp_rbtree_insert_value(ngx_rbtree_node_t *temp,
--    ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
--#endif
--void ngx_delete_udp_connection(void *data);
- ngx_int_t ngx_trylock_accept_mutex(ngx_cycle_t *cycle);
- ngx_int_t ngx_enable_accept_events(ngx_cycle_t *cycle);
- u_char *ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len);
-@@ -529,6 +523,7 @@ ngx_int_t ngx_send_lowat(ngx_connection_
+-        rev->handler = (c->type == SOCK_STREAM) ? ngx_event_accept
+-                                                : ngx_event_recvmsg;
++        if (c->type == SOCK_STREAM) {
++            rev->handler = ngx_event_accept;
++
++#if (NGX_QUIC)
++        } else if (ls[i].quic) {
++            rev->handler = ngx_quic_recvmsg;
++#endif
++        } else {
++            rev->handler = ngx_event_recvmsg;
++        }
  
- #include <ngx_event_timer.h>
- #include <ngx_event_posted.h>
-+#include <ngx_event_udp.h>
+ #if (NGX_HAVE_REUSEPORT)
  
- #if (NGX_WIN32)
- #include <ngx_iocp_module.h>
-diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
---- a/src/event/ngx_event_openssl.c
-+++ b/src/event/ngx_event_openssl.c
+diff -r fecd73db563f src/event/ngx_event_openssl.c
+--- a/src/event/ngx_event_openssl.c	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/event/ngx_event_openssl.c	Thu Jun 23 13:33:29 2022 -0400
 @@ -3149,6 +3149,13 @@ ngx_ssl_shutdown(ngx_connection_t *c)
      ngx_err_t   err;
      ngx_uint_t  tries;
@@ -1012,9 +994,9 @@ diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
      rc = NGX_OK;
  
      ngx_ssl_ocsp_cleanup(c);
-diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
---- a/src/event/ngx_event_openssl.h
-+++ b/src/event/ngx_event_openssl.h
+diff -r fecd73db563f src/event/ngx_event_openssl.h
+--- a/src/event/ngx_event_openssl.h	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/event/ngx_event_openssl.h	Thu Jun 23 13:33:29 2022 -0400
 @@ -24,6 +24,14 @@
  #include <openssl/engine.h>
  #endif
@@ -1030,10 +1012,10 @@ diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
  #include <openssl/hmac.h>
  #ifndef OPENSSL_NO_OCSP
  #include <openssl/ocsp.h>
-diff --git a/src/event/ngx_event_udp.c b/src/event/ngx_event_udp.c
---- a/src/event/ngx_event_udp.c
-+++ b/src/event/ngx_event_udp.c
-@@ -12,52 +12,37 @@
+diff -r fecd73db563f src/event/ngx_event_udp.c
+--- a/src/event/ngx_event_udp.c	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/event/ngx_event_udp.c	Thu Jun 23 13:33:29 2022 -0400
+@@ -12,13 +12,6 @@
  
  #if !(NGX_WIN32)
  
@@ -1047,562 +1029,26 @@ diff --git a/src/event/ngx_event_udp.c b/src/event/ngx_event_udp.c
  static void ngx_close_accepted_udp_connection(ngx_connection_t *c);
  static ssize_t ngx_udp_shared_recv(ngx_connection_t *c, u_char *buf,
      size_t size);
--static ngx_int_t ngx_insert_udp_connection(ngx_connection_t *c);
-+static ngx_int_t ngx_create_udp_connection(ngx_connection_t *c);
- static ngx_connection_t *ngx_lookup_udp_connection(ngx_listening_t *ls,
--    struct sockaddr *sockaddr, socklen_t socklen,
--    struct sockaddr *local_sockaddr, socklen_t local_socklen);
-+    ngx_str_t *key, struct sockaddr *local_sockaddr, socklen_t local_socklen);
- 
- 
- void
- ngx_event_recvmsg(ngx_event_t *ev)
- {
-+    size_t             len;
-     ssize_t            n;
-+    ngx_str_t          key;
-     ngx_buf_t          buf;
-     ngx_log_t         *log;
-     ngx_err_t          err;
--    socklen_t          socklen, local_socklen;
-+    socklen_t          local_socklen;
-     ngx_event_t       *rev, *wev;
-     struct iovec       iov[1];
-     struct msghdr      msg;
-     ngx_sockaddr_t     sa, lsa;
--    struct sockaddr   *sockaddr, *local_sockaddr;
-+    ngx_udp_dgram_t    dgram;
-+    struct sockaddr   *local_sockaddr;
-     ngx_listening_t   *ls;
-     ngx_event_conf_t  *ecf;
-     ngx_connection_t  *c, *lc;
-     static u_char      buffer[65535];
- 
--#if (NGX_HAVE_MSGHDR_MSG_CONTROL)
--
--#if (NGX_HAVE_IP_RECVDSTADDR)
--    u_char             msg_control[CMSG_SPACE(sizeof(struct in_addr))];
--#elif (NGX_HAVE_IP_PKTINFO)
--    u_char             msg_control[CMSG_SPACE(sizeof(struct in_pktinfo))];
--#endif
--
--#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO)
--    u_char             msg_control6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
--#endif
--
-+#if (NGX_HAVE_ADDRINFO_CMSG)
-+    u_char             msg_control[CMSG_SPACE(sizeof(ngx_addrinfo_t))];
- #endif
- 
-     if (ev->timedout) {
-@@ -92,25 +77,13 @@ ngx_event_recvmsg(ngx_event_t *ev)
-         msg.msg_iov = iov;
-         msg.msg_iovlen = 1;
- 
--#if (NGX_HAVE_MSGHDR_MSG_CONTROL)
--
-+#if (NGX_HAVE_ADDRINFO_CMSG)
-         if (ls->wildcard) {
-+            msg.msg_control = &msg_control;
-+            msg.msg_controllen = sizeof(msg_control);
- 
--#if (NGX_HAVE_IP_RECVDSTADDR || NGX_HAVE_IP_PKTINFO)
--            if (ls->sockaddr->sa_family == AF_INET) {
--                msg.msg_control = &msg_control;
--                msg.msg_controllen = sizeof(msg_control);
--            }
--#endif
--
--#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO)
--            if (ls->sockaddr->sa_family == AF_INET6) {
--                msg.msg_control = &msg_control6;
--                msg.msg_controllen = sizeof(msg_control6);
--            }
--#endif
--        }
--
-+            ngx_memzero(&msg_control, sizeof(msg_control));
-+       }
- #endif
- 
-         n = recvmsg(lc->fd, &msg, 0);
-@@ -129,7 +102,7 @@ ngx_event_recvmsg(ngx_event_t *ev)
-             return;
-         }
- 
--#if (NGX_HAVE_MSGHDR_MSG_CONTROL)
-+#if (NGX_HAVE_ADDRINFO_CMSG)
-         if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) {
-             ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
-                           "recvmsg() truncated data");
-@@ -137,21 +110,21 @@ ngx_event_recvmsg(ngx_event_t *ev)
-         }
- #endif
- 
--        sockaddr = msg.msg_name;
--        socklen = msg.msg_namelen;
-+        dgram.sockaddr = msg.msg_name;
-+        dgram.socklen = msg.msg_namelen;
- 
--        if (socklen > (socklen_t) sizeof(ngx_sockaddr_t)) {
--            socklen = sizeof(ngx_sockaddr_t);
-+        if (dgram.socklen > (socklen_t) sizeof(ngx_sockaddr_t)) {
-+            dgram.socklen = sizeof(ngx_sockaddr_t);
-         }
- 
--        if (socklen == 0) {
-+        if (dgram.socklen == 0) {
- 
-             /*
-              * on Linux recvmsg() returns zero msg_namelen
-              * when receiving packets from unbound AF_UNIX sockets
-              */
- 
--            socklen = sizeof(struct sockaddr);
-+            dgram.socklen = sizeof(struct sockaddr);
-             ngx_memzero(&sa, sizeof(struct sockaddr));
-             sa.sockaddr.sa_family = ls->sockaddr->sa_family;
-         }
-@@ -159,7 +132,7 @@ ngx_event_recvmsg(ngx_event_t *ev)
-         local_sockaddr = ls->sockaddr;
-         local_socklen = ls->socklen;
- 
--#if (NGX_HAVE_MSGHDR_MSG_CONTROL)
-+#if (NGX_HAVE_ADDRINFO_CMSG)
- 
-         if (ls->wildcard) {
-             struct cmsghdr  *cmsg;
-@@ -171,66 +144,43 @@ ngx_event_recvmsg(ngx_event_t *ev)
-                  cmsg != NULL;
-                  cmsg = CMSG_NXTHDR(&msg, cmsg))
-             {
--
--#if (NGX_HAVE_IP_RECVDSTADDR)
--
--                if (cmsg->cmsg_level == IPPROTO_IP
--                    && cmsg->cmsg_type == IP_RECVDSTADDR
--                    && local_sockaddr->sa_family == AF_INET)
--                {
--                    struct in_addr      *addr;
--                    struct sockaddr_in  *sin;
--
--                    addr = (struct in_addr *) CMSG_DATA(cmsg);
--                    sin = (struct sockaddr_in *) local_sockaddr;
--                    sin->sin_addr = *addr;
--
-+                if (ngx_get_srcaddr_cmsg(cmsg, local_sockaddr) == NGX_OK) {
-                     break;
-                 }
--
--#elif (NGX_HAVE_IP_PKTINFO)
--
--                if (cmsg->cmsg_level == IPPROTO_IP
--                    && cmsg->cmsg_type == IP_PKTINFO
--                    && local_sockaddr->sa_family == AF_INET)
--                {
--                    struct in_pktinfo   *pkt;
--                    struct sockaddr_in  *sin;
--
--                    pkt = (struct in_pktinfo *) CMSG_DATA(cmsg);
--                    sin = (struct sockaddr_in *) local_sockaddr;
--                    sin->sin_addr = pkt->ipi_addr;
--
--                    break;
--                }
--
--#endif
--
--#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO)
--
--                if (cmsg->cmsg_level == IPPROTO_IPV6
--                    && cmsg->cmsg_type == IPV6_PKTINFO
--                    && local_sockaddr->sa_family == AF_INET6)
--                {
--                    struct in6_pktinfo   *pkt6;
--                    struct sockaddr_in6  *sin6;
--
--                    pkt6 = (struct in6_pktinfo *) CMSG_DATA(cmsg);
--                    sin6 = (struct sockaddr_in6 *) local_sockaddr;
--                    sin6->sin6_addr = pkt6->ipi6_addr;
--
--                    break;
--                }
--
--#endif
--
-             }
-         }
- 
- #endif
- 
--        c = ngx_lookup_udp_connection(ls, sockaddr, socklen, local_sockaddr,
--                                      local_socklen);
-+        key.data = (u_char *) dgram.sockaddr;
-+        key.len = dgram.socklen;
-+
-+#if (NGX_HAVE_UNIX_DOMAIN)
-+
-+        if (dgram.sockaddr->sa_family == AF_UNIX) {
-+            struct sockaddr_un *saun = (struct sockaddr_un *) dgram.sockaddr;
-+
-+            if (dgram.socklen <= (socklen_t) offsetof(struct sockaddr_un,
-+                                                      sun_path)
-+                || saun->sun_path[0] == '\0')
-+            {
-+                ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0,
-+                               "unbound unix socket");
-+                key.len = 0;
-+            }
-+        }
-+
-+#endif
-+
-+#if (NGX_QUIC)
-+        if (ls->quic) {
-+            if (ngx_quic_get_packet_dcid(ev->log, buffer, n, &key) != NGX_OK) {
-+                goto next;
-+            }
-+        }
-+#endif
-+
-+        c = ngx_lookup_udp_connection(ls, &key, local_sockaddr, local_socklen);
- 
-         if (c) {
- 
-@@ -252,10 +202,14 @@ ngx_event_recvmsg(ngx_event_t *ev)
- 
-             buf.pos = buffer;
-             buf.last = buffer + n;
-+            buf.start = buf.pos;
-+            buf.end = buffer + sizeof(buffer);
- 
-             rev = c->read;
- 
--            c->udp->buffer = &buf;
-+            dgram.buffer = &buf;
-+
-+            c->udp->dgram = &dgram;
- 
-             rev->ready = 1;
-             rev->active = 0;
-@@ -263,7 +217,7 @@ ngx_event_recvmsg(ngx_event_t *ev)
-             rev->handler(rev);
- 
-             if (c->udp) {
--                c->udp->buffer = NULL;
-+                c->udp->dgram = NULL;
-             }
- 
-             rev->ready = 0;
-@@ -286,7 +240,7 @@ ngx_event_recvmsg(ngx_event_t *ev)
- 
-         c->shared = 1;
-         c->type = SOCK_DGRAM;
--        c->socklen = socklen;
-+        c->socklen = dgram.socklen;
- 
- #if (NGX_STAT_STUB)
-         (void) ngx_atomic_fetch_add(ngx_stat_active, 1);
-@@ -298,13 +252,21 @@ ngx_event_recvmsg(ngx_event_t *ev)
-             return;
-         }
- 
--        c->sockaddr = ngx_palloc(c->pool, socklen);
-+        len = dgram.socklen;
-+
-+#if (NGX_QUIC)
-+        if (ls->quic) {
-+            len = NGX_SOCKADDRLEN;
-+        }
-+#endif
-+
-+        c->sockaddr = ngx_palloc(c->pool, len);
-         if (c->sockaddr == NULL) {
-             ngx_close_accepted_udp_connection(c);
-             return;
-         }
- 
--        ngx_memcpy(c->sockaddr, sockaddr, socklen);
-+        ngx_memcpy(c->sockaddr, dgram.sockaddr, dgram.socklen);
- 
-         log = ngx_palloc(c->pool, sizeof(ngx_log_t));
-         if (log == NULL) {
-@@ -405,7 +367,7 @@ ngx_event_recvmsg(ngx_event_t *ev)
-         }
+diff -r fecd73db563f src/event/ngx_event_udp.h
+--- a/src/event/ngx_event_udp.h	Tue Jun 21 17:25:37 2022 +0300
++++ b/src/event/ngx_event_udp.h	Thu Jun 23 13:33:29 2022 -0400
+@@ -23,6 +23,13 @@
  #endif
  
--        if (ngx_insert_udp_connection(c) != NGX_OK) {
-+        if (ngx_create_udp_connection(c) != NGX_OK) {
-             ngx_close_accepted_udp_connection(c);
-             return;
-         }
-@@ -448,17 +410,17 @@ ngx_udp_shared_recv(ngx_connection_t *c,
-     ssize_t     n;
-     ngx_buf_t  *b;
- 
--    if (c->udp == NULL || c->udp->buffer == NULL) {
-+    if (c->udp == NULL || c->udp->dgram == NULL) {
-         return NGX_AGAIN;
-     }
- 
--    b = c->udp->buffer;
-+    b = c->udp->dgram->buffer;
- 
-     n = ngx_min(b->last - b->pos, (ssize_t) size);
- 
-     ngx_memcpy(buf, b->pos, n);
- 
--    c->udp->buffer = NULL;
-+    c->udp->dgram = NULL;
- 
-     c->read->ready = 0;
-     c->read->active = 1;
-@@ -494,8 +456,8 @@ ngx_udp_rbtree_insert_value(ngx_rbtree_n
-             udpt = (ngx_udp_connection_t *) temp;
-             ct = udpt->connection;
- 
--            rc = ngx_cmp_sockaddr(c->sockaddr, c->socklen,
--                                  ct->sockaddr, ct->socklen, 1);
-+            rc = ngx_memn2cmp(udp->key.data, udpt->key.data,
-+                              udp->key.len, udpt->key.len);
- 
-             if (rc == 0 && c->listening->wildcard) {
-                 rc = ngx_cmp_sockaddr(c->local_sockaddr, c->local_socklen,
-@@ -521,12 +483,18 @@ ngx_udp_rbtree_insert_value(ngx_rbtree_n
- 
- 
- static ngx_int_t
--ngx_insert_udp_connection(ngx_connection_t *c)
-+ngx_create_udp_connection(ngx_connection_t *c)
- {
--    uint32_t               hash;
-+    ngx_str_t              key;
-     ngx_pool_cleanup_t    *cln;
-     ngx_udp_connection_t  *udp;
- 
-+#if (NGX_QUIC)
-+    if (c->listening->quic) {
-+        return NGX_OK;
-+    }
-+#endif
-+
-     if (c->udp) {
-         return NGX_OK;
-     }
-@@ -536,19 +504,6 @@ ngx_insert_udp_connection(ngx_connection
-         return NGX_ERROR;
-     }
- 
--    udp->connection = c;
--
--    ngx_crc32_init(hash);
--    ngx_crc32_update(&hash, (u_char *) c->sockaddr, c->socklen);
--
--    if (c->listening->wildcard) {
--        ngx_crc32_update(&hash, (u_char *) c->local_sockaddr, c->local_socklen);
--    }
--
--    ngx_crc32_final(hash);
--
--    udp->node.key = hash;
--
-     cln = ngx_pool_cleanup_add(c->pool, 0);
-     if (cln == NULL) {
-         return NGX_ERROR;
-@@ -557,7 +512,10 @@ ngx_insert_udp_connection(ngx_connection
-     cln->data = c;
-     cln->handler = ngx_delete_udp_connection;
- 
--    ngx_rbtree_insert(&c->listening->rbtree, &udp->node);
-+    key.data = (u_char *) c->sockaddr;
-+    key.len = c->socklen;
-+
-+    ngx_insert_udp_connection(c, udp, &key);
- 
-     c->udp = udp;
- 
-@@ -566,6 +524,30 @@ ngx_insert_udp_connection(ngx_connection
- 
- 
- void
-+ngx_insert_udp_connection(ngx_connection_t *c, ngx_udp_connection_t *udp,
-+    ngx_str_t *key)
-+{
-+    uint32_t  hash;
-+
-+    ngx_crc32_init(hash);
-+
-+    ngx_crc32_update(&hash, key->data, key->len);
-+
-+    if (c->listening->wildcard) {
-+        ngx_crc32_update(&hash, (u_char *) c->local_sockaddr, c->local_socklen);
-+    }
-+
-+    ngx_crc32_final(hash);
-+
-+    udp->connection = c;
-+    udp->key = *key;
-+    udp->node.key = hash;
-+
-+    ngx_rbtree_insert(&c->listening->rbtree, &udp->node);
-+}
-+
-+
-+void
- ngx_delete_udp_connection(void *data)
- {
-     ngx_connection_t  *c = data;
-@@ -581,8 +563,8 @@ ngx_delete_udp_connection(void *data)
- 
- 
- static ngx_connection_t *
--ngx_lookup_udp_connection(ngx_listening_t *ls, struct sockaddr *sockaddr,
--    socklen_t socklen, struct sockaddr *local_sockaddr, socklen_t local_socklen)
-+ngx_lookup_udp_connection(ngx_listening_t *ls, ngx_str_t *key,
-+    struct sockaddr *local_sockaddr, socklen_t local_socklen)
- {
-     uint32_t               hash;
-     ngx_int_t              rc;
-@@ -590,27 +572,15 @@ ngx_lookup_udp_connection(ngx_listening_
-     ngx_rbtree_node_t     *node, *sentinel;
-     ngx_udp_connection_t  *udp;
- 
--#if (NGX_HAVE_UNIX_DOMAIN)
--
--    if (sockaddr->sa_family == AF_UNIX) {
--        struct sockaddr_un *saun = (struct sockaddr_un *) sockaddr;
--
--        if (socklen <= (socklen_t) offsetof(struct sockaddr_un, sun_path)
--            || saun->sun_path[0] == '\0')
--        {
--            ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0,
--                           "unbound unix socket");
--            return NULL;
--        }
-+    if (key->len == 0) {
-+        return NULL;
-     }
- 
--#endif
--
-     node = ls->rbtree.root;
-     sentinel = ls->rbtree.sentinel;
- 
-     ngx_crc32_init(hash);
--    ngx_crc32_update(&hash, (u_char *) sockaddr, socklen);
-+    ngx_crc32_update(&hash, key->data, key->len);
- 
-     if (ls->wildcard) {
-         ngx_crc32_update(&hash, (u_char *) local_sockaddr, local_socklen);
-@@ -636,8 +606,7 @@ ngx_lookup_udp_connection(ngx_listening_
- 
-         c = udp->connection;
- 
--        rc = ngx_cmp_sockaddr(sockaddr, socklen,
--                              c->sockaddr, c->socklen, 1);
-+        rc = ngx_memn2cmp(key->data, udp->key.data, key->len, udp->key.len);
- 
-         if (rc == 0 && ls->wildcard) {
-             rc = ngx_cmp_sockaddr(local_sockaddr, local_socklen,
-@@ -645,6 +614,13 @@ ngx_lookup_udp_connection(ngx_listening_
-         }
- 
-         if (rc == 0) {
-+
-+#if (NGX_QUIC)
-+            if (ls->quic && c->udp != udp) {
-+                c->udp = udp;
-+            }
-+#endif
-+
-             return c;
-         }
  
-diff --git a/src/event/ngx_event_udp.h b/src/event/ngx_event_udp.h
-new file mode 100644
*** 3961 LINES SKIPPED ***