summaryrefslogtreecommitdiffhomepage
path: root/src/event/ngx_event_quic.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2020-12-25QUIC: moved all quic sources into src/event/quic.Vladimir Homutov1-6530/+0
2020-12-22QUIC: fixed logging PATH_CHALLENGE/RESPONSE and build with GCC < 5.Sergey Kandaurov1-4/+6
2020-12-09QUIC: always calculate rtt for largest acknowledged packet.Roman Arutyunyan1-4/+1
Previously, when processing client ACK, rtt could be calculated for a packet different than the largest if it was missing in the sent chain. Even though this is an unlikely situation, rtt based on a different packet could be larger than needed leading to bigger pto timeout and performance degradation.
2020-12-10QUIC: send and process ack_delay for Initial and Handshake levels.Roman Arutyunyan1-13/+5
Previously, this only worked for Application level because before quic-transport-30, there were the following constraints: Because the receiver doesn't use the ACK Delay for Initial and Handshake packets, a sender SHOULD send a value of 0. When adjusting an RTT sample using peer-reported acknowledgement delays, an endpoint ... MUST ignore the ACK Delay field of the ACK frame for packets sent in the Initial and Handshake packet number space.
2020-12-09QUIC: use client max_ack_delay when computing pto timeout.Roman Arutyunyan1-4/+2
Previously, server max_ack_delay was used which is wrong. Also, level check is simplified.
2020-12-08QUIC: resend handshake packets along with initial.Roman Arutyunyan1-0/+5
To speed up handshake, resend both initial and handshake packets if there's at least one unacknowledged initial packet.
2020-12-08QUIC: set the temporary flag for input frame buffers.Roman Arutyunyan1-0/+1
Missing flag prevented frame data from being copied as the buffer was not considered a memory buffer.
2020-12-07QUIC: coalesce output packets into a single UDP datagram.Roman Arutyunyan1-287/+447
Now initial output packet is not padded anymore if followed by a handshake packet. If the datagram is still not big enough to satisfy minimum size requirements, handshake packet is padded.
2020-12-01QUIC: introduced QUIC buffers.Roman Arutyunyan1-115/+323
Buffers are used to hold frame data. They have a fixed size and are reused after being freed.
2020-12-07QUIC: fixed handling of clients connected to wildcard address.Vladimir Homutov1-6/+32
The patch replaces c->send() occurences with c->send_chain(), because the latter accounts for the local address, which may be different if the wildcard listener is used. Previously, server sent response to client using address different from one client connected to.
2020-12-06QUIC: disabling bidirectional SSL shutdown earlier.Sergey Kandaurov1-1/+2
Notably, this fixes an issue with Chrome that can emit a "certificate_unknown" alert during the SSL handshake where c->ssl->no_wait_shutdown is not yet set.
2020-12-02QUIC: fixed send contexts cleanup.Vladimir Homutov1-2/+1
The ngx_quic_get_send_ctx() macro takes 'level' argument, not send context index.
2020-11-27QUIC: removed ngx_quic_hexdump() macro.Vladimir Homutov1-23/+44
Instead, appropriate format specifier for hexadecimal is used in ngx_log_debug(). The STREAM frame "data" debug is moved into ngx_quic_log_frame(), similar to all other frame fields debug.
2020-11-17QUIC: hide header creation internals in ngx_event_quic_transport.c.Sergey Kandaurov1-1/+1
It doesn't make sense to expose the header type in a public function.
2020-11-17QUIC: refactored long header parsing.Sergey Kandaurov1-5/+4
The largely duplicate type-specific functions ngx_quic_parse_initial_header(), ngx_quic_parse_handshake_header(), and a missing one for 0-RTT, were merged. The new order of functions listed in ngx_event_quic_transport.c reflects this. |_ ngx_quic_parse_long_header - version-invariant long header fields \_ ngx_quic_supported_version - a helper to decide we can go further \_ ngx_quic_parse_long_header_v1 - QUICv1-specific long header fields 0-RTT packets previously appeared as Handshake are now logged as appropriate: *1 quic packet rx long flags:db version:ff00001d *1 quic packet rx early len:870 Logging SCID/DCID is no longer duplicated as were seen with Initial packets.
2020-11-17QUIC: removed macros for stream limits unused since c5324bb3a704.Sergey Kandaurov1-3/+0
2020-11-13Core: hide "struct ngx_quic_connection_s" and further reduce diffs.Sergey Kandaurov1-2/+2
As with the previous change, it became feasible with feec2cc762f6 that removes ngx_quic_connection_t from ngx_connection_s.
2020-11-11QUIC: generate default stateless reset token key.Roman Arutyunyan1-16/+8
Previously, if quic_stateless_reset_token_key was empty or unspecified, initial stateless reset token was not generated. However subsequent tokens were generated with empty key, which resulted in error with certain SSL libraries, for example OpenSSL. Now a random 32-byte stateless reset token key is generated if none is specified in the configuration. As a result, stateless reset tokens are now generated for all server ids.
2020-11-11QUIC: reallocate qc->dcid on retry.Roman Arutyunyan1-0/+6
Previously new dcid was generated in the same memory that was allocated for qc->dcid when creating the QUIC connection. However this memory was also referenced by initial_source_connection_id and retry_source_connection_id transport parameters. As a result these parameters changed their values after retry which broke the protocol.
2020-11-10QUIC: renamed c->qs to c->quic.Roman Arutyunyan1-6/+6
2020-11-10QUIC: got rid of the c->quic field.Roman Arutyunyan1-146/+177
Now QUIC connection is accessed via the c->udp field.
2020-11-11QUIC: connection multiplexing per port.Roman Arutyunyan1-54/+323
Also, connection migration within a single worker is implemented.
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 Kandaurov1-0/+11
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 Kandaurov1-3/+1
Draft-29 and beyond are now treated as compatible versions.
2020-11-10QUIC: preparatory changes for multiple QUIC versions support.Sergey Kandaurov1-0/+13
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-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 Kandaurov1-81/+45
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-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-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 Arutyunyan1-26/+27
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 Homutov1-5/+6
2020-10-26QUIC: added "rx" and "tx" prefixes to packet debug.Vladimir Homutov1-6/+6
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 Homutov1-47/+50
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 Homutov1-56/+200
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 Homutov1-35/+54
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-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