]> git.kaiwu.me - nginx.git/log
nginx.git
6 years agoHTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan [Tue, 21 Apr 2020 14:11:49 +0000 (17:11 +0300)]
HTTP/3: fixed encoding variable-length integers.

6 years agoFixed memory leak with reordered stream frames.
Vladimir Homutov [Mon, 20 Apr 2020 15:32:46 +0000 (18:32 +0300)]
Fixed memory leak with reordered stream frames.

6 years agoFixed includes in quic headers.
Roman Arutyunyan [Tue, 21 Apr 2020 09:06:24 +0000 (12:06 +0300)]
Fixed includes in quic headers.

6 years agoAdded MAX_STREAM_DATA stub handler.
Vladimir Homutov [Mon, 20 Apr 2020 14:18:04 +0000 (17:18 +0300)]
Added MAX_STREAM_DATA stub handler.

Currently sending code is ignoring this.

6 years agoRespecting maximum packet size.
Vladimir Homutov [Mon, 20 Apr 2020 19:25:22 +0000 (22:25 +0300)]
Respecting maximum packet size.

The header size macros for long and short packets were fixed to provide
correct values in bytes.

Currently the sending code limits frames so they don't exceed max_packet_size.
But it does not account the case when a single frame can exceed the limit.

As a result of this patch, big payload (CRYPTO and STREAM) will be split
into a number of smaller frames that fit into advertised max_packet_size
(which specifies final packet size, after encryption).

6 years agoRemoved source/destination swap from the function creating header.
Vladimir Homutov [Mon, 20 Apr 2020 09:12:17 +0000 (12:12 +0300)]
Removed source/destination swap from the function creating header.

The function now creates a header according to fileds provided in the "pkt"
argument without applying any logic regarding sending side.

6 years agoRevert "Rejecting new connections with non-zero Initial packet."
Sergey Kandaurov [Fri, 17 Apr 2020 09:01:45 +0000 (12:01 +0300)]
Revert "Rejecting new connections with non-zero Initial packet."

chrome-unstable 83.0.4103.7 starts with Initial packet number 1.

I couldn't find a proper explanation besides this text in quic-transport:
    An endpoint MAY skip packet numbers when sending
    packets to detect this (Optimistic ACK Attack) behavior.

6 years agoFixed error descriptions.
Vladimir Homutov [Thu, 16 Apr 2020 13:54:22 +0000 (16:54 +0300)]
Fixed error descriptions.

The check for array bound is done inside function that returns error
description.  Missing initialization element is added.

6 years agoRemoved outdated TODO.
Vladimir Homutov [Thu, 16 Apr 2020 10:28:43 +0000 (13:28 +0300)]
Removed outdated TODO.

If required, frame handler can invoke output itself.  There is no need to
call output directly in the payload handler, queuing is enough.

6 years agoAdded handling of incorrect values in TP configuration.
Vladimir Homutov [Thu, 16 Apr 2020 09:17:41 +0000 (12:17 +0300)]
Added handling of incorrect values in TP configuration.

Some parameters have minimal/maximum values defined by standard.

6 years agoParsing of truncated packet numbers.
Sergey Kandaurov [Thu, 16 Apr 2020 09:46:48 +0000 (12:46 +0300)]
Parsing of truncated packet numbers.

For sample decoding algorithm, see quic-transport-27#appendix-A.

6 years agoAdded primitive flow control mechanisms.
Vladimir Homutov [Wed, 15 Apr 2020 15:54:03 +0000 (18:54 +0300)]
Added primitive flow control mechanisms.

 + MAX_STREAM_DATA frame is sent when recv() is performed on stream
   The new value is a sum of total bytes received by stream + free
   space in a buffer;

   The sending of MAX_STREM_DATA frame in response to STREAM_DATA_BLOCKED
   frame is adjusted to follow the same logic as above.

 + MAX_DATA frame is sent when total amount of received data is 2x
   of current limit.  The limit is doubled.

 + Default values of transport parameters are adjusted to more meaningful
   values:

   initial stream limits are set to quic buffer size instead of
   unrealistically small 255.

   initial max data is decreased to 16 buffer sizes, in an assumption that
   this is enough for a relatively short connection, instead of randomly
   chosen big number.

All this allows to initiate a stable flow of streams that does not block
on stream/connection limits (tested with FF 77.0a1 and 100K requests)

