summaryrefslogtreecommitdiffhomepage
path: root/src/event (follow)
AgeCommit message (Collapse)AuthorFilesLines
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 Homutov6-411/+28
Changes were intended for the test repository.
2020-10-19try: --skiptestsVladimir Homutov1-5/+65
2020-10-14QUIC: added ACK frame range support.Vladimir Homutov3-21/+293
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-09-15SSL: added the "ssl_keys_file" directive.Vladimir Homutov2-0/+49
2020-10-15QUIC: account packet header length in amplification limit.Vladimir Homutov2-2/+4
Header length calculation is adjusted to account real connection id lengths instead of worst case.
2020-10-09QUIC: reset error and error_reason prior to processing packet.Vladimir Homutov1-0/+5
2020-10-07QUIC: fixed dead store assignment.Sergey Kandaurov1-1/+1
Found by Clang Static Analyzer.
2020-10-07QUIC: fixed format specifier in debug message.Vladimir Homutov1-1/+1
2020-10-02QUIC: added debug message with final packet processing status.Vladimir Homutov2-0/+30
2020-10-07QUIC: set local_socklen in stream connections.Roman Arutyunyan1-0/+1
Previously, this field was not set while creating a QUIC stream connection. As a result, calling ngx_connection_local_sockaddr() led to getsockname() bad descriptor error.
2020-10-02QUIC: enabled more key-related debug by default.Vladimir Homutov2-4/+13
2020-10-02QUIC: added connection id debug.Vladimir Homutov1-2/+0
2020-10-07QUIC: updated c->log->action strings to reflect proper state.Vladimir Homutov1-6/+13
2020-10-07QUIC: fixed memory leak in ngx_quic_send_frames().Vladimir Homutov1-0/+3
The function did not free passed frames in case of error.
2020-10-06QUIC: fixed measuring ACK Delay against 0-RTT packets.Sergey Kandaurov1-2/+6
2020-10-05QUIC: do not resend empty queue when speeding up handshake.Sergey Kandaurov1-1/+6
If client acknowledged an Initial packet with CRYPTO frame and then sent another Initial packet containing duplicate CRYPTO again, this could result in resending frames off the empty send queue.
2020-10-05QUIC: zero out packet length in frames prior to send.Sergey Kandaurov1-0/+1
It could be that a frame was previously sent and may have stale information. This was previously broken by merging frames on resend in b383120afca3.
2020-10-05QUIC: fixed build with clang and NGX_QUIC_DEBUG_CRYPTO enabled.Vladimir Homutov1-1/+4
The ngx_quic_hexdump() function is wrapped into macros to cast "data" argument to "* u_char".
2020-10-05QUIC: inline function instead of macro for hexdump.Vladimir Homutov1-12/+14
This prevents name clashes with local variables.
2020-10-01QUIC: fixed handling of incorrect packets.Vladimir Homutov1-3/+16
Instead of ignoring, connection was closed. This was broken in d0d3fc0697a0.
2020-10-01Merged with the default branch.Sergey Kandaurov1-1/+20
2020-10-01QUIC: a bandaid for calculating ack_delay with non-monotonic time.Sergey Kandaurov1-0/+1
2020-10-01QUIC: speeding up handshake completion.Sergey Kandaurov1-3/+15
As per quic-recovery draft, section-6.2.3: resend CRYPTO frames when receiving an Initial packet containing duplicate CRYPTO data.
2020-10-01QUIC: fixed clang-ast asserts.Sergey Kandaurov2-2/+2
2020-10-01QUIC: fixed build with OpenSSL after bed310672f39.Sergey Kandaurov1-1/+1
2020-10-01QUIC: moved ssl configuration pointer to quic configuration.Vladimir Homutov2-19/+16
The ssl configuration is obtained at config time and saved for future use.
2020-09-30QUIC: added stateless reset support.Vladimir Homutov6-12/+225
The new "quic_stateless_reset_token_key" directive is added. It sets the endpoint key used to generate stateless reset tokens and enables feature. If the endpoint receives short-header packet that can't be matched to existing connection, a stateless reset packet is generated with a proper token. If a valid stateless reset token is found in the incoming packet, the connection is closed. Example configuration: http { quic_stateless_reset_token_key "foo"; ... }
2020-09-30QUIC: refined the "c->quic->initialized" flag usage.Vladimir Homutov1-53/+66
The flag is tied to the initial secret creation. The presence of c->quic pointer is sufficient to enable execution of ngx_quic_close_quic(). The ngx_quic_new_connection() function now returns the allocated quic connection object and the c->quic pointer is set by the caller. If an early error occurs before secrets initialization (i.e. in cases of invalid retry token or nginx exiting), it is still possible to generate an error response by trying to initialize secrets directly in the ngx_quic_send_cc() function. Before the change such early errors failed to send proper connection close message and logged an error. An auxilliary ngx_quic_init_secrets() function is introduced to avoid verbose call to ngx_quic_set_initial_secret() requiring local variable.
2020-09-30QUIC: packet processing refactoring.Vladimir Homutov3-475/+239
All packet header parsing is now performed by ngx_quic_parse_packet() function, located in the ngx_quic_transport.c file. The packet processing is centralized in the ngx_quic_process_packet() function which decides if the packet should be accepted, ignored or connection should be closed, depending on the connection state. As a result of refactoring, behavior has changed in some places: - minimal size of Initial packet is now always tested - connection IDs are always tested in existing connections - old keys are discarded on encryption level switch
2020-09-25QUIC: simplified packet header parsing.Vladimir Homutov2-26/+3
Now flags are processed in ngx_quic_input(), and raw->pos points to the first byte after the flags. Redundant checks from ngx_quic_parse_short_header() and ngx_quic_parse_long_header() are removed.
2020-09-25QUIC: keep the entire packet size in pkt->len.Roman Arutyunyan3-6/+7
Previously pkt->len kept the length of the packet remainder starting from pkt->raw->pos.
2020-09-18QUIC: switched to using fixed-length server connection IDs.Vladimir Homutov2-10/+5
2020-09-30QUIC: resend frames by moving them to output queue.Roman Arutyunyan1-20/+20
Previously, when a packet was declared lost, another packet was sent with the same frames. Now lost frames are moved to the output frame queue and push event is posted. This has the advantage of forming packets with more frames than before. Also, the start argument is removed from the ngx_quic_resend_frames() function as excess information.
2020-09-21QUIC: prevented posted push event while in the draining state.Vladimir Homutov1-12/+12
If the push event was posted before ngx_quic_close_connection(), it could send data in the draining state.
2020-09-16SSL: disabled shutdown when there are buffered data.Maxim Dounin1-1/+1
This fixes "SSL_shutdown() failed (SSL: ... bad write retry)" errors as observed on the second SSL_shutdown() call after SSL shutdown fixes in 09fb2135a589 (1.19.2), notably when HTTP/2 connections are closed due to read timeouts while there are incomplete writes.
2020-09-16SSL: disabled shutdown after connection errors.Maxim Dounin1-1/+1
This fixes "SSL_shutdown() failed (SSL: ... bad write retry)" errors as observed on the second SSL_shutdown() call after SSL shutdown fixes in 09fb2135a589 (1.19.2), notably when sending fails in ngx_http_test_expect(), similarly to ticket #1194. Note that there are some places where c->error is misused to prevent further output, such as ngx_http_v2_finalize_connection() if there are pending streams, or in filter finalization. These places seem to be extreme enough to don't care about missing shutdown though. For example, filter finalization currently prevents keepalive from being used.
2020-09-16SSL: fixed event handling during shutdown.Maxim Dounin1-0/+7
The c->read->ready and c->write->ready flags need to be cleared to ensure that appropriate read or write events will be reported by kernel. Without this, SSL shutdown might wait till the timeout after blocking on writing or reading even if there is a socket activity.
2020-09-16SSL: workaround for incorrect SSL_write() errors in OpenSSL 1.1.1.Maxim Dounin1-0/+12
OpenSSL 1.1.1 fails to return SSL_ERROR_SYSCALL if an error happens during SSL_write() after close_notify alert from the peer, and returns SSL_ERROR_ZERO_RETURN instead. Broken by this commit, which removes the "i == 0" check around the SSL_RECEIVED_SHUTDOWN one: https://git.openssl.org/?p=openssl.git;a=commitdiff;h=8051ab2 In particular, if a client closed the connection without reading the response but with properly sent close_notify alert, this resulted in unexpected "SSL_write() failed while ..." critical log message instead of correct "SSL_write() failed (32: Broken pipe)" at the info level. Since SSL_ERROR_ZERO_RETURN cannot be legitimately returned after SSL_write(), the fix is to convert all SSL_ERROR_ZERO_RETURN errors after SSL_write() to SSL_ERROR_SYSCALL.
2020-09-11QUIC: switched to draft 29 by default.Vladimir Homutov1-2/+2
2020-09-09QUIC: allowed old DCID for initial packets until first ACK.Roman Arutyunyan1-8/+21
If a packet sent in response to an initial client packet was lost, then successive client initial packets were dropped by nginx with the unexpected dcid message logged. This was because the new DCID generated by the server was not available to the client.
2020-09-08QUIC: eliminated idle timeout restart for dropped packets.Roman Arutyunyan1-3/+27
2020-09-08QUIC: removed check for packet size beyond MAX_UDP_PAYLOAD_SIZE.Sergey Kandaurov1-5/+0
The check tested the total size of a packet header and unprotected packet payload, which doesn't include the packet number length and expansion of the packet protection AEAD. If the packet was corrupted, it could cause false triggering of the condition due to unsigned type underflow leading to a connection error. Existing checks for the QUIC header and protected packet payload lengths should be enough.
2020-09-08QUIC: check that the packet length is of at least sample size.Sergey Kandaurov1-0/+4
From quic-tls draft, section 5.4.2: An endpoint MUST discard packets that are not long enough to contain a complete sample. The check includes the Packet Number field assumed to be 4 bytes long.
2020-09-08QUIC: update packet length for short packets too.Sergey Kandaurov2-2/+2
During long packet header parsing, pkt->len is updated with the Length field value that is used to find next coalesced packets in a datagram. For short packets it still contained the whole QUIC packet size. This change uniforms packet length handling to always contain the total length of the packet number and protected packet payload in pkt->len.
2020-09-07QUIC: added logging output stream frame offset.Roman Arutyunyan1-4/+4
2020-09-04QUIC: refactored ngx_quic_retry_input().Vladimir Homutov1-15/+9
The function now returns NGX_DECLINED for packets that need to be ignored and integrates nicely into ngx_quic_input().
2020-09-06QUIC: do not send STOP_SENDING after STREAM fin.Roman Arutyunyan1-1/+1
Previously STOP_SENDING was sent to client upon stream closure if rev->eof and rev->error were not set. This was an indirect indication that no RESET_STREAM or STREAM fin has arrived. But it is indeed possible that rev->eof is not set, but STREAM fin has already been received, just not read out by the application. In this case sending STOP_SENDING does not make sense and can be misleading for some clients.
2020-09-03QUIC: added support for multiple connection IDs.Vladimir Homutov3-14/+301
The peer may issue additional connection IDs up to the limit defined by transport parameter "active_connection_id_limit", using NEW_CONNECTION_ID frames, and retire such IDs using RETIRE_CONNECTION_ID frame.
2020-08-27QUIC: style.Vladimir Homutov1-13/+13
Moved processing of RETIRE_CONNECTION_ID right after the NEW_CONNECTION_ID.