]> git.kaiwu.me - nginx.git/log
nginx.git
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.

6 years agoRemoved unused variable.
Roman Arutyunyan [Fri, 20 Mar 2020 20:49:42 +0000 (23:49 +0300)]
Removed unused variable.

6 years agoRemoved unused variable.
Vladimir Homutov [Fri, 20 Mar 2020 17:39:41 +0000 (20:39 +0300)]
Removed unused variable.

6 years agoAdded checks for permitted frame types.
Vladimir Homutov [Fri, 20 Mar 2020 17:03:44 +0000 (20:03 +0300)]
Added checks for permitted frame types.

 + cleanup in macros for packet types
 + some style fixes in quic_transport.h (case, indentation)

6 years agoFixed parsing of CONNECTION CLOSE2 frames.
Vladimir Homutov [Fri, 20 Mar 2020 12:14:00 +0000 (15:14 +0300)]
Fixed parsing of CONNECTION CLOSE2 frames.

The "frame_type" field is not passed in case of 0x1d frame.

6 years agoAdded parsing of CONNECTION_CLOSE2 frame (0x1D).
Vladimir Homutov [Fri, 20 Mar 2020 11:50:05 +0000 (14:50 +0300)]
Added parsing of CONNECTION_CLOSE2 frame (0x1D).

The difference is that error code refers to application namespace, i.e.
quic error names cannot be used to convert it to string.

6 years agoAdedd the http "quic" variable.
Vladimir Homutov [Fri, 20 Mar 2020 09:44:45 +0000 (12:44 +0300)]
Adedd the http "quic" variable.

The value is literal "quic" for requests passed over HTTP/3, and empty string
otherwise.

6 years agoConfigurable transport parameters.
Vladimir Homutov [Fri, 20 Mar 2020 10:47:44 +0000 (13:47 +0300)]
Configurable transport parameters.

 - integer parameters can be configured using the following directives:

    quic_max_idle_timeout
    quic_max_ack_delay
    quic_max_packet_size
    quic_initial_max_data
    quic_initial_max_stream_data_bidi_local
    quic_initial_max_stream_data_bidi_remote
    quic_initial_max_stream_data_uni
    quic_initial_max_streams_bidi
    quic_initial_max_streams_uni
    quic_ack_delay_exponent
    quic_active_migration
    quic_active_connection_id_limit

 - only following parameters are actually sent:

    active_connection_id_limit
    initial_max_streams_uni
    initial_max_streams_bidi
    initial_max_stream_data_bidi_local
    initial_max_stream_data_bidi_remote
    initial_max_stream_data_uni

 (other parameters are to be added into ngx_quic_create_transport_params()
  function as needed, should be easy now)

 - draft 24 and draft 27 are now supported
   (at compile-time using quic_version macro)

6 years agoReset QUIC timeout on every datagram.
Roman Arutyunyan [Thu, 19 Mar 2020 18:46:28 +0000 (21:46 +0300)]
Reset QUIC timeout on every datagram.

6 years agoDouble MAX_STREAMS on STREAMS_BLOCKED.
Roman Arutyunyan [Fri, 20 Mar 2020 07:14:58 +0000 (10:14 +0300)]
Double MAX_STREAMS on STREAMS_BLOCKED.

6 years agoFixed ACKs to packet numbers greater than 63.
Roman Arutyunyan [Fri, 20 Mar 2020 06:23:31 +0000 (09:23 +0300)]
Fixed ACKs to packet numbers greater than 63.

6 years agoFixed specifiers in "quic packet length" logging.
Sergey Kandaurov [Thu, 19 Mar 2020 14:33:36 +0000 (17:33 +0300)]
Fixed specifiers in "quic packet length" logging.

6 years agoFixed build.
Sergey Kandaurov [Thu, 19 Mar 2020 14:22:43 +0000 (17:22 +0300)]
Fixed build.

6 years agoThe ngx_quic_frame_len() function is not really needed.
Vladimir Homutov [Thu, 19 Mar 2020 11:59:55 +0000 (14:59 +0300)]
The ngx_quic_frame_len() function is not really needed.

6 years agoAdded boundaries checks into frame parser.
Vladimir Homutov [Thu, 19 Mar 2020 14:07:12 +0000 (17:07 +0300)]
Added boundaries checks into frame parser.

The ngx_quic_parse_frame() functions now has new 'pkt' argument: the packet
header of a currently processed frame.  This allows to log errors/debug
closer to reasons and perform additional checks regarding possible frame
types.  The handler only performs processing of good frames.