6 years agoCreate new stream immediately on receiving new stream id.
Vladimir Homutov [Wed, 15 Apr 2020 11:29:00 +0000 (14:29 +0300)]
Create new stream immediately on receiving new stream id.

Before the patch, full STREAM frame handling was delayed until the frame with
zero offset is received.  Only node in the streams tree was created.

This lead to problems when such stream was deleted, in particular, it had no
handlers set for read events.

This patch creates new stream immediately, but delays data delivery until
the proper offset will arrive. This is somewhat similar to how accept()
operation works.

The ngx_quic_add_stream() function is no longer needed and merged into stream
handler.  The ngx_quic_stream_input() now only handles frames for existing
streams and does not deal with stream creation.

6 years agoFree remaining frames on connection close.
Vladimir Homutov [Wed, 15 Apr 2020 10:09:39 +0000 (13:09 +0300)]
Free remaining frames on connection close.

Frames can still float in the following queues:

 - crypto frames reordering queues (one per encryption level)
 - moved crypto frames cleanup to the moment where all streams are closed
 - stream frames reordering queues (one per packet number namespace)
 - frames retransmit queues (one per packet number namespace)

6 years agoSorted functions and functions declarations.
Vladimir Homutov [Tue, 14 Apr 2020 13:30:41 +0000 (16:30 +0300)]
Sorted functions and functions declarations.

6 years agoAdded reordering support for STREAM frames.
Vladimir Homutov [Wed, 15 Apr 2020 08:11:54 +0000 (11:11 +0300)]
Added reordering support for STREAM frames.

Each stream node now includes incoming frames queue and sent/received counters
for tracking offset. The sent counter is not used, c->sent is used, not like
in crypto buffers, which have no connections.

6 years agoCrypto buffer frames reordering.
Vladimir Homutov [Tue, 14 Apr 2020 09:16:25 +0000 (12:16 +0300)]
Crypto buffer frames reordering.

If offset in CRYPTO frame doesn't match expected, following actions are taken:
    a) Duplicate frames or frames within [0...current offset] are ignored
    b) New data from intersecting ranges (starts before current_offset, ends
       after) is consumed
    c) "Future" frames are stored in a sorted queue (min offset .. max offset)

Once a frame is consumed, current offset is updated and the queue is inspected:
    we iterate the queue until the gap is found and act as described
    above for each frame.

The amount of data in buffered frames is limited by corresponding macro.

The CRYPTO and STREAM frame structures are now compatible: they share
the same set of initial fields.  This allows to have code that deals with
both of this frames.

The ordering layer now processes the frame with offset and invokes the
handler when it can organise an ordered stream of data.

6 years agoCleaned up magic numbers in ngx_quic_output_frames().
Vladimir Homutov [Mon, 13 Apr 2020 11:57:58 +0000 (14:57 +0300)]
Cleaned up magic numbers in ngx_quic_output_frames().

6 years agoRename types and variables used for packet number space.
Vladimir Homutov [Tue, 14 Apr 2020 09:06:32 +0000 (12:06 +0300)]
Rename types and variables used for packet number space.

Quote: Conceptually, a packet number space is the context in which a packet
       can be processed and acknowledged.

ngx_quic_namespace_t => ngx_quic_send_ctx_t
qc->ns               => qc->send_ctx
ns->largest          => send_ctx->largest_ack

The ngx_quic_ns(level) macro now returns pointer, not just index:
    ngx_quic_get_send_ctx(c->quic, level)

ngx_quic_retransmit_ns() => ngx_quic_retransmit()
ngx_quic_output_ns() => ngx_quic_output_frames()

6 years agoMerged with the default branch.
Sergey Kandaurov [Tue, 14 Apr 2020 16:35:20 +0000 (19:35 +0300)]
Merged with the default branch.

6 years agorelease-1.17.10 tag
Maxim Dounin [Tue, 14 Apr 2020 14:19:26 +0000 (17:19 +0300)]
release-1.17.10 tag

6 years agonginx-1.17.10-RELEASE release-1.17.10
Maxim Dounin [Tue, 14 Apr 2020 14:19:26 +0000 (17:19 +0300)]
nginx-1.17.10-RELEASE

6 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 14 Apr 2020 12:15:16 +0000 (15:15 +0300)]
Updated OpenSSL used for win32 builds.

6 years agoHTTP/3: fixed reading request body.
Roman Arutyunyan [Mon, 13 Apr 2020 14:54:23 +0000 (17:54 +0300)]
HTTP/3: fixed reading request body.

