aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* QUIC: do not block ACKs by congestion control.HEADmasterSergey Kandaurov2025-04-29
| | | | | | | | | | | | | | | | | | | | Previously, it was not possible to send acknowledgments if the congestion window was limited or temporarily exceeded, such as after sending a large response or MTU probe. If ACKs were not received from the peer for some reason to update the in-flight bytes counter below the congestion window, this might result in a stalled connection. The fix is to send ACKs regardless of congestion control. This meets RFC 9002, Section 7: : Similar to TCP, packets containing only ACK frames do not count : toward bytes in flight and are not congestion controlled. This is a simplified implementation to send ACK frames from the head of the queue. This was made possible after 6f5f17358. Reported in trac ticket #2621 and subsequently by Vladimir Homutov: https://mailman.nginx.org/pipermail/nginx-devel/2025-April/ZKBAWRJVQXSZ2ISG3YJAF3EWMDRDHCMO.html
* SSL: fixed build with OPENSSL_NO_DH.Sergey Kandaurov2025-04-25
|
* SSL: fixed build with OPENSSL_NO_DEPRECATED.Sergey Kandaurov2025-04-25
|
* QUIC: fixed a typo.nandsky2025-04-23
|
* Win32: added detection of ARM64 target.Aleksei Bavshin2025-04-18
| | | | | | | | | | | This extends the target selection implemented in dad6ec3aa63f to support Windows ARM64 platforms. OpenSSL support for VC-WIN64-ARM target first appeared in 1.1.1 and is present in all currently supported (3.x) branches. As a side effect, ARM64 Windows builds will get 16-byte alignment along with the rest of non-x86 platforms. This is safe, as malloc on 64-bit Windows guarantees the fundamental alignment of allocations, 16 bytes.
* Core: improved NGX_ALIGNMENT detection on some x86_64 platforms.Aleksei Bavshin2025-04-18
| | | | | | | | | | | | | | | Previously, the default pool alignment used sizeof(unsigned long), with the expectation that this would match to a platform word size. Certain 64-bit platforms prove this assumption wrong by keeping the 32-bit long type, which is fully compliant with the C standard. This introduces a possibility of suboptimal misaligned access to the data allocated with ngx_palloc() on the affected platforms, which is addressed here by changing the default NGX_ALIGNMENT to a pointer size. As we override the detection in auto/os/conf for all the machine types except x86, and Unix-like 64-bit systems prefer the 64-bit long, the impact of the change should be limited to Win64 x64.
* HTTP/3: fixed NGX_HTTP_V3_VARLEN_INT_LEN value.Roman Arutyunyan2025-04-18
| | | | | | | | | | | | | After fixing ngx_http_v3_encode_varlen_int() in 400eb1b628, NGX_HTTP_V3_VARLEN_INT_LEN retained the old value of 4, which is insufficient for the values over 1073741823 (1G - 1). The NGX_HTTP_V3_VARLEN_INT_LEN macro is used in ngx_http_v3_uni.c to format stream and frame types. Old buffer size is enough for formatting this data. Also, the macro is used in ngx_http_v3_filter_module.c to format output chunks and trailers. Considering output_buffers and proxy_buffer_size are below 1G in all realistic scenarios, the old buffer size is enough here as well.
* Fixed -Wunterminated-string-initialization with gcc15.Roman Arutyunyan2025-04-17
|
* QUIC: lowered log level for unsupported transport parameters.Roman Arutyunyan2025-04-17
|
* Version bump.Roman Arutyunyan2025-04-16
|
* nginx-1.27.5-RELEASErelease-1.27.5Sergey Kandaurov2025-04-16
|
* QUIC: dynamic packet threshold.Roman Arutyunyan2025-04-15
| | | | | | | | | | | RFC 9002, Section 6.1.1 defines packet reordering threshold as 3. Testing shows that such low value leads to spurious packet losses followed by congestion window collapse. The change implements dynamic packet threshold detection based on in-flight packet range. Packet threshold is defined as half the number of in-flight packets, with mininum value of 3. Also, renamed ngx_quic_lost_threshold() to ngx_quic_time_threshold() for better compliance with RFC 9002 terms.
* QUIC: optimized connection frame threshold.Roman Arutyunyan2025-04-15
| | | | | | | | | | | | | | | | Previosly the threshold was hardcoded at 10000. This value is too low for high BDP networks. For example, if all frames are STREAM frames, and MTU is 1500, the upper limit for congestion window would be roughly 15M (10000 * 1500). With 100ms RTT it's just a 1.2Gbps network (15M * 10 * 8). In reality, the limit is even lower because of other frame types. Also, the number of frames that could be used simultaneously depends on the total amount of data buffered in all server streams, and client flow control. The change sets frame threshold based on max concurrent streams and stream buffer size, the product of which is the maximum number of in-flight stream data in all server streams at any moment. The value is divided by 2000 to account for a typical MTU 1500 and the fact that not all frames are STREAM frames.
* QUIC: CUBIC congestion control.Roman Arutyunyan2025-04-15
|
* QUIC: ignore congestion control when sending MTU probes.Roman Arutyunyan2025-04-15
| | | | | | | | If connection is network-limited, MTU probes have little chance of being sent since congestion window is almost always full. As a result, PMTUD may not be able to reach the real MTU and the connection may operate with a reduced MTU. The solution is to ignore the congestion window. This may lead to a temporary increase in in-flight count beyond congestion window.
* QUIC: do not shrink congestion window after losing an MTU probe.Roman Arutyunyan2025-04-15
| | | | | | | | As per RFC 9000, Section 14.4: Loss of a QUIC packet that is carried in a PMTU probe is therefore not a reliable indication of congestion and SHOULD NOT trigger a congestion control reaction.
* QUIC: do not increase underutilized congestion window.Roman Arutyunyan2025-04-15
| | | | | As per RFC 9002, Section 7.8, congestion window should not be increased when it's underutilized.
* QUIC: all-levels commit and revert functions.Roman Arutyunyan2025-04-15
| | | | | | Previously, these functions operated on a per-level basis. This however resulted in excessive logging of in_flight and will also led to extra work detecting underutilized congestion window in the followup patches.
* QUIC: ngx_msec_t overflow protection.Roman Arutyunyan2025-04-15
| | | | | | | | | | | | On some systems the value of ngx_current_msec is derived from monotonic clock, for which the following is defined by POSIX: For this clock, the value returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since an unspecified point in the past. As as result, overflow protection is needed when comparing two ngx_msec_t. The change adds such protection to the ngx_quic_detect_lost() function.
* QUIC: prevent spurious congestion control recovery mode.Roman Arutyunyan2025-04-15
| | | | | | | | | | | | | | | | | Since recovery_start field was initialized with ngx_current_msec, all congestion events that happened within the same millisecond or cycle iteration, were treated as in recovery mode. Also, when handling persistent congestion, initializing recovery_start with ngx_current_msec resulted in treating all sent packets as in recovery mode, which violates RFC 9002, see example in Appendix B.8. While here, also fixed recovery_start wrap protection. Previously it used 2 * max_idle_timeout time frame for all sent frames, which is not a reliable protection since max_idle_timeout is unrelated to congestion control. Now recovery_start <= now condition is enforced. Note that recovery_start wrap is highly unlikely and can only occur on a 32-bit system if there are no congestion events for 24 days.
* QUIC: use path MTU in congestion window computations.Roman Arutyunyan2025-04-15
| | | | | As per RFC 9002, Section B.2, max_datagram_size used in congestion window computations should be based on path MTU.
* HTTP/3: graceful shutdown on keepalive timeout expiration.Roman Arutyunyan2025-04-15
| | | | | | | | | | Previously, the expiration caused QUIC connection finalization even if there are application-terminated streams finishing sending data. Such finalization terminated these streams. An easy way to trigger this is to request a large file from HTTP/3 over a small MTU. In this case keepalive timeout expiration may abruptly terminate the request stream.
* QUIC: graph-friendly congestion control logging.Roman Arutyunyan2025-04-15
| | | | | | | | Improved logging for simpler data extraction for plotting congestion window graphs. In particular, added current milliseconds number from ngx_current_msec. While here, simplified logging text and removed irrelevant data.
* SSL: external groups support in $ssl_curve and $ssl_curves.Sergey Kandaurov2025-04-10
| | | | | | | | | | | | | | | | | | Starting with OpenSSL 3.0, groups may be added externally with pluggable KEM providers. Using SSL_get_negotiated_group(), which makes lookup in a static table with known groups, doesn't allow to list such groups by names leaving them in hex. Adding X25519MLKEM768 to the default group list in OpenSSL 3.5 made this problem more visible. SSL_get0_group_name() and, apparently, SSL_group_to_name() allow to resolve such provider-implemented groups, which is also "generally preferred" over SSL_get_negotiated_group() as documented in OpenSSL git commit 93d4f6133f. This change makes external groups listing by name using SSL_group_to_name() available since OpenSSL 3.0. To preserve "prime256v1" naming for the group 0x0017, and to avoid breaking BoringSSL and older OpenSSL versions support, it is used supplementary for a group that appears to be unknown. See https://github.com/openssl/openssl/issues/27137 for related discussion.
* Upstream: fixed passwords support for dynamic certificates.Sergey Kandaurov2025-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passwords were not preserved in optimized SSL contexts, the bug had appeared in d791b4aab (1.23.1), as in the following configuration: server { proxy_ssl_password_file password; proxy_ssl_certificate $ssl_server_name.crt; proxy_ssl_certificate_key $ssl_server_name.key; location /original/ { proxy_pass https://u1/; } location /optimized/ { proxy_pass https://u2/; } } The fix is to always preserve passwords, by copying to the configuration pool, if dynamic certificates are used. This is done as part of merging "ssl_passwords" configuration. To minimize the number of copies, a preserved version is then used for inheritance. A notable exception is inheritance of preserved empty passwords to the context with statically configured certificates: server { proxy_ssl_certificate $ssl_server_name.crt; proxy_ssl_certificate_key $ssl_server_name.key; location / { proxy_pass ...; proxy_ssl_certificate example.com.crt; proxy_ssl_certificate_key example.com.key; } } In this case, an unmodified version (NULL) of empty passwords is set, to allow reading them from the password prompt on nginx startup. As an additional optimization, a preserved instance of inherited configured passwords is set to the previous level, to inherit it to other contexts: server { proxy_ssl_password_file password; location /1/ { proxy_pass https://u1/; proxy_ssl_certificate $ssl_server_name.crt; proxy_ssl_certificate_key $ssl_server_name.key; } location /2/ { proxy_pass https://u2/; proxy_ssl_certificate $ssl_server_name.crt; proxy_ssl_certificate_key $ssl_server_name.key; } }
* Charset filter: improved validation of charset_map with utf-8.Sergey Kandaurov2025-04-09
| | | | | | | | | | | | | | | It was possible to write outside of the buffer used to keep UTF-8 decoded values when parsing conversion table configuration. Since this happened before UTF-8 decoding, the fix is to check in advance if character codes are of more than 3-byte sequence. Note that this is already enforced by a later check for ngx_utf8_decode() decoded values for 0xffff, which corresponds to the maximum value encoded as a valid 3-byte sequence, so the fix does not affect the valid values. Found with AddressSanitizer. Fixes GitHub issue #529.
* Slice filter: improved memory allocation error handling.Sergey Kandaurov2025-03-10
| | | | | | | | As uncovered by recent addition in slice.t, a partially initialized context, coupled with HTTP 206 response from stub backend, might be accessed in the next slice subrequest. Found by bad memory allocator simulation.
* SSL: removed stale comments.Sergey Kandaurov2025-02-26
| | | | It appears to be a relic from prototype locking removed in b0b7b5a35.
* SSL: improved logging of saving sessions from upstream servers.Sergey Kandaurov2025-02-26
| | | | | This makes it easier to understand why sessions may not be saved in shared memory due to size.
* SSL: raised limit for sessions stored in shared memory.Sergey Kandaurov2025-02-26
| | | | | | | | | | | | | | Upstream SSL sessions may be of a noticeably larger size with tickets in TLSv1.2 and older versions, or with "stateless" tickets in TLSv1.3, if a client certificate is saved into the session. Further, certain stateless session resumption implemetations may store additional data. Such one is JDK, known to also include server certificates in session ticket data, which roughly doubles a decoded session size to slightly beyond the previous limit. While it's believed to be an issue on the JDK side, this change allows to save such sessions. Another, innocent case is using RSA certificates with 8192 key size.
* SSL: using static storage for NGX_SSL_MAX_SESSION_SIZE buffers.Sergey Kandaurov2025-02-26
| | | | | | All such transient buffers are converted to the single storage in BSS. In preparation to raise the limit.
* SSL: style.Sergey Kandaurov2025-02-26
|
* Improved ngx_http_subrequest() error handling.Sergey Kandaurov2025-02-21
| | | | | | | | | | | Previously, request might be left in inconsistent state in case of error, which manifested in "http request count is zero" alerts when used by SSI filter. The fix is to reshuffle initialization order to postpone committing state changes until after any potentially failing parts. Found by bad memory allocator simulation.
* Add gitignore file.Orgad Shaneh2025-02-20
|
* Configure: MSVC compatibility with PCRE2 10.45.Thierry Bastian2025-02-18
|
* Core: fix build without libcrypt.Piotr Sikora2025-02-18
| | | | | | libcrypt is no longer part of glibc, so it might not be available. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
* Version bump.Sergey Kandaurov2025-02-18
|
* nginx-1.27.4-RELEASErelease-1.27.4Sergey Kandaurov2025-02-05
|
* SNI: added restriction for TLSv1.3 cross-SNI session resumption.Sergey Kandaurov2025-02-05
| | | | | | | | | | | | | | | | | In OpenSSL, session resumption always happens in the default SSL context, prior to invoking the SNI callback. Further, unlike in TLSv1.2 and older protocols, SSL_get_servername() returns values received in the resumption handshake, which may be different from the value in the initial handshake. Notably, this makes the restriction added in b720f650b insufficient for sessions resumed with different SNI server name. Considering the example from b720f650b, previously, a client was able to request example.org by presenting a certificate for example.org, then to resume and request example.com. The fix is to reject handshakes resumed with a different server name, if verification of client certificates is enabled in a corresponding server configuration.
* Added "keepalive_min_timeout" directive.Roman Arutyunyan2025-02-05
| | | | | | | | | | | | | | | | | The directive sets a timeout during which a keepalive connection will not be closed by nginx for connection reuse or graceful shutdown. The change allows clients that send multiple requests over the same connection without delay or with a small delay between them, to avoid receiving a TCP RST in response to one of them. This excludes network issues and non-graceful shutdown. As a side-effect, it also addresses the TCP reset problem described in RFC 9112, Section 9.6, when the last sent HTTP response could be damaged by a followup TCP RST. It is important for non-idempotent requests, which cannot be retried by client. It is not recommended to set keepalive_min_timeout to large values as this can introduce an additional delay during graceful shutdown and may restrict nginx from effective connection reuse.
* Misc: moved documentation in generated ZIP archive.Sergey Kandaurov2025-01-30
| | | | The recently added GitHub files now reside in the docs directory.
* Configure: fixed --with-libatomic=DIR with recent libatomic_ops.Sergey Kandaurov2025-01-30
| | | | | | | | | The build location of the resulting libatomic_ops.a was changed in v7.4.0 after converting libatomic_ops to use libtool. The fix is to use library from the install path, this allows building with both old and new versions. Initially reported here: https://mailman.nginx.org/pipermail/nginx/2018-April/056054.html
* QUIC: added missing casts in iov_base assignments.Aleksei Bavshin2025-01-28
| | | | | This is consistent with the rest of the code and fixes build on systems with non-standard definition of struct iovec (Solaris, Illumos).
* Upstream: fixed --with-compat build without SSL, broken by 454ad0e.Pavel Pautov2025-01-23
|
* SSL: avoid using mismatched certificate/key cached pairs.Sergey Kandaurov2025-01-17
| | | | | | | | | | This can happen with certificates and certificate keys specified with variables due to partial cache update in various scenarios: - cache expiration with only one element of pair evicted - on-disk update with non-cacheable encrypted keys - non-atomic on-disk update The fix is to retry with fresh data on X509_R_KEY_VALUES_MISMATCH.
* Upstream: caching certificates and certificate keys with variables.Sergey Kandaurov2025-01-17
| | | | | | Caching is enabled with proxy_ssl_certificate_cache and friends. Co-authored-by: Aleksei Bavshin <a.bavshin@nginx.com>
* SSL: cache revalidation of file based dynamic certificates.Sergey Kandaurov2025-01-17
| | | | | Revalidation is based on file modification time and uniq file index, and happens after the cache object validity time is expired.
* SSL: caching certificates and certificate keys with variables.Sergey Kandaurov2025-01-17
| | | | | | | | A new directive "ssl_certificate_cache max=N [valid=time] [inactive=time]" enables caching of SSL certificate chain and secret key objects specified by "ssl_certificate" and "ssl_certificate_key" directives with variables. Co-authored-by: Aleksei Bavshin <a.bavshin@nginx.com>
* SSL: encrypted certificate keys are exempt from object cache.Sergey Kandaurov2025-01-17
| | | | | | | | | | | | SSL object cache, as previously introduced in 1.27.2, did not take into account encrypted certificate keys that might be unexpectedly fetched from the cache regardless of the matching passphrase. To avoid this, caching of encrypted certificate keys is now disabled based on the passphrase callback invocation. A notable exception is encrypted certificate keys configured without ssl_password_file. They are loaded once resulting in the passphrase prompt on startup and reused in other contexts as applicable.
* SSL: object cache inheritance from the old configuration cycle.Sergey Kandaurov2025-01-17
| | | | | | | | | Memory based objects are always inherited, engine based objects are never inherited to adhere the volatile nature of engines, file based objects are inherited subject to modification time and file index. The previous behaviour to bypass cache from the old configuration cycle is preserved with a new directive "ssl_object_cache_inheritable off;".