A number of functions like read_uint32(), parse_int[_multi] probably should
be implemented as a macro, but currently it is better to have them as
functions for simpler debugging.

6 years agoSend a FIN frame when QUIC stream is closed.
Roman Arutyunyan [Thu, 19 Mar 2020 12:34:35 +0000 (15:34 +0300)]
Send a FIN frame when QUIC stream is closed.

6 years agoFixed header creation for header_only responses in HTTP/3.
Roman Arutyunyan [Thu, 19 Mar 2020 12:03:09 +0000 (15:03 +0300)]
Fixed header creation for header_only responses in HTTP/3.

6 years agoMAX_DATA frame parser/handler.
Sergey Kandaurov [Wed, 18 Mar 2020 20:26:26 +0000 (23:26 +0300)]
MAX_DATA frame parser/handler.

6 years agoAdded parsing of STREAMS BLOCKED frames.
Vladimir Homutov [Thu, 19 Mar 2020 08:15:43 +0000 (11:15 +0300)]
Added parsing of STREAMS BLOCKED frames.

While there, added hex prefix for debug to avoid frame type confusion.

6 years agoImplemented send_alert callback, CONNECTION_CLOSE writer.
Sergey Kandaurov [Wed, 18 Mar 2020 20:07:40 +0000 (23:07 +0300)]
Implemented send_alert callback, CONNECTION_CLOSE writer.

The callback produces a CONNECTION_CLOSE frame, as per quic-tls-24#section-4.9.

6 years agoAdded copying addr_text to QUIC stream connections.
Roman Arutyunyan [Wed, 18 Mar 2020 17:28:28 +0000 (20:28 +0300)]
Added copying addr_text to QUIC stream connections.

Now $remote_addr holds client address.

6 years agoHTTP/3 $request_line variable.
Roman Arutyunyan [Wed, 18 Mar 2020 17:22:16 +0000 (20:22 +0300)]
HTTP/3 $request_line variable.

6 years agoMoved setting QUIC methods to runtime.
Roman Arutyunyan [Wed, 18 Mar 2020 13:37:16 +0000 (16:37 +0300)]
Moved setting QUIC methods to runtime.

This allows listening to both https and http3 in the same server.
Also, the change eliminates the ssl_quic directive.

6 years agoAdded parsing of RESET_STREAM and STOP_SENDING frames
Vladimir Homutov [Wed, 18 Mar 2020 13:35:11 +0000 (16:35 +0300)]
Added parsing of RESET_STREAM and STOP_SENDING frames

6 years agoFixed pointer increment while parsing HTTP/3 header.
Roman Arutyunyan [Wed, 18 Mar 2020 12:28:20 +0000 (15:28 +0300)]
Fixed pointer increment while parsing HTTP/3 header.

6 years agoImplemented creation of server unidirectional streams.
Vladimir Homutov [Wed, 18 Mar 2020 10:49:39 +0000 (13:49 +0300)]
Implemented creation of server unidirectional streams.

The ngx_quic_create_stream() function is a generic function extracted from
the ngx_quic_handle_stream_frame() function.

6 years agoFixed HTTP/3 server stream creation.
Roman Arutyunyan [Wed, 18 Mar 2020 11:10:44 +0000 (14:10 +0300)]
Fixed HTTP/3 server stream creation.

6 years agoRemoved comment.
Roman Arutyunyan [Wed, 18 Mar 2020 11:09:50 +0000 (14:09 +0300)]
Removed comment.

6 years agoRefactored HTTP/3 parser.
Roman Arutyunyan [Wed, 18 Mar 2020 10:46:35 +0000 (13:46 +0300)]
Refactored HTTP/3 parser.

6 years agoStyle and handlers.
Vladimir Homutov [Wed, 18 Mar 2020 10:02:19 +0000 (13:02 +0300)]
Style and handlers.

Cleanup in ngx_event_quic.c:
    + reorderded functions, structures
    + added missing prototypes
    + added separate handlers for each frame type
    + numerous indentation/comments/TODO fixes
    + removed non-implemented qc->state and corresponding enum;
        this requires deep thinking, stub was unused.
    + streams inside quic connection are now in own structure

6 years agoExtracted transport part of the code into separate file.
Vladimir Homutov [Wed, 18 Mar 2020 09:58:27 +0000 (12:58 +0300)]
Extracted transport part of the code into separate file.

All code dealing with serializing/deserializing
is moved int srv/event/ngx_event_quic_transport.c/h file.

All macros for dealing with data are internal to source file.

The header file exposes frame types and error codes.

The exported functions are currently packet header parsers and writers
and frames parser/writer.