6 years agoThe new auth_delay directive for delaying unauthorized requests.
Ruslan Ermilov [Tue, 7 Apr 2020 22:02:17 +0000 (01:02 +0300)]
The new auth_delay directive for delaying unauthorized requests.

The request processing is delayed by a timer.  Since nginx updates
internal time once at the start of each event loop iteration, this
normally ensures constant time delay, adding a mitigation from
time-based attacks.

A notable exception to this is the case when there are no additional
events before the timer expires.  To ensure constant-time processing
in this case as well, we trigger an additional event loop iteration
by posting a dummy event for the next event loop iteration.

6 years agoAdded basic offset support in client CRYPTO frames.
Vladimir Homutov [Tue, 7 Apr 2020 12:50:38 +0000 (15:50 +0300)]
Added basic offset support in client CRYPTO frames.

The offset in client CRYPTO frames is tracked in c->quic->crypto_offset_in.
This means that CRYPTO frames with non-zero offset are now accepted making
possible to finish handshake with client certificates that exceed max packet
size (if no reordering happens).

The c->quic->crypto_offset field is renamed to crypto_offset_out to avoid
confusion with tracking of incoming CRYPTO stream.

6 years agoFixed build with OpenSSL using old callbacks API.
Sergey Kandaurov [Tue, 7 Apr 2020 09:54:34 +0000 (12:54 +0300)]
Fixed build with OpenSSL using old callbacks API.

6 years agoACK ranges processing.
Vladimir Homutov [Mon, 6 Apr 2020 13:19:26 +0000 (16:19 +0300)]
ACK ranges processing.

 + since number of ranges in unknown, provide a function to parse them once
   again in handler to avoid memory allocation

 + ack handler now processes all ranges, not only the first

 + ECN counters are parsed and saved into frame if present

6 years agoIgnore non-yet-implemented frames.
Vladimir Homutov [Mon, 6 Apr 2020 08:16:45 +0000 (11:16 +0300)]
Ignore non-yet-implemented frames.

Such frames are grouped together in a switch and just ignored, instead of
closing the connection  This may improve test coverage.  All such frames
require acknowledgment.

6 years agoAdded check for SSL_get_current_cipher() results.
Vladimir Homutov [Sat, 4 Apr 2020 19:25:41 +0000 (22:25 +0300)]
Added check for SSL_get_current_cipher() results.

The function may return NULL and result need to be checked before use.

6 years agoAdded a bit more debugging in STREAM frame parser.
Vladimir Homutov [Mon, 6 Apr 2020 08:17:14 +0000 (11:17 +0300)]
Added a bit more debugging in STREAM frame parser.

6 years agoDo not set timers after the connection is closed.
Vladimir Homutov [Sat, 4 Apr 2020 19:27:29 +0000 (22:27 +0300)]
Do not set timers after the connection is closed.

The qc->closing flag is set when a connection close is initiated for the first
time.

No timers will be set if the flag is active.

