summaryrefslogtreecommitdiffhomepage
path: root/src/event (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-05-25QUIC: refactored CRYPTO and STREAM buffer ordering.Roman Arutyunyan9-351/+220
Generic function ngx_quic_order_bufs() is introduced. This function creates and maintains a chain of buffers with holes. Holes are marked with b->sync flag. Several buffers and holes in this chain may share the same underlying memory buffer. When processing STREAM frames with this function, frame data is copied only once to the right place in the stream input chain. Previously data could be copied twice. First when buffering an out-of-order frame data, and then when filling stream buffer from ordered frame queue. Now there's only one data chain for both tasks.
2021-05-22QUIC: unroll and inline ngx_quic_varint_len()/ngx_quic_build_int().Sergey Kandaurov1-17/+36
According to profiling, those two are among most frequently called, so inlining is generally useful, and unrolling should help with it. Further, this fixes undefined behaviour seen with invalid values. Inspired by Yu Liu.
2021-05-05QUIC: generic buffering for stream input.Roman Arutyunyan5-75/+77
Previously each stream had an input buffer. Now memory is allocated as bytes arrive. Generic buffering mechanism is used for this.
2021-05-05QUIC: simplified sending 1-RTT only frames.Sergey Kandaurov5-27/+19
2021-05-05QUIC: relaxed client id requirements.Vladimir Homutov3-6/+44
Client IDs cannot be reused on different paths. This change allows to reuse client id previosly seen on the same path (but with different dcid) in case when no unused client IDs are available.
2021-05-06QUIC: consider NEW_CONNECTION_ID a probing frame.Vladimir Homutov1-0/+1
According to quic-transport, 9.1: PATH_CHALLENGE, PATH_RESPONSE, NEW_CONNECTION_ID, and PADDING frames are "probing frames", and all other frames are "non-probing frames".
2021-04-28QUIC: fixed build with NGX_QUIC_DEBUG_ALLOC enabled.Vladimir Homutov1-9/+6
2021-04-29QUIC: connection migration.Vladimir Homutov15-369/+1675
The patch adds proper transitions between multiple networking addresses that can be used by a single quic connection. New networking paths are validated using PATH_CHALLENGE/PATH_RESPONSE frames.
2021-04-19QUIC: renamed stream variables from sn to qs.Roman Arutyunyan2-99/+99
Currently both names are used which is confusing. Historically these were different objects, but now it's the same one. The name qs (quic stream) makes more sense than sn (stream node).
2021-04-19QUIC: renamed stream field from c to connection.Roman Arutyunyan3-41/+44
2021-04-16QUIC: fixed permitted packet types for PATH_RESPONSE.Sergey Kandaurov1-1/+1
PATH_RESPONSE was explicitly forbidden in 0-RTT since at least draft-22, but the Frame Types table was not updated until recently while in IESG evaluation.
2021-04-19QUIC: added missing checks for limits in stream frames parsing.Vladimir Homutov1-0/+8
2021-04-19QUIC: fixed parsing of unknown frame types.Vladimir Homutov2-0/+9
The ngx_quic_frame_allowed() function only expects known frame types.
2021-04-15QUIC: avoid sending extra frames in case of error.Vladimir Homutov1-0/+4
2021-04-13QUIC: normalize header inclusion.Sergey Kandaurov7-14/+8
Stop including QUIC headers with no user-serviceable parts inside. This allows to provide a much cleaner QUIC interface. To cope with that, ngx_quic_derive_key() is now explicitly exported for v3 and quic modules. Additionally, this completely hides the ngx_quic_keys_t internal type.
2021-04-13QUIC: ngx_quic_frames_stream_t made opaque.Sergey Kandaurov4-15/+23
2021-04-14QUIC: separate files for SSL library interfaces.Vladimir Homutov5-507/+529
2021-04-13QUIC: separate files for tokens related processing.Vladimir Homutov4-285/+315
2021-04-13QUIC: separate files for output and ack related processing.Vladimir Homutov6-1953/+2021
2021-04-13QUIC: separate files for stream related processing.Vladimir Homutov4-1285/+1317
2021-04-13QUIC: separate files for frames related processing.Vladimir Homutov4-912/+957
2021-04-13QUIC: separate files for connection id related processing.Vladimir Homutov4-530/+564
2021-04-14QUIC: headers cleanup.Vladimir Homutov6-53/+49
The "ngx_event_quic.h" header file now contains only public definitions, used by modules. All internal definitions are moved into the "ngx_event_quic_connection.h" header file.
2021-04-09QUIC: separate function for connection ids initialization.Vladimir Homutov1-40/+62
The function correctly cleans up resources in case of failure to create initial server id: it removes previously created udp node for odcid from listening rbtree.
2021-04-08Introduced the "keepalive_time" directive.Maxim Dounin4-0/+8
Similar to lingering_time, it limits total connection lifetime before keepalive is switched off. The default is 1 hour, which is close to the total maximum connection lifetime possible with default keepalive_requests and keepalive_timeout.
2021-04-07QUIC: fixed ngx_quic_send_ack_range() function.Vladimir Homutov1-1/+6
Created frame was not added to the output queue.
2021-04-05QUIC: fixed debug message macro.Vladimir Homutov1-2/+2
2021-04-05QUIC: added error codes and messages from latest drafts.Vladimir Homutov2-1/+5
The AEAD_LIMIT_REACHED was addeded in draft-31. The NO_VIABLE_PATH was added in draft-33.
2021-04-16Merged with the default branch.Sergey Kandaurov4-0/+8
2021-04-07QUIC: fixed memory leak in ngx_hkdf_extract()/ngx_hkdf_expand().Sergey Kandaurov1-0/+4
This fixes leak on successful path when built with OpenSSL.
2021-03-28Events: fixed "port_dissociate() failed" alerts with eventport.Maxim Dounin1-1/+1
If an attempt is made to delete an event which was already reported, port_dissociate() returns an error. Fix is avoid doing anything if ev->active is not set. Possible alternative approach would be to avoid calling ngx_del_event() at all if ev->active is not set. This approach, however, will require something else to re-add the other event of the connection, since both read and write events are dissociated if an event is reported on a file descriptor. Currently ngx_eventport_del_event() re-associates write event if called to delete read event, and vice versa.
2021-03-26Events: fixed expiration of timers in the past.Maxim Dounin1-3/+1
If, at the start of an event loop iteration, there are any timers in the past (including timers expiring now), the ngx_process_events() function is called with zero timeout, and returns immediately even if there are no events. But the following code only calls ngx_event_expire_timers() if time actually changed, so this results in nginx spinning in the event loop till current time changes. While such timers are not expected to appear under normal conditions, as all such timers should be removed on previous event loop iterations, they still can appear due to bugs, zero timeouts set in the configuration (if this is not explicitly handled by the code), or due to external time changes on systems without clock_gettime(CLOCK_MONOTONIC). Fix is to call ngx_event_expire_timers() unconditionally. Calling it on each event loop iteration is not expected to be significant from performance point of view, especially compared to a syscall in ngx_process_events().
2021-03-23QUIC: PATH_CHALLENGE frame creation.Vladimir Homutov1-0/+26
2021-03-31QUIC: distinct files for connection migration.Vladimir Homutov4-48/+92
The connection migration-related code from quic.c with dependencies is moved into separate file.
2021-03-31QUIC: separate header for ngx_quic_connection_t.Vladimir Homutov2-161/+183
2021-04-02QUIC: simplified quic connection dispatching.Vladimir Homutov3-15/+24
Currently listener contains rbtree with multiple nodes for single QUIC connection: each corresponding to specific server id. Each udp node points to same ngx_connection_t, which points to QUIC connection via c->udp field. Thus when an event handler is called, it only gets ngx_connection_t with c->udp pointing to QUIC connection. This makes it hard to obtain actual node which was used to dispatch packet (it requires to repeat DCID lookup). Additionally, ngx_quic_connection_t->udp field is only needed to keep a pointer in c->udp. The node is not added into the tree and does not carry useful information.
2021-04-02UDP: extended datagram context.Vladimir Homutov3-30/+34
Sometimes it is required to process datagram properties at higher level (i.e. QUIC is interested in source address which may change and IP options). The patch adds ngx_udp_dgram_t structure used to pass packet-related information in c->udp.
2021-03-30QUIC: fixed udp buffer initialization.Vladimir Homutov1-0/+2
The start field is used to check if the QUIC packet is first in the datagram. This fixes stateless reset detection.
2021-03-30QUIC: do not handle empty dcid.Roman Arutyunyan1-64/+31
When a QUIC datagram arrives, its DCID is never empty. Previously, the case of empty DCID was handled. Now this code is simplified.
2021-03-11QUIC: do not reallocate c->sockaddr.Roman Arutyunyan1-8/+10
When a connection is created, enough memory is allocated to accomodate any future address change.
2021-03-11QUIC: do not copy input data.Roman Arutyunyan1-21/+6
Previously, when a new datagram arrived, data were copied from the UDP layer to the QUIC layer via c->recv() interface. Now UDP buffer is accessed directly.
2021-03-31QUIC: HKDF API compatibility with OpenSSL master branch.Sergey Kandaurov1-0/+2
OpenSSL 3.0 started to require HKDF-Extract output PRK length pointer used to represent the amount of data written to contain the length of the key buffer before the call. EVP_PKEY_derive() documents this. See HKDF_Extract() internal implementation update in this change: https://github.com/openssl/openssl/commit/5a285ad
2021-03-30Merged with the default branch.Sergey Kandaurov2-4/+2
2021-03-15QUIC: connection shutdown.Roman Arutyunyan2-6/+75
The function ngx_quic_shutdown_connection() waits until all non-cancelable streams are closed, and then closes the connection. In HTTP/3 cancelable streams are all unidirectional streams except push streams. The function is called from HTTP/3 when client reaches keepalive_requests.
2021-03-16QUIC: bpf code regenerated.Vladimir Homutov1-11/+10
2021-03-15QUIC: fixed key extraction in bpf.Vladimir Homutov1-12/+12
In case of long header packets, dcid length was not read correctly. While there, macros to parse uint64 was fixed as well as format specifiers to print it in debug mode. Thanks to Gao Yan <gaoyan09@baidu.com>.
2021-03-16QUIC: fixed expected TLS codepoint with final draft and BoringSSL.Sergey Kandaurov1-0/+4
A reasonable codepoint is always set[1] explicitly so that it doesn't depend on the default library value that may change[2] in the future. [1] https://boringssl.googlesource.com/boringssl/+/3d8b8c3d [2] https://boringssl.googlesource.com/boringssl/+/c47bfce0
2021-03-11QUIC: added error handling to ngx_hkdf_extract()/ngx_hkdf_expand().Vladimir Homutov1-16/+42
The OpenSSL variant of functions lacked proper error processing.
2021-03-10Merged with the default branch.Sergey Kandaurov2-10/+59
2021-03-05Events: fixed eventport handling in ngx_handle_read_event().Maxim Dounin1-1/+1
The "!rev->ready" test seems to be a typo, introduced in the original commit (719:f30b1a75fd3b). The ngx_handle_write_event() code properly tests for "rev->ready" instead. Due to this typo, read events might be unexpectedly removed during proxying after an event on the other part of the proxied connection. Catched by mail proxying tests.