The ngx_quic_header_t structure is updated with 'log' member. This avoids
passing extra argument to parsing functions that need to report errors.

6 years agoFirefox fixes.
Vladimir Homutov [Tue, 17 Mar 2020 11:10:37 +0000 (14:10 +0300)]
Firefox fixes.

 + support for more than one initial packet
 + workaround for trailing zeroes in packet
 + ignore application data packet if no keys yet (issue in draft 27/ff nightly)
 + fixed PING frame parser
 + STREAM frames need to be acknowledged

The following HTTP configuration is used for firefox (v74):

http {

    ssl_certificate_key localhost.key;
    ssl_certificate localhost.crt;
    ssl_protocols TLSv1.2 TLSv1.3;

    server {
        listen 127.0.0.1:10368 reuseport http3;
        ssl_quic on;
        server_name  localhost;

        location / {
            return 200 "This-is-QUICK\n";
        }
    }
    server {
        listen 127.0.0.1:5555 ssl; # point the browser here
        server_name  localhost;
        location / {
            add_header Alt-Svc 'h3-24=":10368";ma=100';
            return 200 "ALT-SVC";
        }
    }
}

6 years agoFixed a typo with OpenSSL.
Vladimir Homutov [Mon, 16 Mar 2020 16:42:57 +0000 (19:42 +0300)]
Fixed a typo with OpenSSL.

6 years agoSplit transport and crypto parts into separate files.
Vladimir Homutov [Mon, 16 Mar 2020 16:00:47 +0000 (19:00 +0300)]
Split transport and crypto parts into separate files.

New files:
    src/event/ngx_event_quic_protection.h
    src/event/ngx_event_quic_protection.c

The protection.h header provides interface to the crypto part of the QUIC:

2 functions to initialize corresponding secrets:

ngx_quic_set_initial_secret()
ngx_quic_set_encryption_secret()

and 2 functions to deal with packet processing:

ngx_quic_encrypt()
ngx_quic_decrypt()

Also, structures representing secrets are defined there.

All functions require SSL connection and a pool, only crypto operations
inside, no access to nginx connections or events.

Currently pool->log is used for the logging (instead of original c->log).

6 years agoAdded processing of CONNECTION CLOSE frames.
Vladimir Homutov [Mon, 16 Mar 2020 10:06:43 +0000 (13:06 +0300)]
Added processing of CONNECTION CLOSE frames.

Contents is parsed and debug is output. No actions are taken.

6 years agoTemporary fix for header null-termination in HTTP/3.
Roman Arutyunyan [Sat, 14 Mar 2020 10:18:55 +0000 (13:18 +0300)]
Temporary fix for header null-termination in HTTP/3.

6 years agoFixed header protection application with pn length > 1.
Sergey Kandaurov [Sat, 14 Mar 2020 00:15:09 +0000 (03:15 +0300)]
Fixed header protection application with pn length > 1.

6 years agoFixed sanitizer errors.
Roman Arutyunyan [Fri, 13 Mar 2020 17:44:32 +0000 (20:44 +0300)]
Fixed sanitizer errors.

6 years agoAdded check for initialized c->ssl before calling SSL shutdown.
Vladimir Homutov [Fri, 13 Mar 2020 15:55:58 +0000 (18:55 +0300)]
Added check for initialized c->ssl before calling SSL shutdown.

6 years agoHTTP/3.
Roman Arutyunyan [Fri, 13 Mar 2020 16:36:33 +0000 (19:36 +0300)]
HTTP/3.

6 years agoFixed infinite loop in ngx_quic_stream_send_chain().
Roman Arutyunyan [Fri, 13 Mar 2020 15:30:37 +0000 (18:30 +0300)]
Fixed infinite loop in ngx_quic_stream_send_chain().

6 years agoImplemented tracking offset in STREAM frames.
Roman Arutyunyan [Fri, 13 Mar 2020 15:29:50 +0000 (18:29 +0300)]
Implemented tracking offset in STREAM frames.

6 years agoImplemented ngx_quic_stream_send_chain() method.
Roman Arutyunyan [Fri, 13 Mar 2020 12:56:10 +0000 (15:56 +0300)]
Implemented ngx_quic_stream_send_chain() method.

 - just call send in a loop

6 years agoStream "connection" read/write methods.
Vladimir Homutov [Fri, 13 Mar 2020 11:39:23 +0000 (14:39 +0300)]
Stream "connection" read/write methods.

6 years agoFix build.
Sergey Kandaurov [Thu, 12 Mar 2020 15:08:26 +0000 (18:08 +0300)]
Fix build.