TODO: this is a temporary solution to avoid running timer handlers after
connection (and it's pool) was destroyed.  It looks like currently we have
no clear policy of connection closing in regard to timers.

6 years agoDiscarding Handshake packets if no Handshake keys yet.
Sergey Kandaurov [Mon, 6 Apr 2020 11:54:10 +0000 (14:54 +0300)]
Discarding Handshake packets if no Handshake keys yet.

Found with a previously received Initial packet with ACK only, which
instantiates a new connection but do not produce the handshake keys.

This can be triggered by a fairly well behaving client, if the server
stands behind a load balancer that stripped Initial packets exchange.

Found by F5 test suite.

6 years agoRejecting new connections with non-zero Initial packet.
Sergey Kandaurov [Mon, 6 Apr 2020 11:54:10 +0000 (14:54 +0300)]
Rejecting new connections with non-zero Initial packet.

6 years agoTLS Key Update in QUIC.
Sergey Kandaurov [Mon, 6 Apr 2020 11:54:08 +0000 (14:54 +0300)]
TLS Key Update in QUIC.

Old keys retention is yet to be implemented.

6 years agoRemoved excessive debugging in QUIC packet creation.
Sergey Kandaurov [Sat, 4 Apr 2020 14:34:39 +0000 (17:34 +0300)]
Removed excessive debugging in QUIC packet creation.

While here, eliminated further difference in between.

6 years agoLogging of packet numbers in QUIC packet creation.
Sergey Kandaurov [Sat, 4 Apr 2020 14:34:04 +0000 (17:34 +0300)]
Logging of packet numbers in QUIC packet creation.

6 years agoRemoved unneccesary milliseconds conversion.
Vladimir Homutov [Fri, 3 Apr 2020 13:33:59 +0000 (16:33 +0300)]
Removed unneccesary milliseconds conversion.

6 years agoProper handling of packet number in header.
Vladimir Homutov [Fri, 3 Apr 2020 11:02:16 +0000 (14:02 +0300)]
Proper handling of packet number in header.

 - fixed setting of largest received packet number.
 - sending properly truncated packet number
 - added support for multi-byte packet number

6 years agoAdvertizing MAX_STREAMS (0x12) credit in advance.
Sergey Kandaurov [Fri, 3 Apr 2020 10:49:44 +0000 (13:49 +0300)]
Advertizing MAX_STREAMS (0x12) credit in advance.

This makes sending large number of bidirectional stream work within ngtcp2,
which doesn't bother sending optional STREAMS_BLOCKED when exhausted.

This also introduces tracking currently opened and maximum allowed streams.

6 years agoFixed computing nonce again, by properly shifting packet number.
Sergey Kandaurov [Fri, 3 Apr 2020 10:49:40 +0000 (13:49 +0300)]
Fixed computing nonce again, by properly shifting packet number.

6 years agoFixed missing propagation of need_ack flag from frames to packet.
Vladimir Homutov [Fri, 3 Apr 2020 06:53:51 +0000 (09:53 +0300)]
Fixed missing propagation of need_ack flag from frames to packet.

6 years agoFixed excessive push timer firing.
Vladimir Homutov [Thu, 2 Apr 2020 11:53:01 +0000 (14:53 +0300)]
Fixed excessive push timer firing.

The timer is set when an output frame is generated; there is no need to arm
it after it was fired.

6 years agoFixed computing nonce by xoring all packet number bytes.
Sergey Kandaurov [Thu, 2 Apr 2020 08:40:25 +0000 (11:40 +0300)]
Fixed computing nonce by xoring all packet number bytes.

Previously, the stub worked only with pnl=0.

6 years agoOutput buffering.
Vladimir Homutov [Wed, 1 Apr 2020 14:09:11 +0000 (17:09 +0300)]
Output buffering.

Currently, the output is called periodically, each 200 ms to invoke
ngx_quic_output() that will push all pending frames into packets.

TODO: implement flags a-là Nagle & co (NO_DELAY/NO_PUSH...)

6 years agoImplemented retransmission and retransmit queue.
Vladimir Homutov [Wed, 1 Apr 2020 14:06:26 +0000 (17:06 +0300)]
Implemented retransmission and retransmit queue.

All frames collected to packet are moved into a per-namespace send queue.
QUIC connection has a timer which fires on the closest max_ack_delay time.
The frame is deleted from the queue when a corresponding packet is acknowledged.

The NGX_QUIC_MAX_RETRANSMISSION is a timeout that defines maximum length
of retransmission of a frame.

6 years agoIntroduced packet namespace in QUIC connection.
Vladimir Homutov [Wed, 1 Apr 2020 11:31:08 +0000 (14:31 +0300)]
Introduced packet namespace in QUIC connection.

The structure contains all data that is related to the namespace:
packet number and output queue (next patch).

6 years agoRefactored QUIC secrets storage.
Vladimir Homutov [Wed, 1 Apr 2020 11:25:25 +0000 (14:25 +0300)]
Refactored QUIC secrets storage.

The quic->keys[4] array now contains secrets related to the corresponding
encryption level.  All protection-level functions get proper keys and do
not need to switch manually between levels.

6 years agoAdded missing debug description.
Vladimir Homutov [Wed, 1 Apr 2020 14:21:52 +0000 (17:21 +0300)]
Added missing debug description.

6 years agoTLS Early Data support.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:42 +0000 (13:27 +0300)]
TLS Early Data support.

6 years agoTLS Early Data key derivation support.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:42 +0000 (13:27 +0300)]
TLS Early Data key derivation support.

6 years agoSending HANDSHAKE_DONE just once with BoringSSL.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:42 +0000 (13:27 +0300)]
Sending HANDSHAKE_DONE just once with BoringSSL.

If early data is accepted, SSL_do_handshake() completes as soon as ClientHello
is processed.  SSL_in_init() will report the handshake is still in progress.

