summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-11-11QUIC: connection multiplexing per port.Roman Arutyunyan7-100/+549
Also, connection migration within a single worker is implemented.
2020-11-09Request body: removed error assumption (ticket #2058).Maxim Dounin1-2/+3
Before introduction of request body filter in 42d9beeb22db, the only possible return code from the ngx_http_request_body_filter() call without actual buffers was NGX_HTTP_INTERNAL_SERVER_ERROR, and the code in ngx_http_read_client_request_body() hardcoded the only possible error to simplify the code of initial call to set rb->rest. This is no longer true after introduction of request body filters though, as a request body filter might need to return other errors, such as 403. Fix is to preserve the error code actually returned by the call instead of assuming 500.
2020-11-09Request body: improved logging.Maxim Dounin1-0/+3
Added logging before returning NGX_HTTP_INTERNAL_SERVER_ERROR if there are busy buffers after a request body flush. This should never happen with current code, though bugs can be introduced by 3rd party modules. Make sure debugging will be easy enough.
2020-11-09QUIC: renamed field and function related to client ids.Roman Arutyunyan1-8/+8
Particularly, c->curr_seqnum is renamed to c->client_seqnum and ngx_quic_alloc_connection_id() is renamed to ngx_quic_alloc_client_id().
2020-11-10QUIC: multiple versions support in ALPN.Sergey Kandaurov5-14/+43
Previously, a version based on NGX_QUIC_DRAFT_VERSION was always set. Now it is taken from the negotiated QUIC version that may differ.
2020-11-10QUIC: multiple versions support.Sergey Kandaurov3-6/+14
Draft-29 and beyond are now treated as compatible versions.
2020-11-10QUIC: preparatory changes for multiple QUIC versions support.Sergey Kandaurov2-3/+32
A negotiated version is decoupled from NGX_QUIC_VERSION and, if supported, now stored in c->quic->version after packets processing. It is then used to create long header packets. Otherwise, the list of supported versions (which may be many now) is sent in the Version Negotiation packet. All packets in the connection are expected to have the same version. Incoming packets with mismatched version are now rejected.
2020-11-06SSL: fixed non-working SSL shutdown on lingering close.Ruslan Ermilov3-17/+65
When doing lingering close, the socket was first shut down for writing, so SSL shutdown initiated after lingering close was not able to send the close_notify alerts (ticket #2056). The fix is to call ngx_ssl_shutdown() before shutting down the socket.
2020-11-06Removed dead code from ngx_http_set_keepalive().Ruslan Ermilov1-7/+0
The code removed became dead after 98f03cd8d6cc (0.8.14), circa when the request reference counting was introduced.
2020-11-06QUIC: added proper logging of special values.Vladimir Homutov1-8/+8
A number of unsigned variables has a special value, usually -1 or some maximum, which produces huge numeric value in logs and makes them hard to read. In order to distinguish such values in log, they are casted to the signed type and printed as literal '-1'.
2020-11-02QUIC: fixed address validation issues in a new connection.Sergey Kandaurov1-2/+13
The client address validation didn't complete with a valid token, which was broken after packet processing refactoring in d0d3fc0697a0. An invalid or expired token was treated as a connection error. Now we proceed as outlined in draft-ietf-quic-transport-32, section 8.1.3 "Address Validation for Future Connections" below, which is unlike validating the client address using Retry packets. When a server receives an Initial packet with an address validation token, it MUST attempt to validate the token, unless it has already completed address validation. If the token is invalid then the server SHOULD proceed as if the client did not have a validated address, including potentially sending a Retry. The connection is now closed in this case on internal errors only.
2020-11-02QUIC: refactored key handling.Sergey Kandaurov5-167/+191
All key handling functionality is moved into ngx_quic_protection.c. Public structures from ngx_quic_protection.h are now private and new methods are available to manipulate keys. A negotiated cipher is cached in QUIC connection from the set secret callback to avoid calling SSL_get_current_cipher() on each encrypt/decrypt operation. This also reduces the number of unwanted c->ssl->connection occurrences.
2020-10-29QUIC: refactored SSL_do_handshake() handling.Sergey Kandaurov1-38/+42
No functional changes.
2020-10-29QUIC: passing ssl_conn to SSL_get0_alpn_selected() directly.Sergey Kandaurov1-1/+1
No functional changes.
2020-10-29Merged with the default branch.Sergey Kandaurov19-70/+547
2020-10-29QUIC: handle more frames in ngx_quic_resend_frames().Roman Arutyunyan1-0/+58
When a packet is declared lost, its frames are handled differently according to 13.3. Retransmission of Information.
2020-10-28QUIC: avoided retransmission of stale ack frames.Vladimir Homutov1-3/+14
Acknowledgments are regenerated using the most recent data available.
2020-10-28Core: added format specifiers to output binary data as hex.Vladimir Homutov4-67/+86
Now "s", "V", and "v" format specifiers may be prefixed with "x" (lowercase) or "X" (uppercase) to output corresponding data in hexadecimal format. In collaboration with Maxim Dounin.
2020-11-05Version bump.Vladimir Homutov1-2/+2
2020-10-27QUIC: changed STREAM frame debugging.Roman Arutyunyan1-6/+14
2020-10-28QUIC: changed ACK frame debugging.Roman Arutyunyan1-8/+21
Previously ACK ranges were logged as a gap/range sequence. Now these values are expanded to packet number ranges for easier reading.
2020-10-27QUIC: unified range format for rx and tx ACK frames.Roman Arutyunyan3-42/+53
Previously, tx ACK frames held ranges in an array of ngx_quic_ack_range_t, while rx ACK frames held ranges in the serialized format. Now serialized format is used for both types of frames.
2020-10-27QUIC: cleanup send context properly.Vladimir Homutov1-0/+10
The patch resets ctx->frames queue, which may contain frames. It was possible that congestion or amplification limits prevented all frames to be sent. Retransmitted frames could be accounted twice as inflight: first time in ngx_quic_congestion_lost() called from ngx_quic_resend_frames(), and later from ngx_quic_discard_ctx().
2020-10-27QUIC: added push event afer the address was validated.Vladimir Homutov1-1/+5
This allows to continue processing when the anti-amplification limit was hit.
2020-10-26QUIC: updated anti-amplification check for draft 32.Vladimir Homutov1-2/+9
This accounts for the following change: * Require expansion of datagrams to ensure that a path supports at least 1200 bytes: - During the handshake ack-eliciting Initial packets from the server need to be expanded
2020-10-26QUIC: got rid of "pkt" abbreviation in logs.Vladimir Homutov3-11/+12
2020-10-26QUIC: added "rx" and "tx" prefixes to packet debug.Vladimir Homutov3-12/+12
2020-10-26QUIC: added connection state debug to event handlers.Vladimir Homutov1-10/+77
2020-10-26QUIC: added logging of a declined packet without retry token.Vladimir Homutov1-0/+2
2020-10-27QUIC: revised value separators in debug and error messages.Vladimir Homutov3-69/+72
All values are prefixed with name and separated from it using colon. Multiple values are listed without commas in between. Rationale: this greatly simplifies log parsing for analysis.
2020-10-27QUIC: single function for frame debug logging.Vladimir Homutov3-147/+208
The function may be called for any initialized frame, both rx and tx. While there, shortened level names.
2020-10-23QUIC: optimized acknowledgement generation.Vladimir Homutov2-36/+55
For application level packets, only every second packet is now acknowledged, respecting max ack delay. 13.2.1 Sending ACK Frames In order to assist loss detection at the sender, an endpoint SHOULD generate and send an ACK frame without delay when it receives an ack- eliciting packet either: * when the received packet has a packet number less than another ack-eliciting packet that has been received, or * when the packet has a packet number larger than the highest- numbered ack-eliciting packet that has been received and there are missing packets between that packet and this packet. 13.2.2. Acknowledgement Frequency A receiver SHOULD send an ACK frame after receiving at least two ack-eliciting packets.
2020-10-23QUIC: added missing "quic" prefix in debug messages.Vladimir Homutov1-2/+2
2020-10-22SSL: ssl_reject_handshake directive (ticket #195).Maxim Dounin5-42/+104
In some cases it might be needed to reject SSL handshake based on SNI server name provided, for example, to make sure an invalid certificate is not returned to clients trying to contact a name-based virtual server without SSL configured. Previously, a "ssl_ciphers aNULL;" was used for this. This workaround, however, is not compatible with TLSv1.3, in particular, when using BoringSSL, where it is not possible to configure TLSv1.3 ciphers at all. With this change, the ssl_reject_handshake directive is introduced, which instructs nginx to reject SSL handshakes with an "unrecognized_name" alert in a particular server block. For example, to reject handshake with names other than example.com, one can use the following configuration: server { listen 443 ssl; ssl_reject_handshake on; } server { listen 443 ssl; server_name example.com; ssl_certificate example.com.crt; ssl_certificate_key example.com.key; } The following configuration can be used to reject all SSL handshakes without SNI server name provided: server { listen 443 ssl; ssl_reject_handshake on; } server { listen 443 ssl; server_name ~^; ssl_certificate example.crt; ssl_certificate_key example.key; } Additionally, the ssl_reject_handshake directive makes configuring certificates for the default server block optional. If no certificates are configured in the default server for a given listening socket, certificates must be defined in all non-default server blocks with the listening socket in question.
2020-10-22Stream: proxy_ssl_conf_command directive.Maxim Dounin1-0/+34
Similarly to ssl_conf_command, proxy_ssl_conf_command can be used to set arbitrary OpenSSL configuration parameters as long as nginx is compiled with OpenSSL 1.0.2 or later, when connecting to upstream servers with SSL. Full list of available configuration commands can be found in the SSL_CONF_cmd manual page (https://www.openssl.org/docs/man1.1.1/man3/SSL_CONF_cmd.html).
2020-10-22Upstream: proxy_ssl_conf_command and friends.Maxim Dounin3-0/+104
Similarly to ssl_conf_command, proxy_ssl_conf_command (grpc_ssl_conf_command, uwsgi_ssl_conf_command) can be used to set arbitrary OpenSSL configuration parameters as long as nginx is compiled with OpenSSL 1.0.2 or later, when connecting to upstream servers with SSL. Full list of available configuration commands can be found in the SSL_CONF_cmd manual page (https://www.openssl.org/docs/man1.1.1/man3/SSL_CONF_cmd.html).
2020-10-22SSL: ssl_conf_command directive.Maxim Dounin8-0/+176
With the ssl_conf_command directive it is now possible to set arbitrary OpenSSL configuration parameters as long as nginx is compiled with OpenSSL 1.0.2 or later. Full list of available configuration commands can be found in the SSL_CONF_cmd manual page (https://www.openssl.org/docs/man1.1.1/man3/SSL_CONF_cmd.html). In particular, this allows configuring PrioritizeChaCha option (ticket #1445): ssl_conf_command Options PrioritizeChaCha; It can be also used to configure TLSv1.3 ciphers in OpenSSL, which fails to configure them via the SSL_CTX_set_cipher_list() interface (ticket #1529): ssl_conf_command Ciphersuites TLS_CHACHA20_POLY1305_SHA256; Configuration commands are applied after nginx own configuration for SSL, so they can be used to override anything set by nginx. Note though that configuring OpenSSL directly with ssl_conf_command might result in a behaviour nginx does not expect, and should be done with care.
2020-10-22Core: ngx_conf_set_keyval_slot() now accepts NGX_CONF_UNSET_PTR.Maxim Dounin3-7/+11
With this change, it is now possible to use ngx_conf_merge_ptr_value() to merge keyval arrays. This change actually follows much earlier changes in ngx_conf_merge_ptr_value() and ngx_conf_set_str_array_slot() in 1452:cd586e963db0 (0.6.10) and 1701:40d004d95d88 (0.6.22). To preserve compatibility with existing 3rd party modules, both NULL and NGX_CONF_UNSET_PTR are accepted for now.
2020-10-22QUIC: restored proper usage of ngx_quic_drop_ack_ranges().Sergey Kandaurov1-2/+4
ACK Ranges are again managed based on the remembered Largest Acknowledged sent in the packet being acknowledged, which partially reverts c01964fd7b8b.
2020-10-21QUIC: fixed dropping output ack ranges on input ack.Vladimir Homutov1-6/+11
While there, additional debug messages were added.
2020-10-21QUIC: added macro for unset packet number.Vladimir Homutov1-18/+20
2020-10-20QUIC: drop acknowledged ranges.Vladimir Homutov1-5/+71
13.2.4. Limiting Ranges by Tracking ACK Frames When a packet containing an ACK frame is sent, the largest acknowledged in that frame may be saved. When a packet containing an ACK frame is acknowledged, the receiver can stop acknowledging packets less than or equal to the largest acknowledged in the sent ACK frame.
2020-10-20QUIC: added ACK frame range support.Vladimir Homutov3-30/+329
The history of acknowledged packet is kept in send context as ranges. Up to NGX_QUIC_MAX_RANGES ranges is stored. As a result, instead of separate ack frames, single frame with ranges is sent.
2020-10-21QUIC: expand UDP datagrams with an ack-eliciting Initial packet.Sergey Kandaurov1-5/+16
Per draft-ietf-quic-transport-32 on the topic: : Similarly, a server MUST expand the payload of all UDP datagrams carrying : ack-eliciting Initial packets to at least the smallest allowed maximum : datagram size of 1200 bytes.
2020-10-21QUIC: teach how to compute only the length of created QUIC headers.Sergey Kandaurov1-0/+10
It will be used for precise expansion of UDP datagram payload.
2020-10-21QUIC: simplified ngx_quic_create_long_header().Sergey Kandaurov1-1/+1
As seen in the quic-transport draft, which this implementation follows: Initial packets sent by the server MUST set the Token Length field to zero.
2020-10-21QUIC: avoided excessive initialization in ngx_quic_send_frames().Sergey Kandaurov1-2/+0
A zero-length token was used to initialize a prezeroed packet header.
2020-10-21QUIC: sorted ngx_quic_send_frames() declarations.Sergey Kandaurov1-2/+2
2020-10-19QUIC: account packet header length in amplification limit.Vladimir Homutov2-2/+4
This is the restoration of 02ee77f8d53d accidentally reverted by 93be5658a250.
2020-10-19QUIC: reverted previous 3 commits.Vladimir Homutov8-434/+28
Changes were intended for the test repository.