6 years agoRemoved hardcoded CRYPTO and ACK frame sizes.
Vladimir Homutov [Thu, 12 Mar 2020 11:23:27 +0000 (14:23 +0300)]
Removed hardcoded CRYPTO and ACK frame sizes.

6 years agoHTTP/QUIC interface reworked.
Vladimir Homutov [Thu, 12 Mar 2020 13:54:43 +0000 (16:54 +0300)]
HTTP/QUIC interface reworked.

 - events handling moved into src/event/ngx_event_quic.c
 - http invokes once ngx_quic_run() and passes stream callback
 (diff to original http_request.c is now minimal)

 - streams are stored in rbtree using ID as a key
 - when a new stream is registered, appropriate callback is called

 - ngx_quic_stream_t type represents STREAM and stored in c->qs

6 years agoInitial parsing of STREAM frames.
Vladimir Homutov [Wed, 11 Mar 2020 12:41:35 +0000 (15:41 +0300)]
Initial parsing of STREAM frames.

6 years agoAdded support of multiple QUIC packets in single datagram.
Vladimir Homutov [Thu, 12 Mar 2020 11:43:24 +0000 (14:43 +0300)]
Added support of multiple QUIC packets in single datagram.

 - now NEW_CONNECTION_ID frames can be received and parsed

The packet structure is created in ngx_quic_input() and passed
to all handlers (initial, handshake and application data).

The UDP datagram buffer is saved as pkt->raw;
The QUIC packet is stored as pkt->data and pkt->len (instead of pkt->buf)
(pkt->len is adjusted after parsing headers to actual length)

The pkt->pos is removed, pkt->raw->pos is used instead.

6 years agoAdded more transport parameters.
Vladimir Homutov [Wed, 11 Mar 2020 12:43:23 +0000 (15:43 +0300)]
Added more transport parameters.

Needed for client to start sending streams.

6 years agoCompatibility with BoringSSL revised QUIC encryption secret APIs.
Sergey Kandaurov [Wed, 11 Mar 2020 18:53:02 +0000 (21:53 +0300)]
Compatibility with BoringSSL revised QUIC encryption secret APIs.

See for details: https://boringssl.googlesource.com/boringssl/+/1e85905%5E!/

6 years agoChacha20 header protection support with BoringSSL.
Sergey Kandaurov [Tue, 10 Mar 2020 16:15:12 +0000 (19:15 +0300)]
Chacha20 header protection support with BoringSSL.

BoringSSL lacks EVP for Chacha20.  Here we use CRYPTO_chacha_20() instead.

6 years agoChaCha20 / Poly1305 initial support.
Sergey Kandaurov [Tue, 10 Mar 2020 16:13:09 +0000 (19:13 +0300)]
ChaCha20 / Poly1305 initial support.

6 years agoUsing SSL cipher suite id to obtain cipher/digest, part 2.
Sergey Kandaurov [Tue, 10 Mar 2020 16:12:22 +0000 (19:12 +0300)]
Using SSL cipher suite id to obtain cipher/digest, part 2.

Ciphers negotiation handling refactored into ngx_quic_ciphers().

6 years agoFixed nonce in short packet protection.
Sergey Kandaurov [Tue, 10 Mar 2020 15:40:18 +0000 (18:40 +0300)]
Fixed nonce in short packet protection.

6 years agoGeneric payload handler for quic packets.
Vladimir Homutov [Tue, 10 Mar 2020 15:24:39 +0000 (18:24 +0300)]
Generic payload handler for quic packets.

 - added basic parsing of ACK, PING and PADDING frames on input
 - added preliminary parsing of SHORT headers

The ngx_quic_output() is now called after processing of each input packet.
Frames are added into output queue according to their level: inital packets
go ahead of handshake and application data, so they can be merged properly.

The payload handler is called from both new, handshake and applicataion data
handlers (latter is a stub).

6 years agoFixed header protection with negotiated cipher suite.
Sergey Kandaurov [Thu, 5 Mar 2020 17:05:40 +0000 (20:05 +0300)]
Fixed header protection with negotiated cipher suite.

6 years agoInitial packets are protected with AEAD_AES_128_GCM.
Sergey Kandaurov [Thu, 5 Mar 2020 16:49:49 +0000 (19:49 +0300)]
Initial packets are protected with AEAD_AES_128_GCM.

6 years agoFixed write secret logging in set_encryption_secrets callback.
Sergey Kandaurov [Thu, 5 Mar 2020 15:01:18 +0000 (18:01 +0300)]
Fixed write secret logging in set_encryption_secrets callback.