6 years agoQUIC packet padding to fulfil header protection sample demands.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:42 +0000 (13:27 +0300)]
QUIC packet padding to fulfil header protection sample demands.

6 years agoImproved SSL_do_handshake() error handling in QUIC.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:42 +0000 (13:27 +0300)]
Improved SSL_do_handshake() error handling in QUIC.

It can either return a recoverable SSL_ERROR_WANT_READ or fatal errors.

6 years agoStyle.
Sergey Kandaurov [Wed, 1 Apr 2020 10:27:41 +0000 (13:27 +0300)]
Style.

6 years agoRemoved unused field from ngx_quic_header_t.
Vladimir Homutov [Tue, 31 Mar 2020 10:13:12 +0000 (13:13 +0300)]
Removed unused field from ngx_quic_header_t.

6 years agoHTTP/3: http3 variable.
Sergey Kandaurov [Sat, 28 Mar 2020 15:41:31 +0000 (18:41 +0300)]
HTTP/3: http3 variable.

6 years agoHTTP/3: static table cleanup.
Sergey Kandaurov [Sat, 28 Mar 2020 15:02:20 +0000 (18:02 +0300)]
HTTP/3: static table cleanup.

6 years agoParsing HTTP/3 request body.
Roman Arutyunyan [Fri, 27 Mar 2020 16:41:06 +0000 (19:41 +0300)]
Parsing HTTP/3 request body.

6 years agoFixed handling QUIC stream eof.
Roman Arutyunyan [Fri, 27 Mar 2020 07:02:45 +0000 (10:02 +0300)]
Fixed handling QUIC stream eof.

Set r->pending_eof flag for a new QUIC stream with the fin bit.  Also, keep
r->ready set when r->pending_eof is set and buffer is empty.

6 years agoPush QUIC stream frames in send() and cleanup handler.
Roman Arutyunyan [Fri, 27 Mar 2020 16:08:24 +0000 (19:08 +0300)]
Push QUIC stream frames in send() and cleanup handler.

6 years agoChunked response body in HTTP/3.
Roman Arutyunyan [Fri, 27 Mar 2020 16:46:54 +0000 (19:46 +0300)]
Chunked response body in HTTP/3.

6 years agoFixed buffer overflow.
Roman Arutyunyan [Fri, 27 Mar 2020 12:50:42 +0000 (15:50 +0300)]
Fixed buffer overflow.

6 years agoUnbreak sending CONNECTION_CLOSE from the send_alert callback.
Sergey Kandaurov [Fri, 27 Mar 2020 09:52:08 +0000 (12:52 +0300)]
Unbreak sending CONNECTION_CLOSE from the send_alert callback.

6 years agoMerged ngx_quic_send_packet() into ngx_quic_send_frames().
Vladimir Homutov [Thu, 26 Mar 2020 15:29:38 +0000 (18:29 +0300)]
Merged ngx_quic_send_packet() into ngx_quic_send_frames().

This allows to avoid extra allocation and use two static buffers instead.
Adjusted maximum paket size calculation: need to account a tag.

6 years agoGot rid of memory allocation in decryption.
Vladimir Homutov [Thu, 26 Mar 2020 13:54:46 +0000 (16:54 +0300)]
Got rid of memory allocation in decryption.

Static buffers are used instead in functions where decryption takes place.

The pkt->plaintext points to the beginning of a static buffer.
The pkt->payload.data points to decrypted data actual start.

6 years agoLogging cleanup.
Vladimir Homutov [Thu, 26 Mar 2020 10:54:49 +0000 (13:54 +0300)]
Logging cleanup.

pool->log is replaced with pkt->log or explicit argument passing where
possible.

6 years agoQUIC frames reuse.
Roman Arutyunyan [Wed, 25 Mar 2020 20:40:50 +0000 (23:40 +0300)]
QUIC frames reuse.

6 years agoRemoved memory allocations from encryption code.
Vladimir Homutov [Thu, 26 Mar 2020 09:11:50 +0000 (12:11 +0300)]
Removed memory allocations from encryption code.

 + ngx_quic_encrypt():
     - no longer accepts pool as argument
     - pkt is 1st arg
     - payload is passed as pkt->payload
     - performs encryption to the specified static buffer

 + ngx_quic_create_long/short_packet() functions:
    - single buffer for everything, allocated by caller
    - buffer layout is: [ ad | payload | TAG ]
      the result is in the beginning of buffer with proper length
    - nonce is calculated on stack
    - log is passed explicitly, pkt is 1st arg
    - no more allocations inside

 + ngx_quic_create_long_header():
    - args changed: no need to pass str_t

 + added ngx_quic_create_short_header()

