comparison src/stream/ngx_stream_quic_module.c @ 9089:b9230e37b8a1 quic

QUIC: removed "quic_mtu" directive. The directive used to set the value of the "max_udp_payload_size" transport parameter. According to RFC 9000, Section 18.2, the value specifies the size of buffer for reading incoming datagrams: This limit does act as an additional constraint on datagram size in the same way as the path MTU, but it is a property of the endpoint and not the path; see Section 14. It is expected that this is the space an endpoint dedicates to holding incoming packets. Current QUIC implementation uses the maximum possible buffer size (65527) for reading datagrams.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 11 May 2023 10:37:51 +0400
parents dde5cb0205ef
children
comparison
equal deleted inserted replaced
9088:3028db26a0f5 9089:b9230e37b8a1
14 ngx_stream_variable_value_t *v, uintptr_t data); 14 ngx_stream_variable_value_t *v, uintptr_t data);
15 static ngx_int_t ngx_stream_quic_add_variables(ngx_conf_t *cf); 15 static ngx_int_t ngx_stream_quic_add_variables(ngx_conf_t *cf);
16 static void *ngx_stream_quic_create_srv_conf(ngx_conf_t *cf); 16 static void *ngx_stream_quic_create_srv_conf(ngx_conf_t *cf);
17 static char *ngx_stream_quic_merge_srv_conf(ngx_conf_t *cf, void *parent, 17 static char *ngx_stream_quic_merge_srv_conf(ngx_conf_t *cf, void *parent,
18 void *child); 18 void *child);
19 static char *ngx_stream_quic_mtu(ngx_conf_t *cf, void *post, void *data);
20 static char *ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, 19 static char *ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd,
21 void *conf); 20 void *conf);
22 21
23 static ngx_conf_post_t ngx_stream_quic_mtu_post =
24 { ngx_stream_quic_mtu };
25 22
26 static ngx_command_t ngx_stream_quic_commands[] = { 23 static ngx_command_t ngx_stream_quic_commands[] = {
27 24
28 { ngx_string("quic_timeout"), 25 { ngx_string("quic_timeout"),
29 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, 26 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
30 ngx_conf_set_msec_slot, 27 ngx_conf_set_msec_slot,
31 NGX_STREAM_SRV_CONF_OFFSET, 28 NGX_STREAM_SRV_CONF_OFFSET,
32 offsetof(ngx_quic_conf_t, timeout), 29 offsetof(ngx_quic_conf_t, timeout),
33 NULL }, 30 NULL },
34
35 { ngx_string("quic_mtu"),
36 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
37 ngx_conf_set_size_slot,
38 NGX_STREAM_SRV_CONF_OFFSET,
39 offsetof(ngx_quic_conf_t, mtu),
40 &ngx_stream_quic_mtu_post },
41 31
42 { ngx_string("quic_stream_buffer_size"), 32 { ngx_string("quic_stream_buffer_size"),
43 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, 33 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
44 ngx_conf_set_size_slot, 34 ngx_conf_set_size_slot,
45 NGX_STREAM_SRV_CONF_OFFSET, 35 NGX_STREAM_SRV_CONF_OFFSET,
173 * conf->stream_reject_code_uni = 0; 163 * conf->stream_reject_code_uni = 0;
174 * conf->stream_reject_code_bidi= 0; 164 * conf->stream_reject_code_bidi= 0;
175 */ 165 */
176 166
177 conf->timeout = NGX_CONF_UNSET_MSEC; 167 conf->timeout = NGX_CONF_UNSET_MSEC;
178 conf->mtu = NGX_CONF_UNSET_SIZE;
179 conf->stream_buffer_size = NGX_CONF_UNSET_SIZE; 168 conf->stream_buffer_size = NGX_CONF_UNSET_SIZE;
180 conf->max_concurrent_streams_bidi = NGX_CONF_UNSET_UINT; 169 conf->max_concurrent_streams_bidi = NGX_CONF_UNSET_UINT;
181 conf->max_concurrent_streams_uni = NGX_CONF_UNSET_UINT; 170 conf->max_concurrent_streams_uni = NGX_CONF_UNSET_UINT;
182 171
183 conf->retry = NGX_CONF_UNSET; 172 conf->retry = NGX_CONF_UNSET;
196 ngx_quic_conf_t *conf = child; 185 ngx_quic_conf_t *conf = child;
197 186
198 ngx_stream_ssl_conf_t *scf; 187 ngx_stream_ssl_conf_t *scf;
199 188
200 ngx_conf_merge_msec_value(conf->timeout, prev->timeout, 60000); 189 ngx_conf_merge_msec_value(conf->timeout, prev->timeout, 60000);
201
202 ngx_conf_merge_size_value(conf->mtu, prev->mtu,
203 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);
204 190
205 ngx_conf_merge_size_value(conf->stream_buffer_size, 191 ngx_conf_merge_size_value(conf->stream_buffer_size,
206 prev->stream_buffer_size, 192 prev->stream_buffer_size,
207 65536); 193 65536);
208 194
258 return NGX_CONF_OK; 244 return NGX_CONF_OK;
259 } 245 }
260 246
261 247
262 static char * 248 static char *
263 ngx_stream_quic_mtu(ngx_conf_t *cf, void *post, void *data)
264 {
265 size_t *sp = data;
266
267 if (*sp < NGX_QUIC_MIN_INITIAL_SIZE
268 || *sp > NGX_QUIC_MAX_UDP_PAYLOAD_SIZE)
269 {
270 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
271 "\"quic_mtu\" must be between %d and %d",
272 NGX_QUIC_MIN_INITIAL_SIZE,
273 NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);
274
275 return NGX_CONF_ERROR;
276 }
277
278 return NGX_CONF_OK;
279 }
280
281
282 static char *
283 ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 249 ngx_stream_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
284 { 250 {
285 ngx_quic_conf_t *qcf = conf; 251 ngx_quic_conf_t *qcf = conf;
286 252
287 u_char *buf; 253 u_char *buf;