comparison src/event/quic/ngx_event_quic_output.c @ 8797:4715f3e669f1 quic

QUIC: updated specification references. This includes updating citations and further clarification.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 16 Jun 2021 11:55:12 +0300
parents 4117aa7fa38e
children 5b0c229ba5fe
comparison
equal deleted inserted replaced
8796:1fec68e322d0 8797:4715f3e669f1
21 #define NGX_QUIC_NEW_TOKEN_LIFETIME 600 /* seconds */ 21 #define NGX_QUIC_NEW_TOKEN_LIFETIME 600 /* seconds */
22 #define NGX_QUIC_RETRY_BUFFER_SIZE 256 22 #define NGX_QUIC_RETRY_BUFFER_SIZE 256
23 /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */ 23 /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */
24 24
25 /* 25 /*
26 * RFC 9000, 10.3. Stateless Reset
27 *
26 * Endpoints MUST discard packets that are too small to be valid QUIC 28 * Endpoints MUST discard packets that are too small to be valid QUIC
27 * packets. With the set of AEAD functions defined in [QUIC-TLS], 29 * packets. With the set of AEAD functions defined in [QUIC-TLS],
28 * packets that are smaller than 21 bytes are never valid. 30 * short header packets that are smaller than 21 bytes are never valid.
29 */ 31 */
30 #define NGX_QUIC_MIN_PKT_LEN 21 32 #define NGX_QUIC_MIN_PKT_LEN 21
31 33
32 #define NGX_QUIC_MIN_SR_PACKET 43 /* 5 rand + 16 srt + 22 padding */ 34 #define NGX_QUIC_MIN_SR_PACKET 43 /* 5 rand + 16 srt + 22 padding */
33 #define NGX_QUIC_MAX_SR_PACKET 1200 35 #define NGX_QUIC_MAX_SR_PACKET 1200
168 ngx_quic_frame_t *f; 170 ngx_quic_frame_t *f;
169 ngx_quic_send_ctx_t *ctx; 171 ngx_quic_send_ctx_t *ctx;
170 ngx_quic_connection_t *qc; 172 ngx_quic_connection_t *qc;
171 173
172 /* 174 /*
173 * 14.1. Initial Datagram Size 175 * RFC 9000, 14.1. Initial Datagram Size
174 * 176 *
175 * Similarly, a server MUST expand the payload of all UDP datagrams 177 * Similarly, a server MUST expand the payload of all UDP datagrams
176 * carrying ack-eliciting Initial packets to at least the smallest 178 * carrying ack-eliciting Initial packets to at least the smallest
177 * allowed maximum datagram size of 1200 bytes 179 * allowed maximum datagram size of 1200 bytes.
178 */ 180 */
179 181
180 qc = ngx_quic_get_connection(c); 182 qc = ngx_quic_get_connection(c);
181 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_initial); 183 ctx = ngx_quic_get_send_ctx(qc, ssl_encryption_initial);
182 184
343 if (min || has_pr) { 345 if (min || has_pr) {
344 hlen = EVP_GCM_TLS_TAG_LEN 346 hlen = EVP_GCM_TLS_TAG_LEN
345 + ngx_quic_create_header(&pkt, NULL, out.len, NULL); 347 + ngx_quic_create_header(&pkt, NULL, out.len, NULL);
346 348
347 /* 349 /*
350 * RFC 9000, 8.2.1. Initiating Path Validation
351 *
348 * An endpoint MUST expand datagrams that contain a 352 * An endpoint MUST expand datagrams that contain a
349 * PATH_CHALLENGE frame to at least the smallest allowed 353 * PATH_CHALLENGE frame to at least the smallest allowed
350 * maximum datagram size of 1200 bytes, unless the 354 * maximum datagram size of 1200 bytes, unless the
351 * anti-amplification limit for the path does not permit 355 * anti-amplification limit for the path does not permit
352 * sending a datagram of this size. 356 * sending a datagram of this size.
775 779
776 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 780 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
777 "quic retry packet sent to %xV", &pkt.dcid); 781 "quic retry packet sent to %xV", &pkt.dcid);
778 782
779 /* 783 /*
780 * quic-transport 17.2.5.1: A server MUST NOT send more than one Retry 784 * RFC 9000, 17.2.5.1. Sending a Retry Packet
785 *
786 * A server MUST NOT send more than one Retry
781 * packet in response to a single UDP datagram. 787 * packet in response to a single UDP datagram.
782 * NGX_DONE will stop quic_input() from processing further 788 * NGX_DONE will stop quic_input() from processing further
783 */ 789 */
784 return NGX_DONE; 790 return NGX_DONE;
785 } 791 }