6 years agoFixed QUIC stream insert and find.
Roman Arutyunyan [Wed, 25 Mar 2020 11:05:40 +0000 (14:05 +0300)]
Fixed QUIC stream insert and find.

6 years agoSimplifed handling HTTP/3 streams.
Roman Arutyunyan [Wed, 25 Mar 2020 09:14:24 +0000 (12:14 +0300)]
Simplifed handling HTTP/3 streams.

6 years agoSafe QUIC stream creation.
Roman Arutyunyan [Wed, 25 Mar 2020 09:56:21 +0000 (12:56 +0300)]
Safe QUIC stream creation.

6 years agoWhen closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan [Tue, 24 Mar 2020 15:05:45 +0000 (18:05 +0300)]
When closing a QUIC connection, wait for all streams to finish.

Additionally, streams are now removed from the tree in cleanup handler.

6 years agoRemoved ngx_quic_stream_node_t.
Roman Arutyunyan [Tue, 24 Mar 2020 13:38:03 +0000 (16:38 +0300)]
Removed ngx_quic_stream_node_t.

Now ngx_quic_stream_t is directly inserted into the tree.

6 years agoImplemented eof in QUIC streams.
Roman Arutyunyan [Tue, 24 Mar 2020 10:49:42 +0000 (13:49 +0300)]
Implemented eof in QUIC streams.

6 years agoFixed log initialization.
Vladimir Homutov [Wed, 25 Mar 2020 16:42:00 +0000 (19:42 +0300)]
Fixed log initialization.

Should be done after memzero.

6 years agoAdvertise our max_idle_timeout in transport parameters.
Sergey Kandaurov [Tue, 24 Mar 2020 19:12:52 +0000 (22:12 +0300)]
Advertise our max_idle_timeout in transport parameters.

So we can easily tune how soon client would decide to close a connection.

6 years agoQUIC streams don't need filter_need_in_memory after 7f0981be07c4.
Sergey Kandaurov [Tue, 24 Mar 2020 16:17:57 +0000 (19:17 +0300)]
QUIC streams don't need filter_need_in_memory after 7f0981be07c4.

Now they inherit c->ssl always enabled from the main connection,
which makes r->main_filter_need_in_memory set for them.

6 years agoLogging cleanup.
Vladimir Homutov [Tue, 24 Mar 2020 14:03:39 +0000 (17:03 +0300)]
Logging cleanup.

 + Client-related errors (i.e. parsing) are done at INFO level
 + c->log->action is updated through the process of receiving, parsing.
   handling packet/payload and generating frames/output.

6 years agoAdded QUIC version check for sending HANDSHAKE_DONE frame.
Vladimir Homutov [Tue, 24 Mar 2020 09:15:39 +0000 (12:15 +0300)]
Added QUIC version check for sending HANDSHAKE_DONE frame.

6 years agoImplemented sending HANDSHAKE_DONE frame after handshake.
Vladimir Homutov [Tue, 24 Mar 2020 08:59:14 +0000 (11:59 +0300)]
Implemented sending HANDSHAKE_DONE frame after handshake.

This makes it possible to switch to draft 27 by default.

6 years agoFixed client certificate verification.
Sergey Kandaurov [Mon, 23 Mar 2020 17:48:34 +0000 (20:48 +0300)]
Fixed client certificate verification.

For ngx_http_process_request() part to work, this required to set both
r->http_connection->ssl and c->ssl on a QUIC stream.  To avoid damaging
global SSL object, ngx_ssl_shutdown() is managed to ignore QUIC streams.

6 years agoRespect QUIC max_idle_timeout.
Roman Arutyunyan [Mon, 23 Mar 2020 18:20:20 +0000 (21:20 +0300)]
Respect QUIC max_idle_timeout.

6 years agoAllow ngx_queue_frame() to insert frame in the front.
Roman Arutyunyan [Mon, 23 Mar 2020 16:42:09 +0000 (19:42 +0300)]
Allow ngx_queue_frame() to insert frame in the front.

Previously a frame could only be inserted after the first element of the list.

6 years agoSupport for HTTP/3 ALPN.
Roman Arutyunyan [Mon, 23 Mar 2020 16:26:24 +0000 (19:26 +0300)]
Support for HTTP/3 ALPN.

This is required by Chrome.

6 years agoPut zero in 'First ACK Range' when acknowledging one packet.
Roman Arutyunyan [Mon, 23 Mar 2020 12:32:24 +0000 (15:32 +0300)]
Put zero in 'First ACK Range' when acknowledging one packet.

This fixes Chrome CONNECTION_ID_LIMIT_ERROR with the reason:
"Underflow with first ack block length 2 largest acked is 1".

6 years agoAvoid using QUIC connection after CONNECTION_CLOSE.
Roman Arutyunyan [Mon, 23 Mar 2020 16:19:44 +0000 (19:19 +0300)]
Avoid using QUIC connection after CONNECTION_CLOSE.

6 years agoBetter flow control and buffering for QUIC streams.
Roman Arutyunyan [Mon, 23 Mar 2020 12:49:31 +0000 (15:49 +0300)]
Better flow control and buffering for QUIC streams.

6 years agoLimit output QUIC packets with client max_packet_size.
Roman Arutyunyan [Mon, 23 Mar 2020 15:47:17 +0000 (18:47 +0300)]
Limit output QUIC packets with client max_packet_size.

Additionally, receive larger packets than 512 bytes.

6 years agoFixed received ACK fields order in debug logging.
Sergey Kandaurov [Mon, 23 Mar 2020 15:20:42 +0000 (18:20 +0300)]
Fixed received ACK fields order in debug logging.

6 years agoConnection states code cleanup.
Vladimir Homutov [Mon, 23 Mar 2020 11:53:04 +0000 (14:53 +0300)]
Connection states code cleanup.

 + ngx_quic_init_ssl_methods() is no longer there, we setup methods on SSL
   connection directly.

 + the handshake_handler is actually a generic quic input handler

 + updated c->log->action and debug to reflect changes and be more informative

 + c->quic is always set in ngx_quic_input()

 + the quic connection state is set by the results of SSL_do_handshake();

6 years agoSkip unknown transport parameters.
Vladimir Homutov [Mon, 23 Mar 2020 09:57:24 +0000 (12:57 +0300)]
Skip unknown transport parameters.

6 years agoAdd unsupported version into log.
Vladimir Homutov [Mon, 23 Mar 2020 07:57:28 +0000 (10:57 +0300)]
Add unsupported version into log.

This makes it easier to understand what client wants.

6 years agoAdded processing of client transport parameters.
Vladimir Homutov [Sat, 21 Mar 2020 17:51:59 +0000 (20:51 +0300)]
Added processing of client transport parameters.

note:
 + parameters are available in SSL connection since they are obtained by ssl
   stack

quote:
   During connection establishment, both endpoints make authenticated
   declarations of their transport parameters.  These declarations are
   made unilaterally by each endpoint.

and really, we send our parameters before we read client's.

no handling of incoming parameters is made by this patch.

6 years agoFixed CRYPTO offset generation.
Sergey Kandaurov [Sun, 22 Mar 2020 09:15:54 +0000 (12:15 +0300)]
Fixed CRYPTO offset generation.

6 years agoClosing connection on NGX_QUIC_FT_CONNECTION_CLOSE.
Sergey Kandaurov [Sun, 22 Mar 2020 08:35:15 +0000 (11:35 +0300)]
Closing connection on NGX_QUIC_FT_CONNECTION_CLOSE.

6 years agoImplemented parsing of remaining frame types.
Vladimir Homutov [Sat, 21 Mar 2020 17:49:55 +0000 (20:49 +0300)]
Implemented parsing of remaining frame types.

6 years agoFixed parsing NGX_QUIC_FT_CONNECTION_CLOSE.
Sergey Kandaurov [Sat, 21 Mar 2020 16:45:24 +0000 (19:45 +0300)]
Fixed parsing NGX_QUIC_FT_CONNECTION_CLOSE.

6 years agoFixed buffer overrun in create_transport_params() with -24.
Sergey Kandaurov [Sat, 21 Mar 2020 16:22:39 +0000 (19:22 +0300)]
Fixed buffer overrun in create_transport_params() with -24.

It writes 16-bit prefix as designed, but length calculation assumed varint.

6 years agoFixed build with macOS's long long abomination.
Sergey Kandaurov [Sat, 21 Mar 2020 15:44:10 +0000 (18:44 +0300)]
Fixed build with macOS's long long abomination.